vmbuilder fails to work with grub2

Bug #329458 reported by Lionel Porcheron
This bug report is a duplicate of:  Bug #410886: VMBuilder doesn't work with grub2. Edit Remove
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Landscape Server
Confirmed
High
Unassigned
vm-builder (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

I'm trying to create new kvm virtual machines on a newly installed jaunty server, and it failed:
# vmbuilder kvm ubuntu --debug
2009-02-14 17:27:35,318 DEBUG add_part - begin 0, length 4096, end 4095
2009-02-14 17:27:35,319 DEBUG add_part - begin 4096, length 1024, end 5119
2009-02-14 17:27:35,319 DEBUG ip: dhcp
2009-02-14 17:27:35,331 DEBUG Temporary directory: /tmp/vmbuildervjh75w
2009-02-14 17:27:35,332 DEBUG Creating the root mount directory: /tmp/vmbuildervjh75w/target
2009-02-14 17:27:35,332 DEBUG Creating temporary root: /tmp/vmbuildervjh75w/root
2009-02-14 17:27:35,332 DEBUG Creating destination directory: ubuntu-kvm
2009-02-14 17:27:35,371 INFO Creating disk image: /tmp/vmbuildervjh75w/disk0.img
2009-02-14 17:27:35,372 DEBUG ['/usr/bin/kvm-img', 'create', '-f', 'raw', '/tmp/vmbuildervjh75w/disk0.img', '5120M']
2009-02-14 17:27:35,379 DEBUG Formatting '/tmp/vmbuildervjh75w/disk0.img', fmt=raw, size=5242880 kB
2009-02-14 17:27:35,380 INFO Adding partition table to disk image: /tmp/vmbuildervjh75w/disk0.img
2009-02-14 17:27:35,380 DEBUG ['parted', '--script', '/tmp/vmbuildervjh75w/disk0.img', 'mklabel', 'msdos']
2009-02-14 17:27:35,405 INFO Adding type 1 partition to disk image: /tmp/vmbuildervjh75w/disk0.img
2009-02-14 17:27:35,406 DEBUG ['parted', '--script', '--', '/tmp/vmbuildervjh75w/disk0.img', 'mkpart', 'primary', 'ext2', '0', '4095']
2009-02-14 17:27:35,417 INFO Adding type 3 partition to disk image: /tmp/vmbuildervjh75w/disk0.img
2009-02-14 17:27:35,417 DEBUG ['parted', '--script', '--', '/tmp/vmbuildervjh75w/disk0.img', 'mkpart', 'primary', 'linux-swap', '4096', '5119']
2009-02-14 17:27:35,429 INFO Creating loop devices corresponding to the created partitions
2009-02-14 17:27:35,430 DEBUG ['kpartx', '-av', '/tmp/vmbuildervjh75w/disk0.img']
2009-02-14 17:27:35,442 DEBUG add map loop2p1 (252:4): 0 7998048 linear /dev/loop2 32
2009-02-14 17:27:35,444 DEBUG add map loop2p2 (252:5): 0 2000000 linear /dev/loop2 7998080
2009-02-14 17:27:35,444 INFO Creating file systems
2009-02-14 17:27:35,445 DEBUG Oh, dear, an exception occurred
2009-02-14 17:27:35,445 INFO Cleaning up
2009-02-14 17:27:35,445 DEBUG ['kpartx', '-d', '/tmp/vmbuildervjh75w/disk0.img']
2009-02-14 17:27:35,455 DEBUG loop deleted : /dev/loop2
2009-02-14 17:27:35,456 DEBUG ['rmdir', 'ubuntu-kvm']
2009-02-14 17:27:35,462 DEBUG ['rm', '-rf', '/tmp/vmbuildervjh75w']
Traceback (most recent call last):
  File "/usr/bin/vmbuilder", line 29, in <module>
    VMBuilder.run()
  File "/usr/lib/python2.5/site-packages/VMBuilder/__init__.py", line 66, in run
    frontend.run()
  File "/usr/lib/python2.5/site-packages/VMBuilder/plugins/cli/__init__.py", line 67, in run
    vm.create()
  File "/usr/lib/python2.5/site-packages/VMBuilder/vm.py", line 452, in create
    disk.create_partitions(self)
  File "/usr/lib/python2.5/site-packages/VMBuilder/disk.py", line 384, in create_partitions
    disk.create(vm.workdir)
  File "/usr/lib/python2.5/site-packages/VMBuilder/disk.py", line 117, in create
    part.mkfs()
  File "/usr/lib/python2.5/site-packages/VMBuilder/disk.py", line 220, in mkfs
    raise Exception('We can\'t mkfs before we have a mapper device')
Exception: We can't mkfs before we have a mapper device

Revision history for this message
Jared (jared-thanhandjared) wrote :
Download full text (10.3 KiB)

This bug is also affecting me. (updated and upgraded intrepid)

It occurs for both --raw=/dev/sde and for disk image files. Below is from a disk image file:

root@LAB-GPS622-23:~# vmbuilder kvm ubuntu --suite=intrepid --arch 'amd64' --mem '128' --rootsize '1890' --swapsize '256' --kernel-flavour 'virtual' --hostname 'REMOVED' --mirror 'http://REMOVED:9999/ubuntu' --components 'main,restricted,universe' --addpkg 'vim' --addpkg 'openssh-server' --name 'REMOVED' --user 'REMOVED' --pass 'REMOVED' --libvirt qemu:///system

2009-02-19 12:06:12,619 INFO Creating disk image: /tmp/vmbuilderWj3iNW/disk0.img
2009-02-19 12:06:12,653 INFO Adding partition table to disk image: /tmp/vmbuilderWj3iNW/disk0.img
2009-02-19 12:06:12,729 INFO Adding type 1 partition to disk image: /tmp/vmbuilderWj3iNW/disk0.img
2009-02-19 12:06:12,733 INFO Adding type 3 partition to disk image: /tmp/vmbuilderWj3iNW/disk0.img
2009-02-19 12:06:12,738 INFO Creating loop devices corresponding to the created partitions
2009-02-19 12:06:12,752 INFO Creating file systems
2009-02-19 12:06:12,802 INFO mke2fs 1.41.3 (12-Oct-2008)
2009-02-19 12:06:12,973 INFO Mounting target filesystems
2009-02-19 12:06:13,038 INFO Installing guest operating system. This might take some time...
2009-02-19 12:06:51,782 INFO Can not write log, openpty() failed (/dev/pts not mounted?)
2009-02-19 12:06:51,782 INFO Moving old data out of the way
2009-02-19 12:06:51,885 INFO Can not write log, openpty() failed (/dev/pts not mounted?)
2009-02-19 12:06:52,173 INFO Searching for GRUB installation directory ... found: /boot/grub
2009-02-19 12:06:52,361 INFO Searching for default file ... Generating /boot/grub/default file and setting the default boot entry to 0
2009-02-19 12:06:52,363 INFO Searching for GRUB installation directory ... found: /boot/grub
2009-02-19 12:06:52,367 INFO Testing for an existing GRUB menu.lst file ...
2009-02-19 12:06:52,367 INFO
2009-02-19 12:06:52,368 INFO Could not find /boot/grub/menu.lst file.
2009-02-19 12:06:52,368 INFO Generating /boot/grub/menu.lst
2009-02-19 12:06:52,415 INFO Searching for splash image ... none found, skipping ...
2009-02-19 12:06:52,522 INFO grep: /boot/config*: No such file or directory
2009-02-19 12:06:52,576 INFO Updating /boot/grub/menu.lst ... done
2009-02-19 12:06:52,576 INFO
2009-02-19 12:06:52,732 INFO Searching for GRUB installation directory ... found: /boot/grub
2009-02-19 12:06:52,786 INFO Searching for default file ... found: /boot/grub/default
2009-02-19 12:06:52,790 INFO Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
2009-02-19 12:06:52,871 INFO Searching for splash image ... none found, skipping ...
2009-02-19 12:06:52,900 INFO grep: /boot/config*: No such file or directory
2009-02-19 12:06:52,987 INFO Updating /boot/grub/menu.lst ... done
2009-02-19 12:06:52,987 INFO
2009-02-19 12:06:53,013 INFO Searching for GRUB installation directory ... found: /boot/grub
2009-02-19 12:06:53,845 INFO Can not write log, openpty() failed (/dev/pts not mounted?)
2009-02-19 12:06:54,051 INFO Do...

Revision history for this message
Jared (jared-thanhandjared) wrote : Re: vmbuilder failes in Cleanup stage (jaunty and intrepid)

After more debugging and digging I have found the bug to because I am using grub2 on this host as grub1 doesnt play nice with the cutting edge dell machines in our lab, and our lab deployment software (another story).

What I have done is extract the grub binary from the deb package and modified /usr/lib/python2.5/site-packages/VMBuilder/plugins/ubuntu/distro.py to point to my manually extracted grub executable.

If I can get some time I will try and make the VMBuilder play nice with grub2, but it appears grub2 lacks any sort of --batch functionality.

Revision history for this message
internetter (internetter) wrote :

This happened to me, too. I was using lilo.

If this package depends on grub, it should probably be advertised somewhere.

Changed in vm-builder (Ubuntu):
status: New → Confirmed
Revision history for this message
Dominic Evans (oldmanuk) wrote :

confirmed as problem on karmic alpha 3 (which is now grub2 by default)

looking into a fix

summary: - vmbuilder failes in Cleanup stage (jaunty and intrepid)
+ vmbuilder fails to work with grub2
Changed in vm-builder (Ubuntu):
assignee: nobody → Dominic Evans (oldman)
Sidnei da Silva (sidnei)
Changed in landscape:
status: New → Confirmed
importance: Undecided → High
milestone: none → 1.4.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.