Warning this is a very geeky entry aimed at apt-get users of Ubuntu, readers seeking humorous content should skip this post. Remember, this is a technical blog.
If you’re still with me, then I suspect you’ve just been plagued by the message:
Depends: libldap2 (>= 2.1.17-1) but it is not installable
I’m using Ubuntu 8.04 LTS Server Hardy Heron, specifically on a 64-bit AMD system.
Normally, when I do an $ sudo apt-get update things go very smoothly, but not today. Here’s what I got.
The following packages have been kept back:
alpine dovecot-common dovecot-imapd dovecot-pop3d libpq5 postgresql-8.3 texlive-base-bin tracThe following packages have unmet dependencies:
alpine: Depends: libldap2 (>= 2.1.17-1) but it is not installable
dovecot-common: Depends: libldap2 (>= 2.1.17-1) but it is not installable
Depends: libpq4 (>= 8.1.4) but it is not installable
libpq5: Depends: libldap2 (>= 2.1.17-1) but it is not installable
postgresql-8.3: Depends: libldap2 (>= 2.1.17-1) but it is not installable
texlive-base-bin: Depends: libpoppler0c2 (>= 0.4.2) but it is not installable
trac: Depends: python-genshi (>= 0.5) but it is not going to be installed
E: Broken packages
Unfortunately, where ever I went, I didn’t find a solution. [1] [2] [3]
The ‘recommended’ solution is: $ sudo apt-get -f install
This did not work for me, nor others.
Neither did: $ sudo apt-get dist-upgrade
At this point, I went on an apt-get remove and apt-get autoremove binge. This didn’t help either.
This got me into a horrible loop, where packages sysvinit-utils, sysvinit, and initscripts needed to be installed, but could not because:
Unpacking sysvinit-utils (from …/sysvinit-utils_2.86.ds1-47~bpo40+1_amd64.deb) …
dpkg: error processing /var/cache/apt/archives/sysvinit-utils_2.86.ds1-47~bpo40+1_amd64.deb (–unpack):
trying to overwrite `/usr/share/man/man1/mesg.1.gz’, which is also in package sysvutils
I even tried manually installing packages one at a time. Didn’t work. I was even so desperate as to move the file mesg.1.gz elsewhere. That didn’t work.
Then I tried the following and things got a little better:
$ sudo apt-get clean
$ sudo apt-get autoclean
$ sudo apt-get check
$ sudo apt-get purge
$ apt-get -f upgrade
But I now had a problem where packages, specifically alpine, depended on on libdlap2, and it was telling me that it couldn’t install it, so upgrading wasn’t possible.
I made the mistake of $ sudo apt-get remove alpine, which would not let me undo that mistake by reinstalling.
My hunt brought me to libldap2-dev, but while this installed, it didn’t help alpine’s dependencies.
Even with the super-duper do-everything command, nothing helped:
$ sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y
Then it dawned on me, perhaps some of the repositories that I added to /etc/apt/sources.list were giving conflicting dependencies. Luckily, I annotated heavily what I had ever added to this file.
There were only two things: Subversion, and Mono. Here they are. You want to comment out these lines:
## Subversion obtained from https://edge.launchpad.net/~clazzes.org/+archive
deb http://ppa.launchpad.net/clazzes.org/ubuntu hardy main
deb-src http://ppa.launchpad.net/clazzes.org/ubuntu hardy main## Mono added by request of FogBugz installation
## http://www.fogcreek.com/FogBugz/docs/60/topics/setup/UnixGettingYourServerRead.html#deb
deb http://www.backports.org/debian etch-backports main contrib non-free
Then, I did a $ sudo apt-get updatee, followed by a $ sudo apt-get dist-upgrade, then a $ sudo apt-get dist-upgrade.
All of my problems were solved. No package dependency problems what-so-ever, and I was able to install alpine, and all the others, bringing me up to the latest and greatest.
Finally, I uncommented my sources.list file back to the way it was and tried the upgrade again. No errors. Everything was fine.
The solution was that something, and I don’t know which one, was causing conflicts. Reverting back to the virgin sources.list file state was enough to get Ubuntu happy to do the upgrades.
Unfortunately, since re-commenting the lines didn’t reintroduce the problem, I’m unable to tell you which repository caused the problem in the first place.