David Heidt's Blog

linux and webserver stuff

Setting Up Ubuntu 12.04 (Precise Pangolin) as XEN Dom0

| Comments

Setting up a XEN Dom0 with a LTS release of Ubuntu Linux is easy again. Hooray!

First, install a standard Ubuntu Server System. Select no extras but ssh server.

If you’re going to setup your DomUs as decribed in my best-practice DomU setup on Ubuntu 12.04 (precise pangolin), please install with LVM and use 15G as root partition and about 5G as swap Space. The rest of the volume group is reserved for DomUs. Remember to mount /boot outside of the LVM, usually a 512M ext4 partition on the very beginning of the disk.

Install the XEN packages

# sudo aptitude install xen-hypervisor-amd64

modify grub configuration in /etc/default/grub

/etc/default/grub
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT="Xen 4.1-amd64"
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=3
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX="rootdelay=180"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_LINUX_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

# Disable OS prober to prevent virtual machines on logical volumes from appearing in the boot menu.
GRUB_DISABLE_OS_PROBER=true

# Xen boot parameters for all Xen boots
#GRUB_CMDLINE_XEN=""

# Xen boot parameters for non-recovery Xen boots (in addition to GRUB_CMDLINE_XEN)
GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=512M"

I set the memory to 512MB for the Dom0. If you don’t plan additional services and use this host as Dom0 only, this is largely enough.

update the bootloader:

# sudo update-grub

select default toolstack

/etc/default/xen
1
2
3
4
5
6
7
# Configuration for Xen system
# ----------------------------

# There exists several tool stacks to configure a Xen system.
# ?~@?
# Attention: You need to reboot after changing this!
TOOLSTACK="xm"

You could also use ‘xl’, I will use xm in this case.

change default behaviour of XEN DomU management:

By default, the system will save the memory of running domUs when shutting dowm or restarting the Dom0. This usually takes a very long time and also this can cause the system to hang. So we deactivate this in /etc/default/xendomains

/etc/default/xendomains
1
2
3
4
5
[...]
XENDOMAINS_SAVE=""
[...]
XENDOMAINS_RESTORE=false
[...]

reboot and run

# xm list 

this should give you an output like this:

1
2
Name                                        ID   Mem VCPUs   State   Time(s)
Domain-0                                     0   511     8     r-----       9.9

also, the xl info command gives you the right amount of memory you have on your system:

output on a 64G machine
1
2
3
# xl info | grep memory
total_memory           : 65523
free_memory            : 64169

and that’s it.

coming up next:

DomU setup (paravirtualized Linux Guests, HVM Windows Guests)

recipe based on:

Edited on 2012-04-09:

  • changed xl to xm
  • added config chapter for /etc/default/xendomains

Comments