Upgrade Debian Lenny To Squeeze In A Few Simple Steps

Want to support HowtoForge? Become a subscriber!
 
Submitted by Debinix (Contact Author) (Forums) on Mon, 2011-02-07 17:00. :: Debian

Upgrade Debian Lenny To Squeeze In A Few Simple Steps

One rather old laptop and one server were the test objects for this howto. Both systems did not have any RAID devices and use a simple partition scheme from a default basic Lenny install. If your setup deviates much from this, it's highly recommended to read all details of the Debian Release Notes before you continue. Be warned. All commands are run as root and Debian recommends to use apt-get for the Squeeze upgrade process.

As with all upgrades, begin with a backup of your critical data, and that will be the users data in /home/your-users but I would also back up the content of all configurations files. The latter can quickly be archived:

tar -czvf host.etc.tar.gz /etc

Move your files for safe storage on a backup drive.

 

Edit your Apt sources list file

To prepare for the installer, we need to get to a point where the package system is in a clean state. Move the preferences file from the directory if used. If you have a very complicated Debian source file, I would recommend that this is simplified to near the original install.

Open up a command line editor and reduce /etc/apt/sources.list to something similar to only:

deb http://ftp.se.debian.org/debian/ lenny main contrib non-free 
deb-src http://ftp.se.debian.org/debian/ lenny main contrib non-free 
deb http://security.debian.org/ lenny/updates main 
deb-src http://security.debian.org/ lenny/updates main 
deb http://volatile.debian.org/debian-volatile lenny/volatile main 
deb-src http://volatile.debian.org/debian-volatile lenny/volatile main 

Naturally your country code is likely to be different from mine se.

 

Update the packages for Lenny

With a few commands we will make sure that the existing package system is in good shape before the system is upgraded to Squeeze.

apt-get update

Ready for first upgrade:

apt-get upgrade

Follow this with:

apt-get dist-upgrade

 

Check that no packages are on hold or in any half installed state

The system usually contains many many packages, and before the real upgrade stage we must fix such problem packages.

Ensure that we do not have any packages on hold with:

dpkg --audit
dpkg --get-selections | grep hold

No packages can be on hold.

For the final go ahead test use:

aptitude

Press g and the list shows which packages need your attention. Fix any packages in the action list, until the message says:

No packages are scheduled to be installed, removed or upgraded

Only then you are done and ready to pass this point.

 

Update the source list for Squeeze

Update once more the /etc/apt/sources.list:

deb http://ftp.se.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.se.debian.org/debian/ squeeze main contrib non-free
deb http://security.debian.org/ squeeze/updates main 
deb-src http://security.debian.org/ squeeze/updates main

and at the command line type:

apt-get update

 

Squeeze upgrade in two careful steps

It's recommenced to use a two stage upgrade approach with kernel, udev and the preparation for grub2. After the first completed the full distribution upgrade is performed. Start with the upgrade like so:

apt-get upgrade

Now to the kernel; we need to find your flavor, i.e. the exact version numbers and architecture and install it with:

uname -r
apt-get install linux-image-2.6.26-2-amd64

If the system is old like my laptop it would install with:

apt-get install linux-image-2.6.26-2-686

Prepare grub2 and udev for the new system:

update-grub
apt-get install udev

Once previous steps have completed, it's time to restart the system:

reboot

 

Almost there

When the system has restarted, continue with the full upgrade phase, download and upgrade:

 apt-get -d dist-upgrade

apt-get dist-upgrade

The latter will be interactive. Starting the system with the first menu item shows if grub2 works properly, if so run:

upgrade-from-grub-legacy

which will install grub2 in the Master Boot Record (MBR) on the disk.

Further information are found on Debian main site and in the Release Notes here http://www.debian.org/releases/stable/releasenotes


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Anonymous (not registered) on Wed, 2012-12-19 00:48.
Upgrading is usually hard to follow and error prone. This worked perfectly! Nice work.
Submitted by ewcy (not registered) on Mon, 2012-07-30 19:22.
For those who encounter MySQL server dying after this upgrade, check out this page: http://forums.debian.net/viewtopic.php?f=17&t=59674

 The essence is at the bottom - do a 

 apt-get install mysql-server-5.1

 and you should be fine already, no need to fuss with mysql_upgrade etc.

Submitted by Karel (not registered) on Mon, 2012-05-07 10:45.

I used your HOWTO up to the point to upgrade from Lenny to Squeeze on my cca 8 year old Toshiba Satellite and it worked all perfectly! I remember it was similar to upgrade from Etch to Lenny, but that time I had a lot of pain to set up correctly my screen resolution. Now everything is fine and even sound and pictures work better than in Lenny. Thank you!

Submitted by mr88talent (not registered) on Sat, 2012-04-28 23:11.

deb http://archive.debian.org/debian-archive/debian/ lenny main contrib non-free

