Monday, January 30, 2012

Upgrading EOL Ubuntu versions

Upgrading older ubuntu versions is straight forward.

Just upgrade all packages

sudo aptitude update && sudo aptitude safe-upgrade

and the (after a reboot) do a 

sudo do-release-upgrade

This works fine, as long as the origin version is not EOL.
When your server is having a EOL version installed, then you must dig somewhat deeper:

You have to change the source repositories to old-releases (instead of achives as mentioned in many posts/sites)

So you do change sources.list to:

deb dapper main restricted universe multiverse
deb dapper-updates main restricted universe multiverse
deb dapper-security main restricted universe multiverse 
Then you can do the normal steps as mentioned above.
If the do-release-upgrade command is unknown, then you have to install it:

install update-manager-core

If by change you had the profile "ubuntu-desktop" installed, then first remove that one from your installation.

Modified /usr/lib/

#near line 28, add:
import time
# near the line 101-102, just after "tar.close()", add
    print "----- IT IS TIME NOW !-----"
# Note that you can adjust the time (60) by the value in seconds of your choice...
Theses lines should be like :
          # Wait about 1 minute (time to modify update script)
          print "----- IT IS TIME NOW !-----"
          return True
# Note that you must keep the text idented

Run sudo do-release-upgrade

When the script sleeps, you have just 60 seconds to do the next step:
-- Modified /tmp/tmpXXXXXX/prerequists-sources.list and prerequists-sources.dapper.list and changed them to "old-releases" as well.

Then  wait until the script continues running and asks:
"Do you want to modify the sources list?"

Make sure you don't press enter along the way or it skips that question by assuming a "no".) It will say: "WARNING: Failed to read mirror file."

Go fix /etc/apt/sources.list back to the way it used to be now. With "us.archive" instead of "old-releases" (except for the security lines, that should just be "".

Return to the update and say Yes.
The updater will modify /etc/apt/sources.list and replace all the dapper entries with hardy entries and continue updating using the servers.