prev. article next article

ubuntu-14.04-apt problems

11 Dec 2014

motivation

i wanted to install gitlab 6.5 for testing a certain feature and i came along an issue i’ve seen plenty of times on ubuntu. but this time it is differerent, as i found the solution to the problem and i wanted to share it with everyone.

goal

my vanialla ubuntu 14.04 installation won’t accept this command:

root@gitlab-VirtualBox ~ # apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils pkg-config cmake
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libxslt1-dev' instead of 'libxslt-dev'
logrotate is already the newest version.
openssh-server is already the newest version.
pkg-config is already the newest version.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 build-essential : Depends: dpkg-dev (>= 1.13.5) but it is not going to be installed
 checkinstall : Depends: dpkg-dev but it is not going to be installed
 libcurl4-openssl-dev : Depends: librtmp-dev but it is not going to be installed
 libssl-dev : Depends: libssl1.0.0 (= 1.0.1f-1ubuntu2) but 1.0.1f-1ubuntu2.5 is to be installed
              Recommends: libssl-doc but it is not going to be installed
 libxml2-dev : Depends: libxml2 (= 2.9.1+dfsg1-3ubuntu4) but 2.9.1+dfsg1-3ubuntu4.3 is to be installed
E: Unable to correct problems, you have held broken packages.

but i need it in order to use this machine as a development machine!

solution

in short: using ‘dpkg -l’ i manually search for showstoppers. once a candidate has been identified, i remove it using ‘dpkg –purge –force-all pkgname’ and afterwards use ‘apt-get -f install’ to let apt fix the installation. to my surprise, reinstalling software, works pretty well sometimes. below i provide my complete log.

note: sometimes ‘dpkg –purge’ can be a bad thing, epsecially when you remove dpkg for instance. but since i was doing so in a virtual machine, it is not dangerous, as i had created a filesystem snapshot using virtualbox snapshotting.

note: this posting is probably a very good reason to rely on package managers as nix which does not require SAT problems to be solved in order to make software components work side-by-side.

trail and error

first i created a subset of packages to install (binary search) trying to make the problem ‘smaller’:

root@gitlab-VirtualBox ~ # apt-get install  zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev                       
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libssl-dev : Depends: libssl1.0.0 (= 1.0.1f-1ubuntu2) but 1.0.1f-1ubuntu2.5 is to be installed
              Recommends: libssl-doc but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

that worked, let’s try to minimize it further:

root@gitlab-VirtualBox ~ # apt-get install build-essential                                                                                      
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 build-essential : Depends: dpkg-dev (>= 1.13.5) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

so dpkg-dev seems to be the problem, let’s reinstall it:

root@gitlab-VirtualBox ~ # apt-get install dpkg-dev
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 dpkg-dev : Depends: libdpkg-perl (= 1.17.5ubuntu5) but 1.17.5ubuntu5.3 is to be installed
            Recommends: build-essential but it is not going to be installed
            Recommends: fakeroot
            Recommends: libalgorithm-merge-perl but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

i’m not using an unstable distribution! but anyway, the error lies in libdpkg-perl, so:

root@gitlab-VirtualBox ~ # dpkg --purge --force-all libdpkg-perl                                                                                
dpkg: libdpkg-perl: dependency problems, but removing anyway as you requested:
 lintian depends on libdpkg-perl; however:
  Package libdpkg-perl is to be removed.

(Reading database ... 177600 files and directories currently installed.)
Removing libdpkg-perl (1.17.5ubuntu5.3) ...
Processing triggers for man-db (2.6.7.1-1) ...

afterwards reinstall it:

root@gitlab-VirtualBox ~ # apt-get install dpkg-dev             
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 dpkg-dev : Depends: libdpkg-perl (= 1.17.5ubuntu5) but it is not going to be installed
            Recommends: build-essential but it is not going to be installed
            Recommends: fakeroot
            Recommends: libalgorithm-merge-perl but it is not going to be installed
 lintian : Depends: libdpkg-perl but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

that fails of course, so we do as advised:

root@gitlab-VirtualBox ~ # apt-get -f install                                                                                                   
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  libdpkg-perl
Suggested packages:
  debian-keyring
