OSError: [Errno 16] Device or resource busy: 'home'

Bug #1531934 reported by Christian Dywan on 2016-01-07
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
click (Ubuntu)
Critical
Unassigned

Bug Description

On a fresh Xenial install, with encrypted home (ecryptfs) creation of click chroots always fails:

$ sudo click chroot -aamd64 -fubuntu-sdk-15.10 create
[...]
E: 10mount: umount: /var/lib/schroot/mount/click-ubuntu-sdk-15.10-amd64-296e9eec-3d02-48a1-98e9-939c77d11892/home/cris: target is busy
E: 10mount: (In some cases useful info about processes that
E: 10mount: use the device is found by lsof(8) or fuser(1).)
E: click-ubuntu-sdk-15.10-amd64-296e9eec-3d02-48a1-98e9-939c77d11892: Chroot setup failed: stage=setup-stop
Command returned 1: schroot -u root -c source:click-ubuntu-sdk-15.10-amd64 -- /finish.sh
umount: /var/lib/schroot/mount/click-ubuntu-sdk-15.10-amd64-296e9eec-3d02-48a1-98e9-939c77d11892/home/cris: target is busy
        (In some cases useful info about processes that
         use the device is found by lsof(8) or fuser(1).)
umount: /var/lib/schroot/mount/click-ubuntu-sdk-15.10-amd64-296e9eec-3d02-48a1-98e9-939c77d11892/home: target is busy
        (In some cases useful info about processes that
         use the device is found by lsof(8) or fuser(1).)
umount: /var/lib/schroot/mount/click-ubuntu-sdk-15.10-amd64-296e9eec-3d02-48a1-98e9-939c77d11892: target 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/bin/click", line 110, in <module>
    sys.exit(main())
  File "/usr/bin/click", line 106, in main
    return mod.run(args)
  File "/usr/lib/python3/dist-packages/click/commands/chroot.py", line 266, in run
    return args.func(parser, args)
  File "/usr/lib/python3/dist-packages/click/commands/chroot.py", line 68, in create
    return chroot.create(args.keep_broken_chroot)
  File "/usr/lib/python3/dist-packages/click/chroot.py", line 596, in create
    self.destroy()
  File "/usr/lib/python3/dist-packages/click/chroot.py", line 694, in destroy
    shutil.rmtree(chroot_dir)
  File "/usr/lib/python3.5/shutil.py", line 474, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib/python3.5/shutil.py", line 416, in _rmtree_safe_fd
    onerror(os.rmdir, fullname, sys.exc_info())
  File "/usr/lib/python3.5/shutil.py", line 414, in _rmtree_safe_fd
    os.rmdir(name, dir_fd=topfd)
OSError: [Errno 16] Device or resource busy: 'home'

This leaves me in an inconsistent state where a subsequent exists will claim the chroot doesn't exist, but both create and destroy fail:

$ sudo click chroot -aamd64 -fubuntu-sdk-15.10 create
FileExistsError: [Errno 17] File exists: '/var/lib/schroot/chroots/click-ubuntu-sdk-15.04-amd64'

$ sudo click chroot -aamd64 -fubuntu-sdk-15.04 destroy
umount: /var/lib/schroot/mount/click-ubuntu-sdk-15.04-amd64-137f095e-b0eb-4b4b-b4b0-a45d6de4ed53/home/cris: target is busy
        (In some cases useful info about processes that
         use the device is found by lsof(8) or fuser(1).)
umount: /var/lib/schroot/mount/click-ubuntu-sdk-15.04-amd64-137f095e-b0eb-4b4b-b4b0-a45d6de4ed53/home: target is busy
        (In some cases useful info about processes that
         use the device is found by lsof(8) or fuser(1).)
umount: /var/lib/schroot/mount/click-ubuntu-sdk-15.04-amd64-137f095e-b0eb-4b4b-b4b0-a45d6de4ed53: target 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/bin/click", line 110, in <module>
    sys.exit(main())
  File "/usr/bin/click", line 106, in main
    return mod.run(args)
  File "/usr/lib/python3/dist-packages/click/commands/chroot.py", line 266, in run
    return args.func(parser, args)
  File "/usr/lib/python3/dist-packages/click/commands/chroot.py", line 91, in destroy
    return chroot.destroy()
  File "/usr/lib/python3/dist-packages/click/chroot.py", line 694, in destroy
    shutil.rmtree(chroot_dir)
  File "/usr/lib/python3.5/shutil.py", line 474, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib/python3.5/shutil.py", line 416, in _rmtree_safe_fd
    onerror(os.rmdir, fullname, sys.exc_info())
  File "/usr/lib/python3.5/shutil.py", line 414, in _rmtree_safe_fd
    os.rmdir(name, dir_fd=topfd)
OSError: [Errno 16] Device or resource busy: 'home'

It's not the same as bug 1427264 and the work-around doesn't affect it.

description: updated
Christian Dywan (kalikiana) wrote :

Work-around:

In the file /usr/lib/python3/dist-packages/click/chroot.py

Change the last line of the maint() method to always return 0:

def maint(self, *args):
...
    return 0 # ret

With this in place you'll see the errors but can successfully use click chroots.

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

Other bug subscribers