HowTo: Upgrade Debian 5.0 (Lenny) To Debian 6.0 (Squeeze)

Posted on in Categories last updated February 6, 2011

Debian 6.0 “Squeeze” has been released and how do I upgrade to Debian GNU/Linux 6.0 from the previous release, Debian GNU/Linux 5.0 (“Lenny”) using command prompt?

Debian 6.0 introduces a dependency based boot system, making system start-up faster and more robust due to parallel execution of boot scripts and correct dependency tracking between them. Upgrades to Debian GNU/Linux 6.0 from the previous release, Debian GNU/Linux 5.0 (codenamed “Lenny”), are automatically handled by the apt-get package management tool for most configurations.

Make a backup – it cannot be stressed enough how important it is to make a backup of your system before you do this. Most of the actions listed in this post are written with the assumption that they will be executed by the root user running the bash or any other modern shell. The official Debian document recommends:

The main things you’ll want to back up are the contents of /etc, /var/lib/dpkg, /var/lib/apt/extended_states and the output of dpkg –get-selections “*” (the quotes are important). If you use aptitude to manage packages on your system, you will also want to back up /var/lib/aptitude/pkgstates.

The following insutctions are tested on 64 bit version only but should work with 32 bit system. Edit the file called /etc/apt/sources.list, enter:
# vi /etc/apt/sources.list
Find word lenny and replace with squeeze. At the end it should look as follows:

deb http://ftp.us.debian.org/debian/ squeeze main
deb-src http://ftp.us.debian.org/debian/ squeeze main

deb http://security.debian.org/ squeeze/updates main
deb-src http://security.debian.org/ squeeze/updates main

deb http://volatile.debian.org/debian-volatile squeeze/volatile main
deb-src http://volatile.debian.org/debian-volatile squeeze/volatile main

Save and close the file. Type the following command:
# apt-get update
# apt-get install apt dpkg aptitude
# apt-get dist-upgrade

Finally, reboot the server:
# reboot
After reboot make sure all required ports are open and all services are running:
# lsb_release -a
# netstat -tulpn
# tail -f /var/log/messages
# tail -f /path/to/log/file

Further readings:

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

7 comment

  1. Please base your upgrade instructions on the release notes. The instructions there were written based on a lot of different upgrade tests with a lot of different configurations — upgrading kernel and udev is believed to be important by the udev maintainer; upgrading apt separately has no benefit in this release cycle so may as well be skipped etc.

    There’s also a lot more to a clean upgrade than what you have written, particularly with the migration to insserv.

  2. It can still be a tricky business. Deb32 Gnome is my main sys, also I run many others. I upgraded my laptop to Squeeze, carefully following all recommendations. This was my trial before doing my main desktop and it went perfectly.
    Several days later I did my desktop, and it blew up. I spent the next couple days reinstalling and restoring. You just never know. Backup!!

  3. Well, I thought it’d work, since I had a “minutes-fresh” vanilla install of 5.0 and no CD for 6.0.

    What a Nightmare!!! I’ll never use this method again.

    The repositories that Debian automatically decided to use kept giving me “hash sum errors” and midway through upgrade had to perform several “apt-get -f installs”, “dpkg –configure -a”s and had to manually download several packages with w3m via command-line. (sob)

    I strongly advise against this method, at least for 32-bit i386, which is what I’m on.

    As it is I AM in gnome finally, albeit a scaled down version and still scratching m,y head as to what exactly could have happened to kill so many packages from being installed.

    Thanks anyhow.

    1. Upgrade works fine, if you follow the official instructions from http://debian.org/ and use official repositories.
      You need to do a minimal upgrade first, then upgrade kernel and udev, reboot and then ordinary dist-upgrade. Do remove all external repositories before you start, for instance when you rename distribution in sources.list

Leave a Comment