python-vm-builder-0.12.4+bzr462-0ubuntu1: swap partitions fail to be created properly when "lucid" is the target

Bug #726790 reported by Randy Barlow
70
This bug affects 15 people
Affects Status Importance Assigned to Milestone
vm-builder (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

I am using version 0.12.4+bzr462-0ubuntu1 in Ubuntu Natty. I've noticed that when I build a lucid virtual machine, it complains during boot.

During build, I see this in the build log:

2011-02-28 15:36:01,700 INFO : Adding type 3 partition to disk image: /tmp/tmpnFjJJ2
2011-02-28 15:36:01,707 INFO : [0] ../../libparted/filesys.c:148 (ped_file_system_type_get): File system alias linux-swap(new) is deprecated
2011-02-28 15:36:01,713 INFO : Creating loop devices corresponding to the created partitions
2011-02-28 15:36:01,721 INFO : Creating file systems
2011-02-28 15:36:01,833 INFO : mke2fs 1.41.14 (22-Dec-2010)
2011-02-28 15:36:14,592 INFO : mkswap: /dev/mapper/loop0p2: warning: don't erase bootbits sectors
2011-02-28 15:36:14,592 INFO : on whole disk. Use -f to force.

At the end of the build log, there is a traceback:

2011-02-28 15:39:44,643 INFO : Unmounting tmpfs from /tmp/tmp1TErm0tmpfs
2011-02-28 15:39:44,650 INFO : umount: /tmp/tmp1TErm0tmpfs: device is busy.
2011-02-28 15:39:44,650 INFO : (In some cases useful info about processes that use
2011-02-28 15:39:44,650 INFO : the device is found by lsof(8) or fuser(1))
Traceback (most recent call last):
  File "/usr/bin/vmbuilder", line 24, in <module>
    cli.main()
  File "/usr/lib/python2.7/dist-packages/VMBuilder/contrib/cli.py", line 239, in main
    util.clean_up_tmpfs(tmpfs_mount_point)
  File "/usr/lib/python2.7/dist-packages/VMBuilder/util.py", line 199, in clean_up_tmpfs
    run_cmd(*umount_cmd)
  File "/usr/lib/python2.7/dist-packages/VMBuilder/util.py", line 120, in run_cmd
    raise VMBuilderException, "Process (%s) returned %d. stdout: %s, stderr: %s" % (args.__repr__(), status, mystdout.buf, mystderr.buf)
VMBuilder.exception.VMBuilderException: Process (['umount', '-t', 'tmpfs', '/tmp/tmp1TErm0tmpfs']) returned 1. stdout: , stderr: umount: /tmp/tmp1TErm0tmpfs: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

None of this happens when I do not specify a swap partition. This also doesn't happen when I build a hardy machine (I've only tried hardy and lucid as targets)

Once you boot the machine, you will see this message:

The disk drive for /dev/sda2 is not ready yet or not present
Continue to wait; or Press S to skip mounting or M for manual recovery

Let me know if you need any further information!

Revision history for this message
Andres Rodriguez (andreserl) wrote :

Hi Randy,

Thank you for reporting bugs and trying to make Ubuntu Server better!

Could you please provide a Step by step to be able to reproduce this bug. Once we can reproduce this bug we'll investigate further and maybe ask for more information.

I'm marking this bug as incomplete until the information requested is provided.

Best regards,

Changed in vm-builder (Ubuntu):
status: New → Incomplete
importance: Undecided → Low
Revision history for this message
Randy Barlow (rbarlow) wrote :

I am attaching a build script that uses a partitions file to demonstrate the issue. When you run this script, the traceback that I listed doesn't occur (not sure why). However, the built machine does still complain about /dev/sda2, and you can verify that it does not have swap.

Revision history for this message
Randy Barlow (rbarlow) wrote :

This is the partitions file that I used.

Changed in vm-builder (Ubuntu):
status: Incomplete → New
Revision history for this message
Randy Barlow (rbarlow) wrote :

I moved the ticket status back to "New". I've actually been wondering, is it appropriate for me to alter the ticket state back to new after I provide the requested information, or would it have been better if I left it at "Incomplete"?

Revision history for this message
Serge Hallyn (serge-hallyn) wrote : Re: [Bug 726790] Re: python-vm-builder-0.12.4+bzr462-0ubuntu1: swap partitions fail to be created properly when "lucid" is the target

Quoting Randy Barlow (<email address hidden>):
> I moved the ticket status back to "New". I've actually been wondering,
> is it appropriate for me to alter the ticket state back to new after I
> provide the requested information, or would it have been better if I
> left it at "Incomplete"?

Thanks, yes please do update the state.

Chuck Short (zulcss)
Changed in vm-builder (Ubuntu):
status: New → Confirmed
Revision history for this message
Esben Haabendal (esben-haabendal) wrote :

I have the same problem using python-vm-builder 0.12.4+bzr469-0ubuntu1.

Only, I am not using a partitions file, but simply specify --optsize=10240

Revision history for this message
PhE (philippe-entzmann) wrote :

I have the same problem with vmbuilder 0.12.4.r466 (Ubuntu 11.10 amd64).

Here are the last lines of output for this command :

sudo vmbuilder kvm ubuntu --suite natty --flavour virtual --arch i386 -o --iso=/home/isos/ubuntu-11.04-server-i386.iso --mirror http://ftp.heanet.ie/pub/ubuntu --debug --libvirt qemu:///system --ip 192.168.0.100 --hostname myvm --user user --name user --pass default --addpkg unattended-upgrades --addpkg acpid

