Maintaining Ubuntu: upgrade vs reinstall

Upgrading vs reinstalling Ubuntu when a new version arrives.  Many users on the Ubuntu Forums believe that reinstalling is a better option then upgrading. The primary reasons  are:

  • Look at the amount of topics on UF on problems with upgrading
  • An upgrade is more error prone
  • An upgrade bloats your machine
  • You don’t lose any settings (if you have a separate slice for your /home mount).
  • An upgrade takes longer then reinstalling
  • You don’t get the new features of the new release with an upgrade

The advise is often given with the best of intentions, however they are (in my opinion) ill-founded. In certain cases a reinstall might be a better option over upgrading, eg if you have to upgrade more then 5 times to get to the most current release. Mind you: most current release. Ubuntu has a minimum of four stable releases at any given point. At time of writing it is five: 6.06 LTS/8.04 LTS/8.10/9.04 and 9.10. A popular Dutch web community ( recently upgraded from Ubuntu 6.10 to 9.10 in less then a day.

Look at the amount of topics on UF on problems with upgrading

Kind of a non-argument if you ask me. Look at the amount of topics of failed installations and you have an argument not to install Ubuntu. Besides, looking on a technical support forum for threads from happy users which have performed a successful upgrade is, pardon my French, retarded. People with problems come to these forums, people who want to help as well, but the people who do not care and encountered no issues at all during an upgrade will not post threads saying the upgrade worked perfect.

An upgrade is more error prone

I really want to know why people are saying this. Only once I encountered a upgrade failure when I upgraded from 8.04 to 8.10 on the release date itself. It was an xorg/intel bug which would have made it to my system regardless of upgrading or installing Ubuntu. If a bug is in a package, it will be present, no matter how you installed that particular package. The snapshot which is used for the CD/DVD images uses the same package as from the online archives.

Incorrectly maintaining Ubuntu will lead to problems sooner or later, so yes, if you messed it up beyond repair, then an upgrade could make things worse (although an upgrade fixed my sound issues going from 6.10 to 7.04).

An upgrade bloats your machine

Partly true, some packages generate files after installation (presumably by the post-install scripts) and those files are not known by apt, when purging packages these generated files are not removed. Apt warns you a directory is not empty and will not  purge it. You have to do it yourself.

Ever noticed that clean installations will create so called “bloat” or “cruft”? Install the cruft package (sudo aptitude install cruft) and run it as root. You can exclude some directories if you want, eg /opt if you compiled software yourself and installed it in /opt. Or your /home partition/slice:

sudo cruft  --ignore /opt --ignore /home

Perform this on a clean install. I’ll give you a free beer if you don’t find any cruft.

You can also install deborphan (sudo aptitude install deborphan) to see which libaries/old libraries are possibly candidate for removal. I never ran this on a clean system, so perhaps some libraries could be considered cruft, although I never investigated this.

Then there is aptitude, which can show you obsolete packages in the interactive mode. It will show you the amount of obsolete or locally created packages. Removing them is easy as pie. Select them with aptitude, select for removal (underscore), and hit g.

Most of my obsolete packages are kernels which go back to Jaunty.

All the cruft problems which are presented here are not due to a distribution upgrade (apt-get dist-upgrade/aptitude full-upgrade), this can happen on any installation where packages are added and removed. Checking for this on a regular basis will reduce the amount of decision making when upgrading.

Upgrades takes longer and you don’t lose any of your settings (provided you have a seperate mount for /home).

This all depends on how your system is configured. I will lose settings even if when I have /home on a separate mount. Some applications require configuration files in /etc (for postfix, bind, apache, php and others), which you cannot move outside the root disk, since it is required at boot (/etc/init.d, /etc/fstab, etc). Reinstalling will overwrite the files or when you format the rootdisk prior to re-installing (which you want to do for the cruft removal process ;) ), so all your changes are lost. So you lose settings!

Takes longer? Perhaps if you have to do several incremental upgrades (eg, 8.10 to 10.04, which requires an upgrade to 9.04, 9.10 and finally to 10.04). BTW 10.04 is the current development release, so please don’t upgrade to that release just yet, unless you want report/triage/fix bugs. The upgrade itself may take a bit longer then the re-install, BUT, you don’t lose data. You have your configurations files in /etc, and the upgrade process will not touch your homedir: NO loss of data. And the upgrade process does not involve having to setup your machine again (installing additional packages, configuring those packages). The reinstall option does require additional time afterwards. I didn’t use a stopwatch, but I’m more then convinced to say that for a single upgrade or reinstall the time it takes is equal. And perhaps in favor of the upgrade.

You don’t get the new features of the new release with an upgrade

