Installing Windows XP As A KVM Guest On Ubuntu 8.10 Desktop

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Thu, 2009-02-12 18:52. :: KVM | Ubuntu | Desktop | Virtualization

Installing Windows XP As A KVM Guest On Ubuntu 8.10 Desktop

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 02/06/2009

There's a bug in virt-install and virt-manager on Ubuntu 8.10 that does not let you run Windows XP as a guest under KVM. During the Windows installation, the guest needs to be rebooted, and then you get the following error, and Windows XP refuses to boot: "A disk read error occured. Press Ctrl+Alt+Del to restart". This guide shows how you can solve the problem and install Windows XP as a KVM guest on Ubuntu 8.10.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

The procedure described here works only if you have virt-manager installed on the KVM host, not on a remote system. virt-manager doesn't support remote installations yet. This means you cannot use this procedure on a headless Ubuntu 8.10 KVM host.

The resulting Windows XP guest will use an image file for storage - with this procedure you cannot use hard drive partitions/LVM partitions for the storage of the guest.

I'm using the username administrator here - replace it with your own username.

I'm assuming that KVM is already installed (e.g. as shown here: Virtualization With KVM On Ubuntu 8.10).

 

2 Installing Virt-Manager/Virt-Viewer

Open a terminal and install virt-manager and virt-viewer:

sudo apt-get install virt-manager virt-viewer

 

3 Creating An ISO From The Windows XP CD

Insert the Windows XP CD into your CD drive. Then run the following command to create an ISO file (/home/winxp.iso) from it:

sudo dd if=/dev/cdrom of=/home/winxp.iso

 

4 Creating A Storage Image File For The Guest

Next we create an image file that will be used to store the guest. I will name the guest vm8, so the image file I create is /home/administrator/vm8.img, and it will be 12GB of size:

dd if=/dev/zero of=/home/administrator/vm8.img bs=1024k count=12000

 

5 Running KVM To Create The Guest

What we do next is we run the kvm command (instead of virt-manager) to create the Windows XP guest and abort the installation right after the Windows installer has formatted the hard drive. Afterwards, we can use virt-manager to complete the installation.

kvm -m 512 -cdrom /home/winxp.iso -boot d /home/administrator/vm8.img

A QEMU window will pop up with the Windows XP installer:

Select the hard drive to be used for the installation (that's the image file we've just created):

Then select Format the partition using the NTFS file system:

The partition is now being formatted. Right after the formatting has finished, close the QEMU window to stop the installation:


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 Fri, 2009-11-06 04:30.

Contrary to the note in section 1, you CAN run virt-manager on a headless server.

On my Mac, I ran "xhost +my.server.ip".  Then "ssh -X my.server.ip".  Once there, "sudo apt-get install virt-manager".  This will install a bunch of stuff, including GTK libs and some supporting X apps, but it DOESNT actually require X, a Window Manager, or all the other X bloat you don't need if you aren't using the local monitor. 

Then make sure the DISPLAY variable is set: "echo $DISPLAY".  If not, set it: "export DISPLAY='my.mac.ip:0' ".  Then by just typing "sudo virt-manager" on the server (via the ssh session), virt-manager will RUN on the headless server, but DISPLAY on your Mac.

 This assumes you have X11 installed on the Mac.  If not, install it from the Leopard DVD.

 This should also work equally well on a PC, just use something like Putty and XMing to provide the SSH connection and an X Window (display) server on your PC.

Hope that tip helps someone out--managing KVM via command line was driving me nuts! 

Submitted by blackops (registered user) on Fri, 2009-02-13 18:30.
Is there a specific reason why you close the QEMU window after the formatting is complete?