KVM Guest Hangs at Booting from hard disk

Bug #946022 reported by Cerin
116
This bug affects 24 people
Affects Status Importance Assigned to Milestone
vm-builder (Ubuntu)
Confirmed
High
Unassigned

Bug Description

I tried to create an KVM Ubuntu 11.10 guest running on an Ubuntu 11.10 host by running:

    sudo vmbuilder kvm ubuntu --verbose --config new_vm.cfg

My new_vm.cfg:

    [DEFAULT]
    arch=amd64
    cpus=2
    mem=4096
    ip=192.168.1.10
    mask=255.255.255.0
    net=192.168.0.0
    bcast=192.168.1.255
    gw=192.168.1.1
    dns=192.168.1.1
    bridge=br0
    user=username
    name=realname
    pass=password
    part=/home/chris/vmbuilder.partition
    tmpfs=-
    firstboot=/tmp/firstboot.sh
    firstlogin=/tmp/firstlogin.sh
    hostname=new_vm

    [ubuntu]
    suite=oneiric
    flavour=server
    addpkg=openssh-server, apache2, apache2-mpm-prefork, apache2-utils, apache2.2-common, dbconfig-common, wwwconfig-common, postgresql-9.1, unattended-upgrades, acpid, ntp

    [kvm]
    libvirt=qemu:///system

My vmbuilder.partition:

    root 8000
    swap 4000
    ---
    /var 120000

My firstboot.sh:

    #!/bin/bash
    passwd -e username
    rm /etc/ssh/ssh_host*key*
    dpkg-reconfigure -fnoninteractive -pcritical openssh-server

My firstlogin.sh:

    #!/bin/bash
    sudo dpkg-reconfigure console-setup

The command seemed to complete without error, so then I ran:

    sudo virsh --connect qemu:///system start new_vm

At this point, KVM consumes 100% CPU, but the VM doesn't seem to boot. I used virt-manager to connect to the VM's console, and all it says is "Booting from hard disk" and it doesn't seem to proceed. I waited 30 minutes, but nothing changes.

I tried with flavour=virtual, but the result is the same.

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: python-vm-builder 0.12.4-0ubuntu0.2
ProcVersionSignature: Ubuntu 2.6.32-38.83-generic 2.6.32.52+drm33.21
Uname: Linux 2.6.32-38-generic x86_64
NonfreeKernelModules: wl nvidia
Architecture: amd64
Date: Sat Mar 3 21:01:25 2012
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release amd64 (20091027)
PackageArchitecture: all
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.utf8
 SHELL=/bin/bash
SourcePackage: vm-builder

Revision history for this message
Cerin (chrisspen) wrote :
Revision history for this message
Cerin (chrisspen) wrote :

I based by scripts on the instructions at https://help.ubuntu.com/community/JeOSVMBuilder.

Dave Walker (davewalker)
Changed in vm-builder (Ubuntu):
importance: Undecided → High
Revision history for this message
Yaron (sh-yaron) wrote :

I'm not so sure about this but when running Android X86 on KVM with virt-manager the VM got hanged although the meter shows that there is an activity, after two hours I realized it's not going to happen.

The only problem is... I never managed to run the LiveCD either so I'm not so sure about it.

I did manage to run TinyCore Plus as a VM both Live and installed, no hanging there...

Anything I can check?

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in vm-builder (Ubuntu):
status: New → Confirmed
Revision history for this message
Christoffer Holmstedt (christoffer-holmstedt) wrote :

I can add that this affects Ubuntu 12.04 host trying to install Ubuntu 12.04 guest aswell.

I'm experiencing the exact same thing every second or third installation, but the other guest installations works just fine. My solution to this is at the moment to destroy the VM and delete all related files on hard disk and then run the vmbuilder installation again. Sometimes it works sometimes it doesn't. If there is anything I can do to help to solve this one please let me know and I will supply the needed log files.

Revision history for this message
Mario (messex) wrote :

Just ran accross the same problem Ubuntu+KVM+Ubuntu...

