VirtualBox 3.1 – Install Windows XP Guest on Ubuntu 9.04 Host

VirtualBox 3.1 significantly changed the way that harddisks, dvd/cd drives and floppies are mounted. The following steps are to install Windows XP as a guest on an Ubuntu 9.04 host with a IntelAhci SATA controller.

Make sure you download the Windows XP Intel SATA Drivers and unzip to extract “F32.IMA”.

sudo -i

To begin the install process, do the following steps:

  • Create a new VirtualMachine.
  • Add three controllers (sata, ide, floppy).
  • Attach the Intel SATA floppy and the Windows XP dvd iso.
  • Set the memory, boot order and bridged network connection.
VBoxManage createhd --filename /srv/virtualbox/harddisks/CHANGEME.vdi --size 20480 \
    --variant Standard
VBoxManage createvm --name CHANGEME --ostype "WindowsXP" --register \
    --basefolder /srv/virtualbox/machines
VBoxManage storagectl CHANGEME --name "SATA Controller" --add sata \
    --controller IntelAhci
VBoxManage storageattach CHANGEME --storagectl "SATA Controller" \
    --port 0 --device 0 --type hdd \
    --medium /srv/virtualbox/harddisks/CHANGEME.vdi
VBoxManage storagectl CHANGEME --name "IDE Controller" --add ide
VBoxManage storagectl CHANGEME --name "Floppy Controller" --add floppy
VBoxManage storageattach CHANGEME --storagectl "IDE Controller" \
    --port 0 --device 0 --type dvddrive \
    --medium "/srv/virtualbox/isos/WindowsXP_sp3.iso"
VBoxManage storageattach CHANGEME --storagectl "Floppy Controller" \
    --port 0 --device 0 --type fdd --medium /srv/virtualbox/floppy/F32.IMA
VBoxManage modifyvm CHANGEME --memory 1024 --nic1 bridged --bridgeadapter1 eth0 \
    --boot1 dvd --boot2 disk --boot3 none --boot4 none

Start the VM using a specified port (8888) for VRDP. You will then be able to attach via RDP to the Host IP on the specified port.

VBoxHeadless --startvm CHANGEME --vrdpport 8888 --vrdp on &

When the Windows XP installation begins, Hit F6 during setup and select the Intel(R) 82801HEM/HBM SATA AHCI Controller (Mobile ICH8M-E/M) driver. Proceed with the Windows XP install until reboot is required.

At some point, post install, you may optionally take the following steps:

  • Eject the Windows XP dvd iso.
  • Attach (and then install) the VirtualBox Guest Additions dvd iso.
  • Eject the Intel SATA floppy. Note: it can only be ejected while the machine is powered off; it should be ejected because it will otherwise be locked, such that other VM’s cannot use it.
  • Change the boot order.
VBoxManage storageattach CHANGEME --storagectl "IDE Controller" \
    --port 0 --device 0 --medium none
VBoxManage storageattach CHANGEME --storagectl "IDE Controller" \
    --port 0 --device 0 --type dvddrive \
    --medium /usr/share/virtualbox/VBoxGuestAdditions.iso 
VBoxManage storageattach CHANGEME --storagectl "FLOPPY Controller" \
    --port 0 --device 0 --type fdd --medium none
VBoxManage modifyvm CHANGEME --boot1 disk --boot2 none

Don’t forget to run windows updates!

8 Comments

  1. Thanks a lot for this – it's a perfect collection of commands needed for headless installation – saved me hours of searching!

  2. I am having this error…Error: failed to start machine. Error message: Unknown error creating VM (VERR_PDM_TOO_MANY_DEVICE_INSTANCES). Any idea whats causing this? Thank you!

  3. Very nice post!

    I have been setup my server with VirtualBox and your post help me a lot!

    The VirtualBox manual is very nice documentation, but it has not example of setup a simple VM with HD and boot from ISO file using VBoxManage command line.

    I will post a similar tutorial like it in portuguese on my blog iowrite.com.

    Thank you!

    Marcelo

Comments are closed.