Wednesday, May 19, 2010

Ubuntu tip: upgrading to 10.04 fails with a cryptic message

So today I decided to upgrade my Karmic Koala installation to Lucid Lynx, the newest and baddest long-term Ubuntu release that came out late last month.

In the past, upgrades have gone very smoothly for me; you click the upgrade the button, and Ubuntu does all the rest. This time around, when I clicked upgrade, a few minutes later I was faced with this unpleasant error:

(Could not calculate the upgrade)




















Ouch.

I fumbled around for a bit, but it was like a blind man groping in the dark; for the life of me I could not figure this out.

Google came next, but surprisingly little information of value could be derived from repeated searches. The same for Ubuntu forums. Other people ran into this issue, but all the related threads seemed to end with "I'll just wait till it fixes itself" or "solved it" with no further detail.

I became rather frustrated. But also motivated. I am here to tell you how to solve this problem, regardless of its origin on your system.

The problem is actually the one stated; indeed, a package on your system is causing the update breakage. The one good thing that the error message gives you is a clue as to where to figure out more about the issue. So the steps to fix this are as follows:

1) CD to /var/log/dist-upgrade/

2) CD to the most recent directory in there. For example, my most recent at that point was 20100519-1513/

3) Examine the main.log file (use "more", or "less", or "tail", or even "gedit")

4) The last block of information will tell you, quite specifically, which package caused the break. In my case it showed the following:

2010-05-19 13:48:34,180 DEBUG Installing 'xserver-xorg-video-all' (Distro KeepInstalledPkgs rule)
2010-05-19 13:49:00,365 ERROR Dist-upgrade failed: 'E:Unable to correct problems, you have held broken packages.'
2010-05-19 13:49:00,365 DEBUG abort called
2010-05-19 13:49:00,369 DEBUG openCache()
2010-05-19 13:49:00,369 DEBUG failed to SystemUnLock() (E:Not locked)
2010-05-19 13:49:05,333 DEBUG /openCache(), new cache size 29420
2010-05-19 13:49:05,334 DEBUG enabling apt cron job

The above lines will look more or less the same in your case, except that the first line may have a different package listed.

5) Keep the terminal or gedit open so you have this information, and open Synaptics Package Manager. The next few steps are designed to easily find the offending package and its related brethren, which is a bit like looking for a needle in a haystack otherwise.

6) Open "settings", "repositories", and under the "other software" tab uncheck everything.

7) In the "settings" menu, choose "filters" and click on "new" to create a new filter. Give it a name (something like "irritating packages" would be quite appropriate).

8) In the "status" tab, click "deselect all", then check ONLY the "installed" checkbox under "current". That is the ONLY one that should be checked.

9) In the "section" tab, make sure that nothing is selected and that the radio button at the bottom is on "exclude selected sections" (we are essentially trying to exclude nothing)

10) In the "properties" tab, click "new", then choose "origin" from the pulldown menu, and type in ".ubuntu.com" in the text box. Note that the leading dot is important here! that stumped me for a couple minutes. The idea is that we are basically excluding all packages that come from Ubuntu, thereby finding all the others ones, including the pesky little thing that is causing all the trouble in the first place.

Click "OK". You've created the filter. That was the hard part.

11) Go to "custom filters" (bottom left) and look at your newly created filter. Look for your package and all its related packages (for example, in my case there were about a dozen xorg related packages). Now, for each one of those:

11a) select it
11b) under the "packages" menu, click on "force version"
11c) from the pulldown menu, pick the version that has "(karmic)" next to it. This will guarantee that you will downgrade to the plain-vanilla Ubuntu supported version.

12) Click "apply"

That should do it. Now try to run the update again. Should work like a charm.

0 Comments:

Post a Comment

<< Home