device-mapper: remove ioctl failed: Device or resource busy

Bug #335472 reported by Loïc Minier
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
vm-builder (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Hi,

While building a VM today with "ubuntu-vm-builder kvm jaunty":
...
2009-02-27 14:54:26,202 INFO Can not write log, openpty() failed (/dev/pts not mounted?)
2009-02-27 14:54:26,282 INFO Can not write log, openpty() failed (/dev/pts not mounted?)
2009-02-27 14:54:26,324 INFO Can not write log, openpty() failed (/dev/pts not mounted?)
2009-02-27 14:54:27,136 INFO Can not write log, openpty() failed (/dev/pts not mounted?)
2009-02-27 14:54:30,271 INFO Copying to disk images
2009-02-27 14:54:49,060 INFO Installing bootloader
2009-02-27 14:54:55,501 INFO Unmounting target filesystem
2009-02-27 14:54:55,833 INFO device-mapper: remove ioctl failed: Device or resource busy
2009-02-27 14:54:55,834 INFO ioctl: LOOP_CLR_FD: Device or resource busy
2009-02-27 14:54:55,835 INFO Cleaning up
Traceback (most recent call last):
  File "/usr/bin/ubuntu-vm-builder", 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 469, in create
    raise e
VMBuilder.exception.VMBuilderException: Process (['kpartx', '-d', '/tmp/vmbuildervru1bq/disk0.img']) returned 1. stdout: , stderr: device-mapper: remove ioctl failed: Device or resource busy
ioctl: LOOP_CLR_FD: Device or resource busy

sudo losetup -a shows:
/dev/loop0: [fc00]:5914861 (/tmp/vmbuildervru1bq/disk0.img)

sudo kpartx -l /dev/loop0:
loop0p1 : 0 7998048 /dev/loop0 32
loop0p2 : 0 2000000 /dev/loop0 7998080

however I only have a /dev/mapper/loop0p1 (no /dev/mapper/loop0p2); I suspect something prevented the removal of all mapped devices as it stopped in the middle; perhaps it was still busy writing (my PC was under another IO load when creating the vm)? Perhaps you need to sync after umount for instance.

/tmp/vmbuildervru1bq/disk0.img was gone at this point, "sudo kpartx -d /dev/loop0" dropped the remaining mapper device and "sudo losetup -d /dev/loop0" the loopback mapping.

Bye

Revision history for this message
Todd Deshane (deshantm) wrote :

I am seeing this too.

I'll post the debug/verbose tail of the log as soon as it comes out.

Changed in vm-builder (Ubuntu):
status: New → Confirmed
Revision history for this message
Todd Deshane (deshantm) wrote :

"ubuntu-vm-builder kvm jaunty" does not re-produce this.

I am getting it with a more complicated command however:
vmbuilder kvm ubuntu --libvirt=qemu:///system --addpkg ubuntu-desktop --addpkg openssh-server --hostname ubuntu-desktop --user username --ssh-user-key=ssh_key

I'll try to reproduce and narrow down the option that is causing the problem.

Changed in vm-builder (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Todd Deshane (deshantm) wrote :

tail of debug verbose output attached

Revision history for this message
Todd Deshane (deshantm) wrote :

More testing another tweak to the patch provided in bug #352114

This line doesn't work (gives the errors from above)
vmbuilder kvm ubuntu --libvirt=qemu:///system --addpkg ubuntu-desktop --addpkg openssh-server --hostname ubuntu-desktop --user username --ssh-user-key=ssh_key

But this line (without --addpkg ubuntu-desktop, but still with --addpkg openssh-server) does work.
vmbuilder kvm ubuntu --libvirt=qemu:///system --addpkg openssh-server --hostname ubuntu-desktop --user username --ssh-user-key=ssh_key

I will see if I can trigger it/not trigger it in any other cases.

It would be great if someone could test with the last suggested in comment #4 in bug #352114

Revision history for this message
Todd Deshane (deshantm) wrote :

On a crash, the loopback device also stays mounted and it can't be umounted (not any way that I can find at least)

For example:
sudo losetup -a
/dev/loop0: [0807]:2613376 (/tmp/vmbuilder_NclQw/disk0.img)

Revision history for this message
Todd Deshane (deshantm) wrote :

Looks like this is not a bug.

Needed to add a --rootsize=<number of MB> to the command line.

It completes now without error, must be the ubuntu-desktop was bigger than the default 4G disk

Revision history for this message
Chuck Short (zulcss) wrote :

Closing as per user.

Changed in vm-builder (Ubuntu):
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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