linux instead

Installing a XEN hvm DOMU

by Kev on Jun.14, 2009, under Linux, Xen virtualisation

For this to work your CPU and motherboard needs to support vt (intel) or amd-v. You can check this by looking at the flags in /proc/cpuinfo. Your looking for either vmx or svm on the flags line.

If you’re doing this from your DOM0 then these flags may not actually show up. Instead type xm info and look for ‘hvm’ on the virt_caps line.

For my hvm install, i’ll be installing Ubuntu 9.04 Desktop Linux.
I have copied the live CD ISO onto my XEN DOM0 and will be installing directly from the iso rather than burning the CD. I have also created a 10GB LVM logical volume to act as the disk for my new DOMU.

The following config file is used to boot the live cd (iso image). It lives in /etc/xen and as this is to become a myth frontend i’ve rather imaginatively called it mythfronted!
/etc/xen/mythfrontend:

kernel = "/usr/lib/xen/boot/hvmloader"
builder='hvm'
memory = 512
name = "mythfrontend"
vif = [ 'type=ioemu, bridge=eth0' ]
disk = ['file:/xenimages/ISO/ubuntu-9.04-desktop-i386.iso,hda:cdrom,r', 'phy:/dev/mapper/datavg-mythfrontendlv,sda,w', ]
boot="d"

sdl=0
vnc=1
vnclisten="0.0.0.0"
vncpasswd='password'
stdvga=0
serial='pty'
usbdevice='tablet'

I find that setting usbdevice to tablet rather than mouse gives better results with a mouse than setting it to mouse.

Once you have your config file created and matching your system (i.e. pointing to the cd or iso, and file of lvm for hard disk) then we’re good to boot it:
xm create mythfrontend

If all went well then we should see it running in xm list

Now we need to connect to it’s display with vnc.
If this is the first DOMU to use vmc as a framebuffer then you should be able to run vnc to get access to the display. In the config above I have defined a password to be entered.

If you need to specify the port, then typing netstat -tap should let you see which port (probably 5900 ish).

Once you have connected to via VNC you will then be able to run the installer as usual. This should work for installing Windows as well as Linux.

Screenshot of vnc window

After the install has completed, shutdown the new DOMU, because we need to edit the config file to remove the cd iso image and allow it to boot from it’s hard disk.

This basically means removing the cd-rom/iso section in the disk= parameter, change the device name for the hard disk from sda to xvda and removing boot=”d” completely. This should leave our config looking something like this:

kernel = "/usr/lib/xen/boot/hvmloader"
builder='hvm'
memory = 512
name = "mythfrontend"
vif = [ 'type=ioemu, bridge=eth0' ]
disk = [ 'phy:/dev/mapper/datavg-mythfrontendlv,xvda,w', ]

sdl=0
vnc=1
vnclisten="0.0.0.0"
vncpasswd='password'
stdvga=0
serial='pty'
usbdevice='tablet'

Now just start the DOMU with xm create mythfrontend
And that’s it!

:, ,

2 Comments for this entry

  • Todd

    I just recently created a Ubuntu 9.04 desktop domU as well. Thanks for the info, setting the usbdevice to ‘tablet’ solved half of my problem. The other problem is that Ubuntu doesn’t want to let me set the domU display resolution larger than 800×600. Even 1024×768 would be acceptable, but 800×600 is too small for what I need. Any suggestions?

  • Wojtek

    Nice info, thanks a lot, really helped me ;-)

    My question is if you are able to access (mount?) the ubuntu-guest\’s filesystem from the host (e.g. when your guest is down)? What ubuntu installer did with the \"entire disk\"? created a single whole-disk partition? I would appreciate your answer.

Leave a Reply

Security Code:

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...