The following NEW packages will be installed:
  libdpkg-perl
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 178 kB of archives.
After this operation, 1.556 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://de.archive.ubuntu.com/ubuntu/ trusty/main libdpkg-perl all 1.17.5ubuntu5 [178 kB]
Fetched 178 kB in 0s (1.028 kB/s)
Selecting previously unselected package libdpkg-perl.
(Reading database ... 177487 files and directories currently installed.)
Preparing to unpack .../libdpkg-perl_1.17.5ubuntu5_all.deb ...
Unpacking libdpkg-perl (1.17.5ubuntu5) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up libdpkg-perl (1.17.5ubuntu5) ...

works, great! now let’s go back to build-essential:

root@gitlab-VirtualBox ~ # apt-get install build-essential      
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  dpkg-dev fakeroot g++ g++-4.8 libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libfakeroot
  libstdc++-4.8-dev
Suggested packages:
  debian-keyring g++-multilib g++-4.8-multilib gcc-4.8-doc libstdc++6-4.8-dbg
  libstdc++-4.8-doc
The following NEW packages will be installed:
  build-essential dpkg-dev fakeroot g++ g++-4.8 libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libfakeroot
  libstdc++-4.8-dev
0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 8.976 kB of archives.
After this operation, 32,1 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://de.archive.ubuntu.com/ubuntu/ trusty/main libstdc++-4.8-dev amd64 4.8.2-19ubuntu1 [1.050 kB]
Get:2 http://de.archive.ubuntu.com/ubuntu/ trusty/main g++-4.8 amd64 4.8.2-19ubuntu1 [7.038 kB]
Get:3 http://de.archive.ubuntu.com/ubuntu/ trusty/main g++ amd64 4:4.8.2-1ubuntu6 [1.490 B]
Get:4 http://de.archive.ubuntu.com/ubuntu/ trusty/main dpkg-dev all 1.17.5ubuntu5 [726 kB]
Get:5 http://de.archive.ubuntu.com/ubuntu/ trusty/main build-essential amd64 11.6ubuntu6 [4.838 B]
Get:6 http://de.archive.ubuntu.com/ubuntu/ trusty/main libfakeroot amd64 1.20-3ubuntu2 [25,4 kB]
Get:7 http://de.archive.ubuntu.com/ubuntu/ trusty/main fakeroot amd64 1.20-3ubuntu2 [55,0 kB]
Get:8 http://de.archive.ubuntu.com/ubuntu/ trusty/main libalgorithm-diff-perl all 1.19.02-3 [50,0 kB]
Get:9 http://de.archive.ubuntu.com/ubuntu/ trusty/main libalgorithm-diff-xs-perl amd64 0.04-2build4 [12,6 kB]
Get:10 http://de.archive.ubuntu.com/ubuntu/ trusty/main libalgorithm-merge-perl all 0.08-2 [12,7 kB]
Fetched 8.976 kB in 2s (3.927 kB/s)             
Selecting previously unselected package libstdc++-4.8-dev:amd64.
(Reading database ... 177602 files and directories currently installed.)
Preparing to unpack .../libstdc++-4.8-dev_4.8.2-19ubuntu1_amd64.deb ...
Unpacking libstdc++-4.8-dev:amd64 (4.8.2-19ubuntu1) ...
Selecting previously unselected package g++-4.8.
Preparing to unpack .../g++-4.8_4.8.2-19ubuntu1_amd64.deb ...
Unpacking g++-4.8 (4.8.2-19ubuntu1) ...
Selecting previously unselected package g++.
Preparing to unpack .../g++_4%3a4.8.2-1ubuntu6_amd64.deb ...
Unpacking g++ (4:4.8.2-1ubuntu6) ...
Selecting previously unselected package dpkg-dev.
Preparing to unpack .../dpkg-dev_1.17.5ubuntu5_all.deb ...
Unpacking dpkg-dev (1.17.5ubuntu5) ...
Selecting previously unselected package build-essential.
Preparing to unpack .../build-essential_11.6ubuntu6_amd64.deb ...
Unpacking build-essential (11.6ubuntu6) ...
Selecting previously unselected package libfakeroot:amd64.
Preparing to unpack .../libfakeroot_1.20-3ubuntu2_amd64.deb ...
Unpacking libfakeroot:amd64 (1.20-3ubuntu2) ...
Selecting previously unselected package fakeroot.
Preparing to unpack .../fakeroot_1.20-3ubuntu2_amd64.deb ...
Unpacking fakeroot (1.20-3ubuntu2) ...
Selecting previously unselected package libalgorithm-diff-perl.
Preparing to unpack .../libalgorithm-diff-perl_1.19.02-3_all.deb ...
Unpacking libalgorithm-diff-perl (1.19.02-3) ...
Selecting previously unselected package libalgorithm-diff-xs-perl.
Preparing to unpack .../libalgorithm-diff-xs-perl_0.04-2build4_amd64.deb ...
Unpacking libalgorithm-diff-xs-perl (0.04-2build4) ...
Selecting previously unselected package libalgorithm-merge-perl.
Preparing to unpack .../libalgorithm-merge-perl_0.08-2_all.deb ...
Unpacking libalgorithm-merge-perl (0.08-2) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up libstdc++-4.8-dev:amd64 (4.8.2-19ubuntu1) ...
Setting up g++-4.8 (4.8.2-19ubuntu1) ...
Setting up g++ (4:4.8.2-1ubuntu6) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
Setting up dpkg-dev (1.17.5ubuntu5) ...
Setting up build-essential (11.6ubuntu6) ...
Setting up libfakeroot:amd64 (1.20-3ubuntu2) ...
Setting up fakeroot (1.20-3ubuntu2) ...
update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode
Setting up libalgorithm-diff-perl (1.19.02-3) ...
Setting up libalgorithm-diff-xs-perl (0.04-2build4) ...
Setting up libalgorithm-merge-perl (0.08-2) ...
apt-get install build-essential  3,47s user 3,74s system 38% cpu 18,841 total

