For the last two years, I have been running a Xen based VPS which has Ubuntu server on it. Up to last week, it was running Feisty Fawn (7.04), and it was time to upgrade it to Gutsy Gibbon (7.10), the latest Ubuntu version.
The upgrade had some complications, so I am documenting them here in case someone has the same problem.
Procedure for upgrade
On Debian and earlier versions of Ubuntu, the procedure for upgrading consisted of entering the commands:
# aptitude update && aptitude dist-upgrade
However, starting with Gutsy, Ubuntu has a separate update manager. In order to use that, you run the following commands:
# aptitude install update-manager-core # do-release-upgrade
On the Xen VPS, there are some bugs that causes the upgrade to fail after doing a whole lot of things.
So I try running the normal update:
# aptitude update
Which aborts with a message to run the following command.
# dpkg --configure -a
When you try to run the above command, you get lots of errors, many of them segmentation faults, and then an error saying that too many errors happened.
Troubleshooting the failure
In order to try to troubleshoot this, I do --configure for just one package:
# dpkg --configure apache2-mpm-prefork
This says that a package that it depends on is not configured, so I try the dependency:
# dpkg --configure apache2.2-common
And I get an error saying that in turn, this depends on another package, so I try that:
# dpkg --configure procps
This gives the segmentation fault ...
Googling for a solution
After some Google, I found some clues. Initially, I thought it is 140739, but downgrading did not work.
Then, I searched more and found a Xen specific problem, 152664, which seemed to fit the bill.
Deborphan to the rescue
The solution is to install and run deborphan, remove the problem packages, and then do a proper --configure.
But, that VPS does not have deborphan installed, and installing it via aptitude fails because of the original problem we are trying to solve. So we are in a catch-22 situation.
What can one do?
You can use the dpkg command directly, but you have to find and download the package.
Then download them:
# wget http://launchpadlibrarian.net/5146737/deborphan_1.7.23_i386.deb # wget http://launchpadlibrarian.net/8022814/dialog_1.1-20070604-1_i386.deb
Install dialog, then deborphan:
# dpkg -i dialog_1.1-20070604-1_i386.deb # dpkg -i deborphan_1.7.23_i386.deb
We now run deborphan, and pipe the output to aptitude with remove and automatic answering Yes.
# deborphan | xargs aptitude -y remove
Now, we can configure all packages:
# dpkg --configure -a
That completes successfully, at last ...
And after that, we run normally:
aptitude update && aptitude safe-upgrade
Hope this is helpful to someone, since I spend a couple of hours scraching my head on it ...