Playing with KVM Part 2
- February 8th, 2010
- Posted in Ubuntu
- By shermann
- Write comment
Let’s think about this creating command:
vmbuilder kvm -c karmic.cfg \ --domain ubuntu-server.eu \ --dest /vmachines/kvm/ \ --bridge br0 \ --hostname testvm02 \ --user shermann \ --pass foobar \ --mem=256 \ --ip=<whatevr ip> \ --mask=255.255.255.0 \ --dns=<your dns server >\ --gw=<your default gw> \ --libvirt qemu:///system \ --tmpfs=-
The correspondent karmic.cfg looks like this:
[DEFAULT] arch = i386 part = ubuntu-karmic.part user = shermann
[ubuntu] mirror = <your package mirror> suite = karmic flavour = server addpkg = openssh-server, vim-nox
[kvm] libvirt = qemu:///system
and the partition file looks like this:
root 5000 /boot 100 swap 1000 --- /var/log 2000 /home 1900
Now, when creating the VM everything works fine. But after creation and starting of the VM via virsh, the machine doesn’t boot up.
Could be that this is all my fault ;) Or I’m too ESX…or I’m hitting a bug…


I thought it was a recent launchpad bug, but cannot find it – maybe someone’s blog post elsewhere?
Perhaps a bug because /boot is on a separate partition?
Alastair
Hi Stephan,
It might have something to do with Grub. I recently set up several KVM VMs with their storage not in a file, but in an LVM logical volume. After that Grub didn’t boot the system so I mounted a rescue CD (www.sysresccd.org) and ran:
grub
grub> device (hd0) /dev/vda
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
Note that I use /dev/vda instead of /dev/hda because I’m using the virtio driver
My vm.cfg looks like this:
[DEFAULT]
# part = vmbuilder.partition # Don’t use when using an LV as target, use the –rootsize and –swapsize options on the command line. Bug?!
user = lennart
name = “L.C. Karssen”
pass = lennart
tmpfs = -
overwrite = true
firstboot = boot.sh
#firstlogin = firstlogin.sh
copy = files_to_copy
arch = amd64
mem = 256
cpus = 1
templates = mytemplates
[ubuntu]
mirror = http://nl.archive.ubuntu.com/ubuntu
suite = karmic
flavour = virtual
addpkg = emacs-snapshot-nox, elscreen, unattended-upgrades, acpid,
nagios-nrpe-server, nfs-common, bash-completion, links2, htop, iftop,
iotop, snmpd, etckeeper, byobu, rsync, mlocate, bacula-client,
ldap-auth-client, ntp, manpages, man-db, logrotate
#timezone=”Europe/Amsterdam” # Doesn’t work. Not even from the command line
[kvm]
libvirt = qemu:///system
hostname = test
domain = example.org
#ip = 192.168.10.31
#gw = 192.168.10.9
#dns = 192.168.10.10
bridge = br0
The VM is then created using the following command:
vmbuilder kvm ubuntu -c vm.cfg –raw=/dev/$VG_NAME/$VM_NAME –rootsize=$ROOT_SIZE –swapsize=
$SWAP_SIZE
Hope this helps (a bit)
Maybe :
karmic vmbuilder with separate boot partition doesn’t boot
https://launchpad.net/bugs/518742
Yes, I filed it this morning ;)