Come again? I have grub2, I have ext4 support on my Karmic box without a reinstall (coming from Hardy). apt-cache policy will help me make my point. I have lucid, karmic and jaunty enabled in my sources.list and will show how the upgrade works:

$ apt-cache policy firefox
  Installed: 3.5.6+nobinonly-0ubuntu1
  Candidate: 3.5.6+nobinonly-0ubuntu1
  Version table:
 *** 3.5.6+nobinonly-0ubuntu1 0
        990 lucid/main Packages
        100 /var/lib/dpkg/status
     3.5.6+nobinonly-0ubuntu0.9.10.1 0
        990 karmic-security/main Packages
        990 karmic-updates/main Packages
     3.5.3+build1+nobinonly-0ubuntu6 0
        990 karmic/main Packages
     3.0.16+nobinonly-0ubuntu0.9.04.1 0
        500 jaunty-security/main Packages
        500 jaunty-updates/main Packages
     3.0.8+nobinonly-0ubuntu3 0
        500 jaunty/main Packages

The Jaunty version is 3.0.8, and when it received updates, it became 3.0.16 as you can see from the updates and security repositories. For this upgrade no-one would reinstall Ubuntu. However, for the upgrade to Firefox 3.5.x in Karmic people somehow think reinstalling Ubuntu is the correct way. You trust Ubuntu to upgrade within a release, but not when you want a new release? While it makes use of the same process and principles. Makes no sense at all…

I feel a question popping up: But the new versions require package X, Y and Z and those were not available in the previous release, now what? Most of the time these packages are part of a bigger package (aka a meta-package) like the ubuntu-desktop package. If you have that particular package installed on your old release, it will be upgraded to the newer version which has the dependency to the new X, Y and Z packages. With aptitude safe-upgrade these packages will be installed automatically, apt-get is a bit different (requires dist-upgrade for it to work). However the ubuntu upgrader (update-manager/do-release-upgrade) takes care of this, so you don’t have to worry about it.

The Depends and Conflicts section of the Debian package control files (visible by running apt-cache policy packagename will make sure conflicting packages are and dependencies are respected. Upgrading such a package will remove the conflicting packages and makes sure the dependencies are installed. An example of this can be found in this bug report. As a fix I’ve added a dependency to python2.5 in the gdesklets package and when I upgrade that package it will now install python2.5 if not installed already whereas the previous version did not install the dependency:

$ apt-cache policy gdesklets
  Installed: 0.36-5ubuntu1
  Candidate: 0.36-5ubuntu1
  Version table:
     0.36.1-2ubuntu1 0
        500 karmic/universe Packages
     0.36-5ubuntu2 0
        500 jaunty/main Packages
 *** 0.36-5ubuntu1 0
        995 jaunty/universe Packages
        100 /var/lib/dpkg/status

$ sudo aptitude install gdesklets=0.36-5ubuntu2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
  python2.5{a} python2.5-minimal{a}
The following packages will be upgraded:
1 packages upgraded, 2 newly installed, 0 to remove and 0 not upgraded.

The same will happen during a release upgrade, and some packages may be removed because they are replaced by others.

Sometimes new features can be introduced but you don’t see them, you could remove (back up first in case you want to go back) your .gnome directory, or .kde if you use KDE like me and then login again to see what changes the default Ubuntu (or Kubuntu) installation has introduced, changes which you might not see when you do a fresh install (including an empty homedir). There is no difference in upgrading or reinstalling.

My verdict..

Upgrading is a viable option to get to a newer release of Ubuntu. Reinstalling has its advantages, I have done them, don’t worry :) The upgrade process is supported by Canonical by means of the update-manager and update-manager-core packages (the latter provides do-release-upgrade) and you can also upgrade Ubuntu just like you update Debian (a bit more manual work, but the exact same end result).

There are some cases where one might prefer to reinstall a newer version of Ubuntu, when you change you partition layout, or when something is so broken and the quickest way out of it is reinstalling, or whatever your reason may be to reinstall a newer version. But for me, the obvious choice is simply upgrading by the tools which are ment to do it: update-manager/do-release-upgrade/aptitude/apt-get/synaptic and perhaps even with Software Center (although I never tried that). And if you still don’t believe me, please have a look at these two guides I wrote on the community wiki: Upgrading supported versions of Ubuntu and Upgrading unsupported versions of Ubuntu. You could also have a look at this blogpost. And read this blog for a view on reinstalling over upgrading.

And, BTW, whatever your choice will be, remember to backup any important files or your complete disk before doing an upgrade or a reinstall. Better safe then sorry. I’d recommend clonezilla for backing up your data.

2 thoughts on “Maintaining Ubuntu: upgrade vs reinstall

  1. I see you share interesting things here, you can earn some extra
    money, your website has huge potential, for the monetizing method, just type in google – K2 advices how to monetize
    a website

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>