While doing some testing this evening on Backtrack Linux 5 R3 I had issues with apt or aptitude complaining about some dependencies for packages I had compiled from source. One of the packages I first ran into issues with was bluez which is installed by default on Backtrack. I wanted to apply a patch to the source code and then reinstall bluez which I was able to accomplish. The issue started after that when apt started complaining that bluez was not installed any longer. Below I describe how I modified the apt dependencies tracker file which fixed my unmet dependencies errors.
**NOTE** Proceed at your own risk. If the fix we discuss below is not implemented properly you can have all sorts of issues moving forward. Also keep in mind that when new packages are installed the dependencies tree will be overwritten and you could run into these problems on a regular basis. This was a fix that worked for me on a server that can be reinstalled with minimal pain if any issues arise. Again do not do this if you are making modifications on a server that cannot be overwritten easily.
**NOTE** Please make backups of any file you modify before you modify it. This should be standard practice at all times as it will save you a ton of time in the future even if you think the changes are minor BACKUP FILES before you modify them.
Error Attempting To Install Package Using Apt On Backtrack Linux:
The package that I was attempting to install via apt is not important but the errors that follow are as I really didn’t need Apache installed or even updated for that matter but used it as an example. This fix was done on Backtrack Linux version 5 release 3 which is based off of Ubuntu 10.04 Lucid however it should work very similar on any Linux system using aptitude.
Unmet Dependencies Error After Installing Package From Source:
- root@bt:~# apt-get install apache2
- Reading package lists... Done
- Building dependency tree
- Reading state information... Done
- apache2 is already the newest version.
- apache2 set to manually installed.
- You might want to run `apt-get -f install' to correct these:
- The following packages have unmet dependencies:
- bluediving: Depends: bluez but it is not going to be installed
- bluelog: Depends: bluez but it is not going to be installed
- bluemaho: Depends: bluez but it is not going to be installed
- bluetooth: Depends: bluez but it is not going to be installed
- Recommends: bluez-cups but it is not going to be installed
- bluez-hcidump: Depends: bluez (>= 4.91-bt0) but it is not going to be installed
- bt-audit: Depends: bluez but it is not going to be installed
- obexd: Depends: bluez (>= 4.91-bt0) but it is not going to be installed
- E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
- root@bt:~#
In my case I did not want to install bluez from the repositories as I had just finished installing it from source. There may be another way to accomplish moving past these errors but the below solution worked for me. Aptitude stores its dependency requirements for Backtrack in /var/lib/dpkg/status. Again backup this file before you even touch it for the first time because if you accidentally make a mistake it will be a pain to resolve. Once you have backed up the status file you can start making changes. Below I have output all of the before and after outputs for each package that is being complained about in the above unmet dependencies error. The dependency that is not installed (it is installed via source but not via a package as expected by aptitude/dpkg) is bluez as you can gather from the above error. You can also see each package that requires the bluez functionality. I used numerous examples not only to cover each package from the error above but some have a version requirement and others have only a single dependency which is bluez.
Updated status File To Resolve Unmet Dependencies Errors:
- ****************************
- **BEGIN CHOMP***************
- ****************************
- **ORIGINAL BLUEDIVING***
- Package: bluediving
- Status: install ok installed
- Priority: new
- Section: bt-wireless-exploitation-bluetooth;
- Maintainer: muts <muts@backtrack-linux.org>
- Architecture: i386
- Version: 0.9-bt2
- Depends: bluez, bluez-utils, libxml-simple-perl, bluez-hcidump, sox, obexftp, libreadline5, libxml2, mpg123
- Description: Bluediving is a Bluetooth penetration testing suite.
- Build-Depends: libxml-simple-perl,libusb-dev,libbluetooth-dev,libopenobex1-dev,libxml2-dev,obexftp,libreadline5,libreadline5-dev,libxml2-dev
- Homepage: http://bluediving.sourceforge.net/
- ***********************
- **UPDATED BLUEDIVING***
- Package: bluediving
- Status: install ok installed
- Priority: new
- Section: bt-wireless-exploitation-bluetooth;
- Maintainer: muts <muts@backtrack-linux.org>
- Architecture: i386
- Version: 0.9-bt2
- Depends: bluez-utils, libxml-simple-perl, bluez-hcidump, sox, obexftp, libreadline5, libxml2, mpg123
- Description: Bluediving is a Bluetooth penetration testing suite.
- Build-Depends: libxml-simple-perl,libusb-dev,libbluetooth-dev,libopenobex1-dev,libxml2-dev,obexftp,libreadline5,libreadline5-dev,libxml2-dev
- Homepage: http://bluediving.sourceforge.net/
- ***********************
- **ORIGINAL BLUELOG*****
- Package: bluelog
- Status: install ok installed
- Priority: new
- Section: bt-wireless-exploitation-bluetooth;
- Maintainer: dookie <dookie@backtrack-linux.org>
- Architecture: i386
- Version: 1.0.3-bt0
- Depends: bluez
- Description: A Linux Bluetooth scanner written to do a single task, log devices that are in discoverable mode.
- Build-Depends: libbluetooth-dev
- Homepage: http://www.digifail.com/software/bluelog.shtml
- ***********************
- **UPDATED BLULOG*******
- Package: bluelog
- Status: install ok installed
- Priority: new
- Section: bt-wireless-exploitation-bluetooth;
- Maintainer: dookie <dookie@backtrack-linux.org>
- Architecture: i386
- Version: 1.0.3-bt0
- Description: A Linux Bluetooth scanner written to do a single task, log devices that are in discoverable mode.
- Build-Depends: libbluetooth-dev
- Homepage: http://www.digifail.com/software/bluelog.shtml
- ***********************
- **ORIGINAL BLUEMAHO****
- Package: bluemaho
- Status: install ok installed
- Priority: new
- Section: bt-wireless-exploitation-bluetooth
- Maintainer: crossbower <crossbower@backtrack-linux.org>
- Architecture: i386
- Version: 090417-bt0
- Depends: eterm, python2, python-lightblue, python-wxgtk2.8, bluez, libxml2, libusb-0.1-4, libreadline5, libopenobex1, pkg-config
- Description: BlueMaho is GUI-shell (interface) for suite of tools for testing security of bluetooth devices. It is freeware, opensource, written on python, uses wxPyhon. It can be used for testing BT-devices for known vulnerabilities and major thing to do - testing to find unknown vulns. Also it can form nice statistics.
- Build-Depends: gcc, make, bluez, libxml2-dev, libusb-dev, libreadline5-dev, libopenobex-dev, pkg-config
- Homepage: http://wiki.thc.org/BlueMaho
- ***********************
- **UPDATED BLUEMAHO*****
- Package: bluemaho
- Status: install ok installed
- Priority: new
- Section: bt-wireless-exploitation-bluetooth
- Maintainer: crossbower <crossbower@backtrack-linux.org>
- Architecture: i386
- Version: 090417-bt0
- Depends: eterm, python2, python-lightblue, python-wxgtk2.8, libxml2, libusb-0.1-4, libreadline5, libopenobex1, pkg-config
- Description: BlueMaho is GUI-shell (interface) for suite of tools for testing security of bluetooth devices. It is freeware, opensource, written on python, uses wxPyhon. It can be used for testing BT-devices for known vulnerabilities and major thing to do - testing to find unknown vulns. Also it can form nice statistics.
- Build-Depends: gcc, make, libxml2-dev, libusb-dev, libreadline5-dev, libopenobex-dev, pkg-config
- Homepage: http://wiki.thc.org/BlueMaho
- ***********************
- **ORIGINAL BLUETOOTH***
- Package: bluetooth
- Status: install ok installed
- Priority: optional
- Section: admin
- Installed-Size: 80
- Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
- Architecture: all
- Source: bluez
- Version: 4.60-0ubuntu8
- Depends: bluez
- Recommends: bluez-alsa, bluez-cups, bluez-gstreamer
- Description: Bluetooth support
- This package provides all of the different plugins supported
- by the Bluez bluetooth stack.
- Homepage: http://www.bluez.org
- Original-Maintainer: Debian Bluetooth Maintainers <pkg-bluetooth-maintainers@lists.alioth.debian.org>
- ***********************
- **UPDATED BLUETOOTH****
- Package: bluetooth
- Status: install ok installed
- Priority: optional
- Section: admin
- Installed-Size: 80
- Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
- Architecture: all
- Source: bluez
- Version: 4.60-0ubuntu8
- Recommends: bluez-alsa, bluez-cups, bluez-gstreamer
- Description: Bluetooth support
- This package provides all of the different plugins supported
- by the Bluez bluetooth stack.
- Homepage: http://www.bluez.org
- Original-Maintainer: Debian Bluetooth Maintainers <pkg-bluetooth-maintainers@lists.alioth.debian.org>
- ***************************
- **ORIGINAL BLUEZ-HCIDUMP***
- Package: bluez-hcidump
- Status: install ok installed
- Priority: new
- Section: bt-network-analysis-wireless-bluetooth
- Maintainer: crossbower <crossbower@backtrack-linux.org>
- Architecture: i386
- Version: 2.4-bt0
- Depends: bluez (>= 4.91-bt0)
- Description: Bluetooth data dump and protocol analysis
- Build-Depends: gcc, make, bluez
- Homepage: http://www.bluez.org/download/
- ***************************
- **UPDATED BLUEZ-HCIDUMP****
- Package: bluez-hcidump
- Status: install ok installed
- Priority: new
- Section: bt-network-analysis-wireless-bluetooth
- Maintainer: crossbower <crossbower@backtrack-linux.org>
- Architecture: i386
- Version: 2.4-bt0
- Description: Bluetooth data dump and protocol analysis
- Build-Depends: gcc, make, bluez
- Homepage: http://www.bluez.org/download/
- ***************************
- **ORIGINAL BT-AUDIT********
- Package: bt-audit
- Status: install ok installed
- Priority: new
- Section: bt-wireless-exploitation-bluetooth;
- Maintainer: dookie <dookie@backtrack-linux.org>
- Architecture: i386
- Version: 0.1.1-bt0
- Depends: bluez
- Description: BT Audit provides applications to scan the L2CAP PSMs (Protocol Service Multiplexers) and the RFCOMM Channels.
- Build-Depends: gcc,bluez
- Homepage: http://trifinite.org/trifinite_stuff_btaudit.html
- ***************************
- **UPDATED-BTAUDIT**********
- Package: bt-audit
- Status: install ok installed
- Priority: new
- Section: bt-wireless-exploitation-bluetooth;
- Maintainer: dookie <dookie@backtrack-linux.org>
- Architecture: i386
- Version: 0.1.1-bt0
- Description: BT Audit provides applications to scan the L2CAP PSMs (Protocol Service Multiplexers) and the RFCOMM Channels.
- Build-Depends: gcc,bluez
- Homepage: http://trifinite.org/trifinite_stuff_btaudit.html
- ***************************
- **ORIGINAL OBEXD***********
- Package: obexd
- Status: install ok installed
- Priority: new
- Section: Extra
- Maintainer: crossbower <crossbower@backtrack-linux.org>
- Architecture: i386
- Version: 0.44-bt0
- Replaces: obexd-client, obexd-server
- Depends: libopenobex1, libdbus-1-3, libglib2.0-0, libasound2, libusb-0.1-4, libical0, bluez (>= 4.91-bt0)
- Description: OBEX connectivity. Client and Server.
- Build-Depends: libopenobex1-dev, libdbus-1-dev, libglib2.0-dev, libasound2-dev, libusb-dev, libical-dev, flex, bison
- Homepage: http://www.bluez.org/download/
- ***************************
- **UPDATED OBEXD************
- Package: obexd
- Status: install ok installed
- Priority: new
- Section: Extra
- Maintainer: crossbower <crossbower@backtrack-linux.org>
- Architecture: i386
- Version: 0.44-bt0
- Replaces: obexd-client, obexd-server
- Depends: libopenobex1, libdbus-1-3, libglib2.0-0, libasound2, libusb-0.1-4, libical0
- Description: OBEX connectivity. Client and Server.
- Build-Depends: libopenobex1-dev, libdbus-1-dev, libglib2.0-dev, libasound2-dev, libusb-dev, libical-dev, flex, bison
- Homepage: http://www.bluez.org/download/
- ****************************
- **END CHOMP*****************
- ****************************
There is obviously a ton of output above but what should be concentrated on are the “Depends:” lines. Compare each Depends: line from the ORIGINAL XYZ to the UPDATED XYZ and you will see where I have removed either just “bluez” or where I have removed “Depends: bluez”.
If you run into this issue where the version required is incorrect you could also just updated the version. For instance if I had somepackage version 4.97 installed but a package that was installed had a Depends line that was something like “Depends: somepackage (>= 4.91-xyz)” then you could change that to “Depends: somepackage (>= 4.97-xyz)” and that would allow aptitude to operate normally again.
Please again keep in mind that as any of these packages are updated this issue will show its ugly face again. Once I manually edited the /var/lib/dpkg/status file with the above changes I was then able to use apt again as shown in the below example.
Aptitude Playing Nice Again After Manually Editing DPKG Status File:
- root@bt:~# apt-get install apache2
- Reading package lists... Done
- Building dependency tree
- Reading state information... Done
- apache2 is already the newest version.
- apache2 set to manually installed.
- 0 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.
- root@bt:~#
If anyone has a more correct way to approach the issue of unmet dependencies error when installing packages from source please let me know in the comments below!