Problem in my case was with apparmor, disabled it temporarily and it worked fine, hope it helps

Revision history for this message
Konstantin L. Metlov (metlov) wrote :

I have a similar problem trying to launch any Ubuntu 12.04 Precise guest (built with VMBuilder, downloaded from cloud-images.ubuntu.com or even the installation ISO images of different flavors) on 10.04 Lucid host. This is unaffected by different kernel options (lapic, acpi_pm etc) and, it seems, happens before the kernel starts. I have tried enabling debug in grub and the last lines I see about loading initrd, malloc and several reallocator.c traces, then hang.

When hanged, the kvm uses very little memory (about 30 mb) and spins, consuming 100% CPU.

What is strange that, at the same time, the host perfectly runs about 10 Lucid guests.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote : Re: [Bug 946022] Re: KVM Guest Hangs at Booting from hard disk

Konstantin,

please file a new bug against qemu-kvm with your issue. Yours is not
a vmbuilder bug. Please provide some examples (in the new bug) of full
kvm command lines you are using.

Revision history for this message
Konstantin L. Metlov (metlov) wrote :

I've just done this and submitted Bug #1047531 .

Thank you for your response !

Revision history for this message
Daniel Lloyd (spoonster) wrote :

I encountered this problem today, on 12.04.1, VMs built last week boot fine, machines built today fail at boot. I was able to work around this by dist-updating to the new kernel just released, leading me to believe there is some mis-match in the configuration performed if the VM guest has a newer version kernel than the host?

Revision history for this message
Martin Meredith (mez) wrote :

I've managed to hit this problem too. Fresh install of Precise, updated to latest everything as of today.

I then created a precise VM via vm-builder - and it would not get to grub.

Revision history for this message
Martin Meredith (mez) wrote :

However, upgrading from oneiric works ....

Revision history for this message
Will Bryant (willbryant) wrote :
Download full text (3.7 KiB)

I have this problem too - it's happening on roughly half my slice builds.

It seems to be due to the grub installation failing, here's what it shows for a build that won't boot:

 ** [out :: host-nwtn1.nwtn] 2013-03-17 10:52:33,044 DEBUG : ['chroot', '/tmp/tmpgvQfyy', 'grub', '--device-map=/tmp/vmbuilder-grub/device.map', '--batch']
 ** [out :: host-nwtn1.nwtn] 2013-03-17 10:52:33,044 DEBUG : stdin was set and it was a string: root (hd0,0)
 ** [out :: host-nwtn1.nwtn] setup (hd0)
 ** [out :: host-nwtn1.nwtn] EOT
 ** [out :: host-nwtn1.nwtn] 2013-03-17 10:52:33,197 DEBUG :
 ** [out :: host-nwtn1.nwtn] 2013-03-17 10:52:33,197 DEBUG : [ Minimal BASH-like line editing is supported. For
 ** [out :: host-nwtn1.nwtn] 2013-03-17 10:52:33,198 DEBUG : the first word, TAB lists possible command
 ** [out :: host-nwtn1.nwtn] 2013-03-17 10:52:33,198 DEBUG : completions. Anywhere else TAB lists the possible
 ** [out :: host-nwtn1.nwtn] 2013-03-17 10:52:33,198 DEBUG : completions of a device/filename. ]
 ** [out :: host-nwtn1.nwtn] 2013-03-17 10:52:33,198 DEBUG : grub> root (hd0,0)
 ** [out :: host-nwtn1.nwtn] 2013-03-17 10:52:33,198 DEBUG : grub> setup (hd0)
 ** [out :: host-nwtn1.nwtn] 2013-03-17 10:52:33,198 DEBUG : Checking if "/boot/grub/stage1" exists... no
 ** [out :: host-nwtn1.nwtn] 2013-03-17 10:52:33,199 DEBUG : Checking if "/grub/stage1" exists... no
 ** [out :: host-nwtn1.nwtn] 2013-03-17 10:52:33,199 DEBUG :
 ** [out :: host-nwtn1.nwtn] 2013-03-17 10:52:33,199 DEBUG : Error 15: File not found
 ** [out :: host-nwtn1.nwtn] 2013-03-17 10:52:33,199 DEBUG : grub> EOT

