andsens / bootstrap-vz

Bootstrap Debian images for virtualized environments
http://bootstrap-vz.readthedocs.io/
Other
263 stars 145 forks source link

umount - target is busy #499

Open kevin-olbrich opened 5 years ago

kevin-olbrich commented 5 years ago

Hi!

Sometimes I get "target is busy" during the last unmount (when everything else was successfully).

Clearing the MOTD
Re-enabling daemon autostart after installation
Removing mtab
Unmounting the bootstrap volume
Executing: umount /target/b43af7cb/root/var/log
Executing: umount /target/b43af7cb/root/dev/pts
Executing: umount /target/b43af7cb/root/boot
Executing: umount /target/b43af7cb/root/proc
Executing: umount /target/b43af7cb/root/dev
umount: /target/b43af7cb/root/dev: target is busy.
Command 'umount /target/b43af7cb/root/dev' returned non-zero exit status 32
Traceback (most recent call last):
  File "/var/lib/jenkins/workspace/vm_image_build/project/imageconf/bootstrap-vz/bootstrapvz/base/main.py", line 111, in run
    tasklist.run(info=bootstrap_info, dry_run=dry_run)
  File "/var/lib/jenkins/workspace/vm_image_build/project/imageconf/bootstrap-vz/bootstrapvz/base/tasklist.py", line 44, in run
    task.run(info)
  File "/var/lib/jenkins/workspace/vm_image_build/project/imageconf/bootstrap-vz/bootstrapvz/common/tasks/filesystem.py", line 189, in run
    info.volume.partition_map.root.unmount()
  File "/var/lib/jenkins/workspace/vm_image_build/project/imageconf/bootstrap-vz/bootstrapvz/common/fsm_proxy.py", line 39, in proxy
    fn(**kwargs)
  File "/usr/lib/python2.7/dist-packages/fysom/__init__.py", line 294, in fn
    if self._before_event(e) is False:
  File "/usr/lib/python2.7/dist-packages/fysom/__init__.py", line 329, in _before_event
    return getattr(self, fnname)(e)
  File "/usr/lib/python2.7/dist-packages/fysom/__init__.py", line 95, in _callback
    return func(obj, *args, **kwargs)
  File "/var/lib/jenkins/workspace/vm_image_build/project/imageconf/bootstrap-vz/bootstrapvz/base/fs/partitions/abstract.py", line 107, in _before_unmount
    self.mounts[destination].unmount()
  File "/var/lib/jenkins/workspace/vm_image_build/project/imageconf/bootstrap-vz/bootstrapvz/base/fs/partitions/mount.py", line 39, in unmount
    log_check_call(['umount', self.mount_dir])
  File "/var/lib/jenkins/workspace/vm_image_build/project/imageconf/bootstrap-vz/bootstrapvz/common/tools.py", line 14, in log_check_call
    raise e
CalledProcessError: Command 'umount /target/b43af7cb/root/dev' returned non-zero exit status 32
Rolling back

Tracing back, I can kill "gpg-agent" in "/target/b43af7cb/root/dev" but umount "/target/b43af7cb/root" still fails with no reason:

root@buildsrv01:~# lsof /target/b43af7cb/root
root@buildsrv01:~# fuser -amuv /target/b43af7cb/root
                     USER        PID ACCESS COMMAND
/target/b43af7cb/root:
                     root     kernel mount (root)/target/b43af7cb/root
root@buildsrv01:~# umount /target/b43af7cb/root
umount: /target/b43af7cb/root: target is busy.

As Systemd avoids running services inside chroot, it should be safe enough to lazy unmount after a sync. (?)

Kind regards Kevin