This site is now 100% read-only, and retired.

Upgrading from Woody to Sarge: Part 1

Posted by Steve on Mon 14 Feb 2005 at 10:05

The next stable release of Debian is drawing closer than ever, so now is a good time to think about handling the migration. For servers only performing a single job such as being a gateway, or a proxy server, the upgrade should be straightforward. Other servers running multiple services are liable to have more complicated upgrades. With that in mind a good approach is to simulate the upgrade, allowing you to practise it.

qemu has been mentioned on this site before when we discussed running Microsoft Windows inside Debian. Put simply it is a virtual machine which allows you to install different operating systems isolated from your real machine (the host).

My first attempts at emulating upgrades from Woody to Sarge were conducted using user-mode-linux, but ironically this package is no longer scheduled to be included in Sarge. So I switched to running Qemu instead.

The first part of the job is to install the software if you don't have it already:

apt-get update
apt-get install qemu

Once this is done I created a 3Gb file on disk to represent the single disk drive which has Woody installed upon it:

dd of=hd.img bs=1024 seek=3000000 count=0

Once this has been carried out you will be ready to install Woody, and configure it to your liking.

By default the Debian Qemu package includes a setup script which gives your host machine a new IP address of 172.20.0.1 - this script is /etc/qemu-ifup, this executes when the virtual machine boots.

In order for your virtual machine to access the network I setup the following extra script:

#!/bin/sh

/sbin/modprobe tun
/bin/chmod 666 /dev/net/tun
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/bin/echo "1" >/proc/sys/net/ipv4/ip_forward

If you run this as root before you start you will be able to give your woody installation the following network details and have it access the network:

IP address: 172.20.0.2
Gateway   : 172.20.0.1

Installing woody is fairly straightforward if you have an image to boot from, either the raw ISO image or a CD-ROM. I used the following command to execute the installer:

qemu -boot d -cdrom /dev/cdrom -hda hd.img  -monitor stdio

This reads the CDROM image from the host's CD drive, and boots from it using the 3Gb file we created as the hard drive.

The installation should be fairly straightfoward. The only issue I had was that rebooting the system following the installation resulted in the CD-ROM booting again. What I did was switch to a different virtual terminal instead of choosing the "Reboot system" from the installer - executing "shutdown" from here allowed the machine to shut down.

Once the installation has finished the command to start it up was:

qemu -boot c -hda hd.img  -monitor stdio

The difference here is that we boot from the drive, and don't include any access to the host machines CD-ROM device.

Once the sytem is up and running the X11 Windowing system can be installed and the machine setup to mirror the setup of the main machine you wish to upgrade.

To save you time I've compressed and uploaded the image to the following url, so you should be able to merely uncompress it and install additional software, please note the image is 170Mb so it will take a while to download, and when uncompressed it will be 3Gb in size:

http://people.debian.org/~skx/qemu/woody.image.bz2

To download it and run it you can use:

wget http://people.debian.org/~skx/qemu/woody.image.bz2
bunzip2 woody.image.bz2
qemu -boot c -hda woody.image -monitor stdio

This, gives you a basic installation of Woody with a root password of "root" which boots up to GDM by default and has Mozilla installed.

The next job is to install and configure any additional software you have upon your main Woody machine, the intent is to literally mirror your live system so that you can attempt to upgrade it to the Sarge release and see what problems are involved.

The simplest way to mirror a Debian machine is to make a dump of the packages which are installed, and then replace that package list upon the second machine.

To save a list of all the packages upon a machine run the following command:

dpkg --get-selections > package.list

Copy that to your new machine and run:

dpkg --set-selections < package.list
apt-get dselect-upgrade

This will cause the second machine to have the same packages as the main machine - of course the configuration settings will be different, so you will need to make those match your primary machine.

The next article in this series will cover upgrading a moderately complex machine to Sarge, and walk through the problems which were found.

 

 


Re: Upgrading from Woody to Sarge: Part 1
Posted by grimoire (82.70.xx.xx) on Mon 14 Feb 2005 at 13:40
One thing I've done when using qemu is to set up Ethernet bridging on the host, between my real eth0 interface and the tun0 interface used by qemu, to allow my system inside qemu to access my network's DHCP server and gateway without IP masquerading.

[ Parent ]

Re: Upgrading from Woody to Sarge: Part 1
Posted by Steve (82.41.xx.xx) on Mon 14 Feb 2005 at 16:16
[ View Weblogs ]