yay! now go back to the ‘larger problem domain’:

root@gitlab-VirtualBox ~ # apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libssl-dev : Depends: libssl1.0.0 (= 1.0.1f-1ubuntu2) but 1.0.1f-1ubuntu2.5 is to be installed
              Recommends: libssl-doc but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

and fail again but with libssl1.0.0:

root@gitlab-VirtualBox ~ # dpkg -l | grep libss                                                                                                 
ii  libss2:amd64                                          1.42.9-3ubuntu1                                     amd64        command-line interface parsing library
ii  libssh-4:amd64                                        0.6.1-0ubuntu3                                      amd64        tiny C SSH library
ii  libssl1.0.0:amd64                                     1.0.1f-1ubuntu2.5                                   amd64        Secure Sockets Layer toolkit - shared libraries

remove libssl1.0.0:

root@gitlab-VirtualBox ~ # dpkg --purge --force-all libssl1.0.0      
dpkg: libssl1.0.0:amd64: dependency problems, but removing anyway as you requested:
 libsnmp30:amd64 depends on libssl1.0.0 (>= 1.0.0).
 ntpdate depends on libssl1.0.0 (>= 1.0.0).
 python-openssl depends on libssl1.0.0 (>= 1.0.0).
 openssh-client depends on libssl1.0.0 (>= 1.0.1).
 libpython2.7-stdlib:amd64 depends on libssl1.0.0 (>= 1.0.0).
 libdns100 depends on libssl1.0.0 (>= 1.0.0).
 crda depends on libssl1.0.0 (>= 1.0.0).
 libnet-ssleay-perl depends on libssl1.0.0 (>= 1.0.1); however:
  Package libssl1.0.0:amd64 is to be removed.
 libssh-4:amd64 depends on libssl1.0.0 (>= 1.0.0).
 openssh-server depends on libssl1.0.0 (>= 1.0.1).
 libsasl2-modules:amd64 depends on libssl1.0.0 (>= 1.0.0).
 libcurl3:amd64 depends on libssl1.0.0 (>= 1.0.1).
 transmission-gtk depends on libssl1.0.0 (>= 1.0.0).
 wget depends on libssl1.0.0 (>= 1.0.0).
 tcpdump depends on libssl1.0.0 (>= 1.0.0).
 libfreerdp1:amd64 depends on libssl1.0.0 (>= 1.0.0).
 postfix depends on libssl1.0.0 (>= 1.0.0).
 ppp depends on libssl1.0.0 (>= 1.0.0).