deb-src http://archive.debian.org/debian-archive/debian/ lenny main contrib non-free

deb http://archive.debian.org/debian-archive/debian-security/ lenny/updates main contrib non-free

deb-src http://archive.debian.org/debian-archive/debian-security/ lenny/updates main contrib non-free

deb http://archive.debian.org/debian-archive/debian-volatile lenny/volatile main

deb-src http://archive.debian.org/debian-archive/debian-volatile lenny/volatile main

 

Submitted by Bk (not registered) on Tue, 2012-04-24 17:40.

I want to thank you for the awesome job you did putting this together!  Yes as some have said you left out lots of information which could have been helpful, if things went south.  But on the other hand you provided enough information to perform a successful upgrade.

I am an IT pro, but only use Linux on my home system.  So I'm nowhere near as proficient as I would like.  I am constantly frustrated when I run into a problem, look for assistance online, and find the "any dummy would know how to..." responses, but with no helpful information.  Linux moves fast, and "how to" books are outdated very quickly.  So I appreciated your no-nonsense "how to" guide.

Fwiw I am just about finished performing a remote (ssh) upgrade of my home system.  Base system upgrade went well (I followed all of your precautions), rebooted, and am now in the "Full Upgrade" phase.

-bk

Submitted by Anonymous (not registered) on Tue, 2011-05-17 11:20.
If you may be running a slightly out-of-date kernel you *will* need to update the kernel first in Lenny prior to this upgrade to Squeeze. It will fail otherwise with broken sub-process'. Also make sure you have your firmware drivers in /lib/firmware if nonfree. You should get some warnings for missing firmware after the squeeze kernel upgrade. I had issues with Broadcom network drivers and if I restarted that would be the whole upgrade up in smoke for a while... J.
Submitted by Anonymous (not registered) on Tue, 2011-04-05 01:01.

You got an error in there. The file is not named

 /etc/apt/source.list

 but 

 /etc/apt/sources.list.

Submitted by rduke15 (not registered) on Sat, 2011-04-16 21:44.

If yours is indeed named  "/etc/apt/sources.list.", then you better rename it to remove the trailing dot...

 

Submitted by Loïc Jaouen (not registered) on Fri, 2011-12-09 21:38.

The question is on the 's', not the trailing '.'

 /etc/apt/sources.list

Submitted by Ronny Lövstrand (not registered) on Fri, 2011-03-04 16:19.

The guide describes how to install the old debian lenny kernel but debian release notes describes it differently (and actually install the squeeze kernel 2.6.32-5). It should be: apt-get install linux-image-2.6-variant where variant is the processor type. So for your laptop it should have been: apt-get install linux-image-2.6-686

Submitted by Anonymous (not registered) on Wed, 2011-02-09 22:44.

What is this article for when there are such nice official Release Notes including the procedure described here and much more important stuff to be aware of!

http://www.debian.org/releases/stable/releasenotes

Submitted by Karl o. Pinc (not registered) on Wed, 2011-02-09 21:14.

The official release notes are where Debian publishes it's upgrade instructions. Publishing an abbreviated version is fine, but why no mention of the release notes? They contain much information as to how to avoid problems up-front and what to do about problems should they arise.

Submitted by Anonymous (not registered) on Tue, 2011-02-08 20:38.

I have found that it works best, after you change the sources list and do the update, to run "apt-get dist-upgrade -d" to make sure that you have all of the packages locally before installing anything.   It really helps if a couple of things don't play well together, and break the network halfway through, just to fix it at the end (like the network scripts being incompatible with the kernel.)

Submitted by Debinix (registered user) on Fri, 2011-02-11 02:14.
Thanks for the tip.
Submitted by jdkullmann (registered user) on Mon, 2011-02-07 20:40.

Having followed your Perfect setup for etch including changing postfix to use mysql for everything and then upgrading to lenny I was able to leave postfix in its held state for the fixes.

 This upgrade says 'nothing can be held'. I hope I can still leave postfix held or my mail system will no longer work.

Submitted by Karl O. Pinc (not registered) on Wed, 2011-02-09 21:26.

When Debian upgrades it does not automatically change any configuration files that have been manually changed. You are given the option to install the new config files, keep the old, or have various options for resolving the differences. Or you can go back and resolve the differences after upgrade. So upgrading will not "break your email system".

If you do not upgrade postfix you should not upgrade the rest of your system. All the packages in a release are designed to work together. Mixing packages from various releases is a recipe for a broken system.

(Likewise, adding non-Debian software to a Debian system puts you in a position of being your own system's integrator. Things will break, especially on upgrade, and you'll need to be able to fix them yourself -- as well as keep up with any security patches. Better to let the Debian team make sure that your software works together. Those unfamiliar with Debian often do not know that there is much software for Debian stable that is not available in the default install, but that is easily enabled.)