Just to be clear this emulation is being conducted on a machine running Sid (Debian's unstable release), Qemu is included in both Sid and Testing - and not in Woody itself.

Whilst it might be interesting to run it on Woody the intent here is to practise upgrading Woody to Sarge virtually, not actually touching a real box until all the kinks have been worked out of the process.

Steve
-- Steve.org.uk

[ Parent ]

Re: Upgrading from Woody to Sarge: Part 1
Posted by Anonymous (66.108.xx.xx) on Tue 15 Feb 2005 at 05:57
I don't have a /dev/net/tun device file. How do I create one?

[ Parent ]

Re: Upgrading from Woody to Sarge: Part 1
Posted by Steve (82.41.xx.xx) on Tue 15 Feb 2005 at 08:11
[ View Weblogs ]

Run the following two commands as root - the first might fail if the directory already exists:

mkdir -p /dev/net
mknod /dev/net/tun c 10 200

Steve
-- Steve.org.uk

[ Parent ]

Re: Upgrading from Woody to Sarge: Part 1
Posted by butterblume (136.8.xx.xx) on Wed 18 May 2005 at 08:34
Hi folks,

does anybody know, why this does not work?
qemu -boot d -cdrom /scratch/debian-testing-i386-netinst.iso -hda /home/uml/myimage.img

The image is created with 'dd' and the Cdrom ISO file is the usual Debian-Installer ISO (MD5SUM is correct). It's not a permission problem.

[ Parent ]

Re: Upgrading from Woody to Sarge: Part 1
Posted by Steve (82.41.xx.xx) on Wed 18 May 2005 at 08:44
[ View Weblogs ]

Looks good to me - what precisely doesn't work?

Steve
-- Steve.org.uk

[ Parent ]

Re: Upgrading from Woody to Sarge: Part 1
Posted by butterblume (136.8.xx.xx) on Wed 18 May 2005 at 13:14
Hi Steve,

Hmm, that's a good question. As nothing happens. It just shows me this:
root@butterblume:/home/uml $ qemu -boot d -cdrom /scratch/debian-testing-i386-netinst.iso -hda /home/uml/hd.img
Connected to host network interface: tun0


And "qemu" uses over 90% of my CPU. That's all. I already waited for more than 10 minutes.

[ Parent ]

Re: Upgrading from Woody to Sarge: Part 1
Posted by Steve (82.41.xx.xx) on Wed 18 May 2005 at 13:57
[ View Weblogs ]

Try running it under strace, to see where it is hanging?

Two other ideas:

  • Add '-std-vga' to see if this fixes any issues with the graphics.
  • Add '-user-net' to see if using a different networking connection type helps.

(The console might say something useful if you add '-monitor stdio' to the command line too).

Steve
-- Steve.org.uk

[ Parent ]

Re: Upgrading from Woody to Sarge: Part 1
Posted by butterblume (81.173.xx.xx) on Thu 19 May 2005 at 17:16
Ok, I must confess I just want to shoot myself!
Hasn't anybody said that "qemu" starts in a new console window ...? The whole time I was working remotely. Needless to say that it works when I start it sitting in front of my PC.
Sorry for the hassle. Ohh, how embarrassing.......

[ Parent ]

Re: Upgrading from Woody to Sarge: Part 1
Posted by Anonymous (195.235.xx.xx) on Fri 20 May 2005 at 09:28
Hi,

When I starting qemu, it display

"Could not open SDL display"

How I'm doing wrong.

Thanks in advanced.

[ Parent ]

Re: Upgrading from Woody to Sarge: Part 1
Posted by Steve (82.41.xx.xx) on Fri 20 May 2005 at 09:33
[ View Weblogs ]

That comes from an error creating the main window - you must be working in an X11 environment with a valid DISPLAY setup.

More details would help - but it could be something as simple as running the program under ssh, or not having permission to open windows on the current desktop.

Steve
-- Steve.org.uk

[ Parent ]

Re: Upgrading from Woody to Sarge: Part 1
Posted by Anonymous (195.235.xx.xx) on Fri 20 May 2005 at 10:08
Yes, I'm connecting to the machine by a ssh session. The software I use is securecrt.

Is there any solution?

Thanks.
Newbie.

[ Parent ]

Re: Upgrading from Woody to Sarge: Part 1
Posted by Steve (82.41.xx.xx) on Fri 20 May 2005 at 10:09
[ View Weblogs ]

If you can do display forwarding then that would work.

Otherwise no, you'll have to do it on the machine whilst logged into X because it's a graphical application.

Steve
-- Steve.org.uk

[ Parent ]

Re: Upgrading from Woody to Sarge: Part 1
Posted by Anonymous (203.91.xx.xx) on Tue 25 Jul 2006 at 12:28
I think it could be a problem with framebuffer device as it is in my case, failing to open /dev/fb0. Try to check with strace command what all information you get.

[ Parent ]

Re: Upgrading from Woody to Sarge: Part 1
Posted by Anonymous (216.209.xx.xx) on Mon 13 Jun 2005 at 17:15
Here I was doing all the steps needed to try and run this as I want to upgade woody to sarge :) I don't run X on my servers. I guess I should have read down through all the comments to know for sure :) Regardless the information is still quite informative.

[ Parent ]

Re: Upgrading from Woody to Sarge: Part 1
Posted by lindenle (128.174.xx.xx) on Thu 28 Jul 2005 at 16:34
[ View Weblogs ]
I have been playing with this --get-selections option and it appears that this does not remove packages that weren't on the original machine. Here is an example, on the machine I am trying to mirror there is no apache on the machine I am mirroring to there is.I want to write a script that will install all the packages that are on machine one and remove the ones that are installed that aren't. Is this possible? Any ideas/comments?

[ Parent ]