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.
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | 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 | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | 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 | Reply to this comment ]
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 | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
Looks good to me - what precisely doesn't work?
Steve
-- Steve.org.uk
[ Parent | Reply to this comment ]
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 | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | 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 | Reply to this comment ]
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 | Reply to this comment ]
When I starting qemu, it display
"Could not open SDL display"
How I'm doing wrong.
Thanks in advanced.
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | 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 | Reply to this comment ]
Is there any solution?
Thanks.
Newbie.
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | 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 | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]