2011-11-02 08:12:36,012 DEBUG : Ign http://ftp.heanet.ie natty-updates/restricted Translation-en
2011-11-02 08:12:36,014 DEBUG : Ign http://ftp.heanet.ie natty-updates/universe Translation-en
2011-11-02 08:12:36,289 DEBUG : Reading package lists...
2011-11-02 08:12:36,291 DEBUG : ['chroot', '/tmp/tmpDvu332', 'apt-get', 'clean']
2011-11-02 08:12:36,313 DEBUG : ['umount', '/tmp/tmpDvu332/proc']
2011-11-02 08:12:36,317 DEBUG : ['umount', '/tmp/tmpDvu332/dev/pts']
2011-11-02 08:12:36,320 DEBUG : ['umount', '/tmp/tmpDvu332/dev']
2011-11-02 08:12:36,323 INFO : umount: /tmp/tmpDvu332/dev: device is busy.
2011-11-02 08:12:36,323 INFO : (In some cases useful info about processes that use
2011-11-02 08:12:36,323 INFO : the device is found by lsof(8) or fuser(1))
2011-11-02 08:12:36,323 INFO : Cleaning up
2011-11-02 08:12:36,324 DEBUG : ['umount', '/tmp/tmpZQTlF8']
2011-11-02 08:12:36,360 ERROR : Process (['umount', '/tmp/tmpDvu332/dev']) returned 1. stdout: , stderr: umount: /tmp/tmpDvu332/dev: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

Traceback (most recent call last):
  File "/usr/local/bin/vmbuilder", line 24, in <module>
    cli.main()
  File "/usr/local/lib/python2.7/dist-packages/VMBuilder/contrib/cli.py", line 216, in main
    distro.build_chroot()
  File "/usr/local/lib/python2.7/dist-packages/VMBuilder/distro.py", line 84, in build_chroot
    self.call_hooks('configure_os')
  File "/usr/local/lib/python2.7/dist-packages/VMBuilder/distro.py", line 67, in call_hooks
    call_hooks(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/VMBuilder/util.py", line 165, in call_hooks
    getattr(context, func, log_no_such_method)(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/VMBuilder/plugins/ubuntu/distro.py", line 155, in configure_os
    self.suite.unmount_dev()
  File "/usr/local/lib/python2.7/dist-packages/VMBuilder/plugins/ubuntu/dapper.py", line 118, in unmount_dev
    run_cmd('umount', '%s/dev' % self.context.chroot_dir)
  File "/usr/local/lib/python2.7/dist-packages/VMBuilder/util.py", line 120, in run_cmd
    raise VMBuilderException, "Process (%s) returned %d. stdout: %s, stderr: %s" % (args.__repr__(), status, mystdout.buf, mystderr.buf)
VMBuilder.exception.VMBuilderException: Process (['umount', '/tmp/tmpDvu332/dev']) returned 1. stdout: , stderr: umount: /tmp/tmpDvu332/dev: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

Revision history for this message
Taco (tcwitte) wrote :

Using version 0.12.4+bzr469-0ubuntu1 I also get the exception that the device is busy. When I insert a "run_cmd('sync')" just before the umount command it works OK and building finishes without the exception.

So, the /usr/lib/python2.7/dist-packages/VMBuilder/plugins/ubuntu/dapper.py file contains:

    def unmount_dev(self):
        self.context.cancel_cleanup(self.unmount_dev)
        run_cmd('sync') # added by me
        run_cmd('umount', '%s/dev' % self.context.chroot_dir)

Revision history for this message
Alex Karasulu (akarasulu) wrote :

I was having the same issue and after adding Taco's sync line in the dapper.py file everything worked smoothy. Thanks Taco!

Revision history for this message
Andy Balaam (mail-artificialworlds) wrote :

I was having the same problem, and Taco's fix worked for me too. Note I needed to edit the dapper.py file even though I was creating a lucid VM.

Revision history for this message
Rafał Krzewski (rafal-krzewski) wrote :

I was having the same problem, while building maverick image.
Taco's fix worked, thanks.

Revision history for this message
mattanja (mattanja) wrote :

I also had the problem building a lucid image but the added sync line did not help.

I added the -l option (lazy unmount) to both umount commands in plugins/ubuntu/dapper.py and util.py and it worked and the devices got unmounted.

util.py (starting in line 194):
def clean_up_tmpfs(mount_point):
    """Unmounts a tmpfs storage under `mount_point`."""
    umount_cmd = ["umount", "-l", "-t", "tmpfs", mount_point ]
    logging.info('Unmounting tmpfs from %s' % mount_point)
    logging.debug('Executing: %s' % umount_cmd)
    run_cmd(*umount_cmd)

plugins/ubuntu/dapper.py (line 116)
(I left the sync in there, guess it'd also work without the line)
    def unmount_dev(self):
        self.context.cancel_cleanup(self.unmount_dev)
 run_cmd('sync') # added by me
        run_cmd('umount', '-l', '%s/dev' % self.context.chroot_dir)

Revision history for this message
Stephane Neveu (stefneveu) wrote :

Hi all,

Same issue here, modifying dapper.py and util.py with '-l' as described above by mattanja works fine for me.

Revision history for this message
Louis Bouchard (louis) wrote :

This looks like a good candidate : https://bugs.launchpad.net/vmbuilder/+bug/966439

I tested the script and adding --removepkg=cron does fix this behavior

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.