Saturday, July 10, 2010

Ubuntu 10.04: Broken Packages - Unable to Correct Dependencies

I was trying to finish an installation of Ubuntu 10.04 (Lucid Lynx). It got interrupted partway through. When I tried to finish it, I got error messages. At the point where I decided to start blogging the situation, I had just tried the advice to enter these commands:

apt-get clean
apt-get autoclean
apt-get update
apt-get upgrade
apt-get dist-upgrade
(These required "sudo" before each command or "sudo -i" by itself first.)  The first three went OK, but after "apt-get upgrade," I got this:

You might want to run `apt-get -f install' to correct these.
The following packages have unmet dependencies:
  gnome-power-manager: Depends: devicekit-power (>= 011) but it is not installable
  indicator-session: Depends: devicekit-power but it is not installable
  initramfs-tools: Breaks: mountall (< 2.0~) but 1.0 is installed
  mountall: PreDepends: libc6 (< 2.11) but 2.11.1-0ubuntu7 is installed
  ubuntu-desktop: Depends: usplash but it is not installed
  usplash-theme-ubuntu: Depends: usplash (>= 0.5.30) but it is not installed
E: Unmet dependencies. Try using -f.
Running "apt-get -f install" generated a similar message, ending with these two lines:
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies
Just before this, I had run into an error, "Could not resolve 'us.archive.ubuntu.com,'" to which one suggested solution was just to wait for a certain software repository to sort out a problem with its server.  In the present case, however, I had been having these dependency errors for weeks, each time I had booted up Ubuntu on this particular computer and had attempted to update it.  So I did not think the problem was with the repository in my case.

I ran a different search and got a new set of suggestions.  In at least one case, the suggestion to uninstall and reinstall the Gnome and KDE desktops did not seem to have solved the problem.  I tried the approach of going through the list of problem packages (quoted above) and attacking them one by one.  The error for initramfs-tools (above) looked simple enough:  I went into Synaptic, clicked on Edit > Fix Broken Packages, right-clicked on initramfs-tools, and marked it for reinstallation.  But when I clicked "Apply," it said, "Could not apply changes!  Fix broken packages first."  I tried again, this time selecting "Mark for removal."  It said it would have to "mark additional required changes."  I said OK.  It marked dozens of other packages, including some that Synaptic labeled as "(ESSENTIAL)."  I clicked Apply.  It said, "Essential packages will be removed.  This may render your system unusable!"  I cancelled that.  I tried marking a different package -- usplash-theme-ubuntu -- for reinstallation.  Again, it showed me a list of dozens of other packages that would be removed; and again, when I tried to go ahead with that, I got an indication that I was trying to remove essential packages.  I tried the suggestion to type "dpkg --purge (package name)," beginning with initramfs-tools.  I had to quit Symantec to make that go.  But it still just listed a dozen programs that depended on initramfs-tools.  I figured that trying to remove those would quickly lead to the same long list as before.

It seemed that the option, mentioned by many, of just reinstalling Ubuntu might turn out to be the fastest (if not the only) option left.  Facing that possibility, I went back and proceeded through the option of uninstalling initramfs-tools in Synaptic, including the essential packages.  This generated a new list of problems.

I had to call it quits for the time being.  I got back to this situation a few days later.  To see where things stood now, I went back into Symantec.  It said I had seven broken packages.  I marked the first on the list, gnome-power-manager, for updating, and clicked Apply.  It said this:
An error occurred
The following details are provided:
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/f/fontconfig/fontconfig-config_2.8.0-2ubuntu1_all.deb
Undetermined error [IP: 91.189.92.166 80]
[It gave me a number of other error messages similar to this one.]
That made it look like us.archive was still definitely dysfunctional.  I killed Synaptic and went into System > Administration > Software Sources > Other Software.  I checked all of those us.archive.ubuntu.com/ubuntu/ sources and clicked Remove.  Then I clicked Close > Reload.  Not surprisingly, I got this:
Could not download all repository indexes
The repository may no longer be available . . . .
I closed that.  Now I got another message:
An error occurred
The following details are provided:
E: The package fontconfig-config needs to be reinstalled, but I can't find an archive for it.
I closed that too.  Software Sources closed.  I tried restarting Synaptic, but that last error message ("An error occurred") recurred.  I retried the sequence suggested at the start of this post:commands:

sudo -i
apt-get clean
apt-get autoclean
apt-get update
apt-get upgrade
apt-get dist-upgrade
The "apt-get update" line gave me a bunch of error messages along the lines of "Ign http://security.ubuntu.com/ lucid-security" and then another bunch along the lines of "W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/lucid-security" errors, and closed with this:
E: Some index files failed to download, they have been ignored, or old one used instead.
I repeated the apt-get update command, but got the same thing.  I went ahead with "apt-get upgrade," but got this:  "E: The package fontconfig-config needs to be reinstalled, but I can't find an archive for it."  So Synaptic wouldn't start.  I tried "dpkg --purge fontconfig-config."  It said "dependency problems prevent removal of fontconfig-config."  Those problems were that "libfontconfig1 depends on fontconfig-config" and "fontconfig depends on fontconfig-config." I tried dpkg with libfontconfig1, but that gave me a list of about a hundred dependencies.

I had seen several other threads in which a complete reinstall seemed to be the only solution.  I had now reached that point myself.

3 comments:

Anonymous

i have arrived at your page and take your advice.
dissapointing.

Jeff Traylor - C9 Operations

In response to anonymous' comment:
Try this, link, maybe it will help you or others who come here looking for a solution. http://jeff-traylor.posterous.com/painful-ubuntu-upgrade-from-1104-to-1110

JESii

I had a similar problem with broken dependencies and finally solved it through use of aptitude, specific command being:
sudo aptitude install libqt4-declarative_4.8.1-0ubuntu4_amd64.deb-

I knew one of the problem packages, so the trailing minus sign tells aptitude to get rid of that package. Wonder of wonders, aptitude them proceeded to tell me what packages had to be downgraded, left alone, or removed and did it all in one fell swoop... neat!