And here's what it shows for a build that does boot:

 ** [out :: host-nwtn1.nwtn] 2013-03-17 11:00:01,423 DEBUG : ['chroot', '/tmp/tmpnUU59C', 'grub', '--device-map=/tmp/vmbuilder-grub/device.map', '--batch']
 ** [out :: host-nwtn1.nwtn] 2013-03-17 11:00:01,424 DEBUG : stdin was set and it was a string: root (hd0,0)
 ** [out :: host-nwtn1.nwtn] setup (hd0)
 ** [out :: host-nwtn1.nwtn] EOT
 ** [out :: host-nwtn1.nwtn]
 ** [out :: host-nwtn1.nwtn] 2013-03-17 11:00:01,599 DEBUG :
 ** [out :: host-nwtn1.nwtn] 2013-03-17 11:00:01,599 DEBUG : [ Minimal BASH-like line editing is supported. For
 ** [out :: host-nwtn1.nwtn] 2013-03-17 11:00:01,599 DEBUG : the first word, TAB lists possible command
 ** [out :: host-nwtn1.nwtn] 2013-03-17 11:00:01,599 DEBUG : completions. Anywhere else TAB lists the possible
 ** [out :: host-nwtn1.nwtn] 2013-03-17 11:00:01,599 DEBUG : completions of a device/filename. ]
 ** [out :: host-nwtn1.nwtn] 2013-03-17 11:00:01,599 DEBUG : grub> root (hd0,0)
 ** [out :: host-nwtn1.nwtn] 2013-03-17 11:00:01,600 DEBUG : grub> setup (hd0)
 ** [out :: host-nwtn1.nwtn] 2013-03-17 11:00:01,600 DEBUG : Checking if "/boot/grub/stage1" exists... yes
 ** [out :: host-nwtn1.nwtn] 2013-03-17 11:00:01,600 DEBUG : Checking if "/boot/grub/stage2" exists... yes
 ** [out :: host-nwtn1.nwtn] 2013-03-17 11:00:01,600 DEBUG : Checking if "/boot/grub/e2fs_stage1_5" exists... yes
 ** [out :: host-nwtn1.nwtn] 2013-03-17 11:00:01,600 DEBUG : Runnin...

Read more...

Revision history for this message
Will Bryant (willbryant) wrote :
Revision history for this message
Will Bryant (willbryant) wrote :

Ah - this may be the same as bug #610652.

Revision history for this message
Carlos Zaccaro (zaccaro-86) wrote :

I dist-upgraded from 12.04.1 to 12.04.2 and now doesn't work the 100% of the tries.

Revision history for this message
AlberT (dralbert) wrote :

I confirm it on ubuntu 12.04 LTS + kvm +lvm +ubuntu precise ..

randomically hangs; virt-viewer shows the virtual BIOS waiting for boot disk

If someone has a warkaround until fixed please document it here, thank you

Revision history for this message
David Peall (dkpeall) wrote :

does anyone have a workaround for this? I really need to get this machine up.

Revision history for this message
Cerin (chrisspen) wrote :

@David, I worked around it by simply not using vm-builder. I ended up using the VM creation wizard in the virt-manager GUI, which worked surprisingly well, even if it's not a command line tool.

Revision history for this message
Povilas Daukintis (povilas+launchpad) wrote :

This is a grub-legacy issue, not the vmbuilder' itself. It seems that the problem is when grub tries to do setup step on ext4 fs with inode size > 128 (256 in particular). Interesting thing is that sometimes this step actually passes, so it might seem like a random failure. On recent vmbuilder / Ubuntu / Debian releases ext4 / 256bit inode size is used by default.

You have two possible workarounds:

