VM fails to build because mkfs.ext4 can't find the loopback file

Bug #1296162 reported by Mathy Vanvoorden on 2014-03-22
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
VMBuilder
Undecided
Unassigned

Bug Description

This is what happens at random when I try to create a VM, sometimes it works, sometimes it doesn't.

2014-03-21 23:37:25,245 INFO : Cleaning up
2014-03-21 23:37:28,259 ERROR : Process (['mkfs.ext4', '-F', '/dev/mapper/loop0p1']) returned 1. stdout: , stderr: mke2fs 1.42.7 (21-Jan-2013)
mkfs.ext4: No such file or directory while trying to determine filesystem size

Traceback (most recent call last):
  File "/usr/bin/vmbuilder-2.7", line 24, in <module>
    cli.main()
  File "/usr/lib64/python2.7/site-packages/VMBuilder/contrib/cli.py", line 228, in main
    hypervisor.install_os()
  File "/usr/lib64/python2.7/site-packages/VMBuilder/hypervisor.py", line 65, in install_os
    self.call_hooks('mount_partitions', self.chroot_dir)
  File "/usr/lib64/python2.7/site-packages/VMBuilder/distro.py", line 67, in call_hooks
    call_hooks(self, *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/VMBuilder/util.py", line 170, in call_hooks
    getattr(context, func)(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/VMBuilder/hypervisor.py", line 91, in mount_partitions
    disk.mkfs()
  File "/usr/lib64/python2.7/site-packages/VMBuilder/disk.py", line 151, in mkfs
    part.mkfs()
  File "/usr/lib64/python2.7/site-packages/VMBuilder/disk.py", line 306, in mkfs
    self.fs.mkfs()
  File "/usr/lib64/python2.7/site-packages/VMBuilder/disk.py", line 374, in mkfs
    run_cmd(*cmd)
  File "/usr/lib64/python2.7/site-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 (['mkfs.ext4', '-F', '/dev/mapper/loop0p1']) returned 1. stdout: , stderr: mke2fs 1.42.7 (21-Jan-2013)
mkfs.ext4: No such file or directory while trying to determine filesystem size

This is on a Gentoo system. I could see the device nodes being made correctly so my guess is that they sometimes are just not created fast enough by udev before the script proceeds.

I fixed this (I think, works so far) by adding this in disk.py at the end of the map_partitions function:

        # Give udev a chance to create nodes
        run_cmd('udevadm', 'settle')

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

Other bug subscribers