How To Upgrade Debian Lenny (Debian 5.0) To Squeeze (Debian 6.0) On Xen VPS
How To Upgrade Debian Lenny (Debian 5.0) To Squeeze (Debian 6.0) On Xen VPSThis tutorial shows how to upgrade a Debian Lenny (Debian 5.0) installation on a Xen based Virtual Private Server (VPS) to Squeeze (Debian 6.0) including kernel update, dependency based boot sequencing and conversion to UUIDs. If you do it the usual Debian way just with apt-get dist-upgrade you will most likely end up with an unbootable system. This is mainly because the update of grub fails. Limitation: You will not be able to update grub. You have to stay with your old grub version instead; this tutorial shows how to achieve this. If anyone found a solution for this issue, please submit a comment. However, comments and criticism is welcome anytime! Disclaimer: Even if all the steps in this how-to were carefully tested, I do not issue any guarantee that this will work for you! Do this at your own risk. Do not try this in a production environment, do not try this if you do not have access to a serial console so you are able to reverse the steps, and back up your data or make a snapshot in advance! You may end up with an unbootable system!
0 Some Optional StepsThe following steps are not needed to upgrade to Squeeze, but they may be useful for some of you.
0.1 Adding A Swap File (Optional)For those who run a VPS with very little RAM and swap space (<512 MB) like me, it may be nice or even necessary to extend the swap space. The following commands will create a 2 GB swap file named swapfile in the root directory, format it and activate it: dd if=/dev/zero of=/swapfile bs=1024 count=2097152 && mkswap /swapfile && swapon /swapfile This adds a line to your /etc/fstab to activate the swap file automatically during booting: echo "/swapfile none swap sw 0 0" >> /etc/fstab
0.2 Make Shell Prompt Coloured (Optional)This command adds an entry to your /root/.bashrc which will give you a coloured prompt like root@host:/etc# after your next login: echo "PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '" >>/root/.bashrc
1 Upgrade The System To Debian Squeeze (Debian 6.0)Please make sure you follow all steps carefully. Do nothing else until you complete this how-to to the end. Especially, do not reboot until you are finished!
1.1 Update sources.listUse the following entries in your /etc/apt/sources.list: vi /etc/apt/sources.list You should substitute the us with a mirror close to you. You may include additional sources for your needs after these lines. #squeeze deb http://ftp.us.debian.org/debian/ squeeze main contrib non-free deb-src http://ftp.us.debian.org/debian/ squeeze main contrib non-free # squeeze release replacement mirrors for volatile sources deb http://mirrors.kernel.org/debian squeeze-updates main contrib deb-src http://mirrors.kernel.org/debian squeeze-updates main contrib #security-squeeze deb http://security.debian.org/ squeeze/updates main contrib non-free deb-src http://security.debian.org/ squeeze/updates main contrib non-free Run apt-get update
1.2 Install / Update / Configure localesWe do this step in advance to get rid of annoying error messages like can't set the locale; make sure $LC_* and $LANG are correct during the installation: apt-get install locales
Services to restart for GNU libc library upgrade: dpkg-reconfigure locales Select the locale(s) suitable for your use, in this example it is en_DK.UTF-8:
Locales to be generated: Set the default locale:
Default locale for the system environment:
1.3 Prevent Automatic Upgrade Of grubThe following commands will configure apt to not upgrade grub, grub-common and grub-pc (if installed): echo "grub hold" | dpkg --set-selections && echo "grub-common hold" | dpkg --set-selections && echo "grub-pc hold" | dpkg --set-selections
1.4 Running dist-upgradeNow we are ready to download and install the actual upgrade. Depending on your last update, there will be quite a lot to download and install. You will be asked several important questions during the installation, please read everything carefully. Run: apt-get dist-upgrade Just make sure that everything from step 1.3 is working properly by checking for these lines:
Calculating upgrade... Done Use dash or not, whatever you prefer, it does not affect the upgrade process: Use dash as the default system shell (/bin/sh)?
Services to restart for PAM library upgrade: Migrate to dependency-based boot sequencing:
Migrate legacy boot sequencing to dependency-based sequencing? Use UUIDs instead of device names:
Update disk device IDs in system configuration?
Apply configuration changes to disk device IDs?
1.5 Edit /etc/fstabvi /etc/fstab Comment out /dev/pts and /dev/shm from /etc/fstab, otherwise the system will fail to boot: [...] # none /dev/pts devpts gid=5,mode=620 0 0 # none /dev/shm tmpfs defaults 0 0 [...]
1.6 Configure grubFinally we have to configure grub to use UUIDs instead of device names. cat /etc/fstab Locate and copy the UUID of your / partition. Important: Copy the UUID from your fstab, not the one from this example: [...]
# /dev/sda1 / ext3 defaults 1 1
UUID=your-uuid-here / ext3 defaults 1 1
[...]
Back up the current menu.lst: mv /boot/grub/menu.lst /boot/grub/menu.lst.backup Rebuild the menu.lst: update-grub Edit /boot/grub/menu.lst: vi /boot/grub/menu.lst Replace all occurences of root=/dev/... with root=UUID=... by using the UUID string you copied from your /etc/fstab before: [...] ## ## End Default Options ## title Debian GNU/Linux, kernel 2.6.32-5-xen-amd64 root (hd0) kernel /boot/vmlinuz-2.6.32-5-xen-amd64 root=UUID=your-uuid-here ro initrd /boot/initrd.img-2.6.32-5-xen-amd64 title Debian GNU/Linux, kernel 2.6.32-5-xen-amd64 (single-user mode) root (hd0) kernel /boot/vmlinuz-2.6.32-5-xen-amd64 root=UUID=your-uuid-here ro single initrd /boot/initrd.img-2.6.32-5-xen-amd64 [...] Double-check that you include the word UUID= followed by the number, not just the UUID itself!
1.7 Clean Up (optional)You can remove automatically installed and no longer required packages if you are sure you do not need them anymore: apt-get autoremove
2 Reboot Into Your New SystemIf you are sure you followed all the steps above carefully and did not get any error message, it is time to reboot into your new system now. Once again: I do not issue any guarantee that your system will boot, but I wish you good luck! ;-) If all else fails, you must access the serial console emulation of your VPS and revert the steps if you know what you are doing, or you must restore your backup or snapshot! reboot Have fun with Debian 6.0 Squeeze! Comments and criticism welcome!
|



Recent comments
16 hours 51 min ago
1 day 2 hours ago
1 day 3 hours ago
1 day 6 hours ago
1 day 11 hours ago
1 day 11 hours ago
1 day 13 hours ago
1 day 23 hours ago
2 days 4 hours ago
2 days 6 hours ago