(Reading database ... 178689 files and directories currently installed.)
Removing libssl1.0.0:amd64 (1.0.1f-1ubuntu2.5) ...
Purging configuration files for libssl1.0.0:amd64 (1.0.1f-1ubuntu2.5) ...
Processing triggers for libc-bin (2.19-0ubuntu6.1) ...

let apt fix the system again:

root@gitlab-VirtualBox ~ # apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  libssl1.0.0
The following NEW packages will be installed:
  libssl1.0.0
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 825 kB of archives.
After this operation, 2.998 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://de.archive.ubuntu.com/ubuntu/ trusty/main libssl1.0.0 amd64 1.0.1f-1ubuntu2 [825 kB]
Fetched 825 kB in 0s (1.480 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libssl1.0.0:amd64.
(Reading database ... 178672 files and directories currently installed.)
Preparing to unpack .../libssl1.0.0_1.0.1f-1ubuntu2_amd64.deb ...
Unpacking libssl1.0.0:amd64 (1.0.1f-1ubuntu2) ...
Setting up libssl1.0.0:amd64 (1.0.1f-1ubuntu2) ...
Processing triggers for libc-bin (2.19-0ubuntu6.1) ...

finally:

root@gitlab-VirtualBox ~ # apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version.
The following extra packages will be installed:
  libreadline6-dev libssl-doc libtinfo-dev libyaml-0-2
Suggested packages:
  ncurses-doc
The following NEW packages will be installed:
  curl libffi-dev libgdbm-dev libncurses5-dev libreadline-dev libreadline6-dev
  libssl-dev libssl-doc libtinfo-dev libyaml-0-2 libyaml-dev zlib1g-dev
0 upgraded, 12 newly installed, 0 to remove and 0 not upgraded.
Need to get 3.026 kB of archives.
After this operation, 11,8 MB of additional disk space will be used.
Get:1 http://de.archive.ubuntu.com/ubuntu/ trusty/main libyaml-0-2 amd64 0.1.4-3ubuntu3 [48,2 kB]
Get:2 http://de.archive.ubuntu.com/ubuntu/ trusty/main curl amd64 7.35.0-1ubuntu2 [123 kB]
Get:3 http://de.archive.ubuntu.com/ubuntu/ trusty/main libgdbm-dev amd64 1.8.3-12build1 [24,9 kB]
Get:4 http://de.archive.ubuntu.com/ubuntu/ trusty/main libtinfo-dev amd64 5.9+20140118-1ubuntu1 [76,3 kB]
Get:5 http://de.archive.ubuntu.com/ubuntu/ trusty/main libncurses5-dev amd64 5.9+20140118-1ubuntu1 [170 kB]
Get:6 http://de.archive.ubuntu.com/ubuntu/ trusty/main libreadline6-dev amd64 6.3-4ubuntu2 [213 kB]
Get:7 http://de.archive.ubuntu.com/ubuntu/ trusty/main libreadline-dev amd64 6.3-4ubuntu2 [988 B]
Get:8 http://de.archive.ubuntu.com/ubuntu/ trusty/main zlib1g-dev amd64 1:1.2.8.dfsg-1ubuntu1 [183 kB]
Get:9 http://de.archive.ubuntu.com/ubuntu/ trusty/main libssl-dev amd64 1.0.1f-1ubuntu2 [1.066 kB]
Get:10 http://de.archive.ubuntu.com/ubuntu/ trusty/main libssl-doc all 1.0.1f-1ubuntu2 [965 kB]
Get:11 http://de.archive.ubuntu.com/ubuntu/ trusty/main libffi-dev amd64 3.1~rc1+r3.0.13-12 [99,8 kB]
Get:12 http://de.archive.ubuntu.com/ubuntu/ trusty/main libyaml-dev amd64 0.1.4-3ubuntu3 [56,0 kB]
Fetched 3.026 kB in 1s (1.758 kB/s)
Selecting previously unselected package libyaml-0-2:amd64.
(Reading database ... 178691 files and directories currently installed.)
Preparing to unpack .../libyaml-0-2_0.1.4-3ubuntu3_amd64.deb ...
Unpacking libyaml-0-2:amd64 (0.1.4-3ubuntu3) ...
Selecting previously unselected package curl.
Preparing to unpack .../curl_7.35.0-1ubuntu2_amd64.deb ...
Unpacking curl (7.35.0-1ubuntu2) ...
Selecting previously unselected package libgdbm-dev.
Preparing to unpack .../libgdbm-dev_1.8.3-12build1_amd64.deb ...
Unpacking libgdbm-dev (1.8.3-12build1) ...
Selecting previously unselected package libtinfo-dev:amd64.
Preparing to unpack .../libtinfo-dev_5.9+20140118-1ubuntu1_amd64.deb ...
Unpacking libtinfo-dev:amd64 (5.9+20140118-1ubuntu1) ...
Selecting previously unselected package libncurses5-dev:amd64.
Preparing to unpack .../libncurses5-dev_5.9+20140118-1ubuntu1_amd64.deb ...
Unpacking libncurses5-dev:amd64 (5.9+20140118-1ubuntu1) ...
Selecting previously unselected package libreadline6-dev:amd64.
Preparing to unpack .../libreadline6-dev_6.3-4ubuntu2_amd64.deb ...
Unpacking libreadline6-dev:amd64 (6.3-4ubuntu2) ...
Selecting previously unselected package libreadline-dev:amd64.
Preparing to unpack .../libreadline-dev_6.3-4ubuntu2_amd64.deb ...
Unpacking libreadline-dev:amd64 (6.3-4ubuntu2) ...
Selecting previously unselected package zlib1g-dev:amd64.
Preparing to unpack .../zlib1g-dev_1%3a1.2.8.dfsg-1ubuntu1_amd64.deb ...
Unpacking zlib1g-dev:amd64 (1:1.2.8.dfsg-1ubuntu1) ...
Selecting previously unselected package libssl-dev:amd64.
Preparing to unpack .../libssl-dev_1.0.1f-1ubuntu2_amd64.deb ...
Unpacking libssl-dev:amd64 (1.0.1f-1ubuntu2) ...
Selecting previously unselected package libssl-doc.
Preparing to unpack .../libssl-doc_1.0.1f-1ubuntu2_all.deb ...
Unpacking libssl-doc (1.0.1f-1ubuntu2) ...
Selecting previously unselected package libffi-dev:amd64.
Preparing to unpack .../libffi-dev_3.1~rc1+r3.0.13-12_amd64.deb ...
Unpacking libffi-dev:amd64 (3.1~rc1+r3.0.13-12) ...
Selecting previously unselected package libyaml-dev:amd64.
Preparing to unpack .../libyaml-dev_0.1.4-3ubuntu3_amd64.deb ...
Unpacking libyaml-dev:amd64 (0.1.4-3ubuntu3) ...
Processing triggers for man-db (2.6.7.1-1) ...
Processing triggers for install-info (5.2.0.dfsg.1-2) ...
Processing triggers for doc-base (0.10.5) ...
Processing 33 changed doc-base files, 1 added doc-base file...
Setting up libyaml-0-2:amd64 (0.1.4-3ubuntu3) ...
Setting up curl (7.35.0-1ubuntu2) ...
Setting up libgdbm-dev (1.8.3-12build1) ...
Setting up libtinfo-dev:amd64 (5.9+20140118-1ubuntu1) ...
Setting up libncurses5-dev:amd64 (5.9+20140118-1ubuntu1) ...
Setting up libreadline6-dev:amd64 (6.3-4ubuntu2) ...
Setting up libreadline-dev:amd64 (6.3-4ubuntu2) ...
Setting up zlib1g-dev:amd64 (1:1.2.8.dfsg-1ubuntu1) ...
Setting up libssl-dev:amd64 (1.0.1f-1ubuntu2) ...
Setting up libssl-doc (1.0.1f-1ubuntu2) ...
Setting up libffi-dev:amd64 (3.1~rc1+r3.0.13-12) ...
Setting up libyaml-dev:amd64 (0.1.4-3ubuntu3) ...
Processing triggers for libc-bin (2.19-0ubuntu6.1) ...
apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev     curl  3,07s user 3,20s system 35% cpu 17,608 total

works!