a) tell vmbuilder to use ext3 fs by default (vmbuilder uses ext4 by default from Karmic release, you can change that in /usr/share/pyshared/VMBuilder/plugins/ubuntu/karmic.py, or possibly override this in other version' file)

b) create root fs as ext4, but with 128bit inode size. You can modify vmbuilder to pass '-I 128' for mkfs.ext4 command (in /usr/share/pyshared/VMBuilder/disk.py, mkfs_fstype() function)

Keep in mind that using 128bit size inodes on ext4 you might experience some issues when using advanced fs attributes: ACL's, SELinux labels, some Samba specific labels.

grub-legacy received patches to support ext3 fs with 256 bit size inodes, and later - variable size inode structs on ext4 fs, but it seems this does not work.

Of course, there is possibility to drop grub-legacy and try to use grub2 with vmbuilder, but this is completely different tale and I think will take much more time and effort to accomplish.

Revision history for this message
Peter Niederwieser (pniederw) wrote :

I'm fighting with similar symptoms:

- Ubuntu (Saucy) guests created with VMBuilder don't boot successfully; instead I get a grub prompt.
- qemu-system-x86 uses 100% CPU and 30MB RAM.
- Sometimes (but rarely) the problem magically disappears.

The host has an Intel CPU, so it doesn't seem to be the linked issue which is said to only occur for AMD CPUs. I've tried many changes related to disk configuration and boot loader, but nothing helped. Dropping back to ext3, by adding "preferred_filesystem = 'ext3'" to "saucy.py", doesn't seem to help either. (I haven't verified yet if this actually created an ext3 filesystem.) Does this sound like issue #946022? Will VMBuilder provide a fix or workaround?

Revision history for this message
Edmund Haselwanter (ehaselwanter) wrote :

confirm the bug. workaround with ext3 like in comment #20 works for me:

uname -a
Linux testlab-3 3.2.0-60-generic #91-Ubuntu SMP Wed Feb 19 03:54:44 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

root@testlab-3:~# grep filesystem /usr/share/pyshared/VMBuilder/plugins/ubuntu/karmic.py
    preferred_filesystem = 'ext3'

/usr/bin/vmbuilder kvm ubuntu -v --suite=precise --libvirt=qemu:///system --flavour=server --arch=amd64 --cpus=2 --mem=12288 --swapsize=2048 --rootsize=50480 --ip=10.0.0.222 --hostname=devstack --user=stack --name=stack --pass=stack --addpkg=git --addpkg=screen --addpkg=vim --addpkg=strace --addpkg=lsof --addpkg=nmap --addpkg=git --addpkg=acpid --addpkg=tcpdump --addpkg=python-pip --addpkg=wget --addpkg=htop --mirror=http://at.archive.ubuntu.com/ubuntu --components='main,universe' --addpkg=openssh-server --dns=8.8.8.8 --bridge br0

Revision history for this message
Navi (in-l) wrote :

workaround with ext3 does not works for me, but works this one

--- /usr/lib/python2.7/dist-packages/VMBuilder/disk.py 2015-10-30 00:35:09.000000000 +0000
+++ /tmp/disk.py 2016-10-06 16:29:41.581034967 +0000
@@ -110,7 +110,7 @@
         """

         logging.info('Adding partition table to disk image: %s' % self.filename)
- run_cmd('parted', '--script', self.filename, 'mklabel', 'msdos')
+ run_cmd('parted', '--script', self.filename, 'mklabel', 'gpt')

         # Partition the disk
         for part in self.partitions:

Revision history for this message
Jason Stephenson (jstephenson) wrote :

I'm seeing these symptoms with a Trusty (14.04) VM built on a Zesty (17.04) host today. Not sure, but it looks like the grub issue since there was some error from grub as the vm was being built.

None of the suggestions in the comments here worked for me.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Hi,
this was inactive too long, but vmbuilder was a long time unmaintained.
It was close top being removed, recently there was a new spark of life so I'd ask you to report this issue to [1] and mention the link here.
This is the new place considered the active project.
Once upstream accepted this can then be picked up without diverging.

[1]: https://github.com/newroco/vmbuilder/issues

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers