Traceback when uninstalling docker-1.4.1

Bug #1413525 reported by Kick In
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snappy
Fix Released
High
Unassigned

Bug Description

After installing docker-1.4.1 (local package) on proposed 248:

ubuntu@localhost:~/apps/docker$ sudo snappy uninstall docker
Traceback (most recent call last):
  File "/usr/bin/snappy", line 25, in <module>
    status = Main().__main__()
  File "/usr/lib/python3/dist-packages/snappy/main.py", line 195, in __main__
    return callback(args)
  File "/usr/lib/python3/dist-packages/snappy/main.py", line 504, in _do_uninstall
    shutil.rmtree(data_dir)
  File "/usr/lib/python3.4/shutil.py", line 464, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib/python3.4/shutil.py", line 402, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  File "/usr/lib/python3.4/shutil.py", line 402, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  File "/usr/lib/python3.4/shutil.py", line 406, in _rmtree_safe_fd
    onerror(os.rmdir, fullname, sys.exc_info())
  File "/usr/lib/python3.4/shutil.py", line 404, in _rmtree_safe_fd
    os.rmdir(name, dir_fd=topfd)
OSError: [Errno 16] Device or resource busy: '213ac75ce152dd59f8c506e909d405a1fc7a53e48c51ee16a31291ac40baeffb'

docker is uninstalled (/apps/docker/**) is removed

Related branches

Revision history for this message
Michael Vogt (mvo) wrote :

Thanks, I can confirm a similar issue. It seems like snappy will need to wait until docker is fully stopped before it can continue with the removal of the files. It seems like "systemctrl is-active unit" does not cut it here :/ So we need to find another way to detect if docker is fully stopped (or any services).

Changed in snappy-ubuntu:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
James Hunt (jamesodhunt) wrote :

lp:~snappy-dev/click-systemd/snappy [1] is using 'systemctl -q is-active $unit' to determine if the unit has finished, which seems perfectly reasonable.

However, it appears that the return code of 'is-active' is always non-zero (3) if the main pid of the service is not running. That includes when the ExecStop= process *is still running*.

Workarounds:

(a) Continue to run 'is-active', but check the output (if the output is not "failed" or "inactive", the overall service is still running).

(b) Use 'show' since this looks to be more designed for parsing by programs (and thus hopefully more resilient to output format changes between systemd versions):

'systemctl show $unit|grep ^ActiveState=' and if the state is not "failed" or "inactive", again treat the service as still running.

(c) Query the state via the D-Bus API (which hopefully is even less likely to change than (b) :-)

___

[1] - http://bazaar.launchpad.net/~snappy-dev/click-systemd/snappy/view/head:/systemd-snappyhook#L42

Revision history for this message
James Hunt (jamesodhunt) wrote :

FWICS, the systemd D-Bus API doesn't expose any useful signals to know when a service is fully stopped. systemctl(1) does specify the following for the "show" command:

    This command is intended to be used whenever computer-parsable output is required.

So using that still seems a safer bet than our current approach. However, polling is really not ideal.

Kick In (kick-d)
Changed in snappy-ubuntu:
status: Confirmed → Fix Released
Michael Terry (mterry)
affects: snappy-ubuntu → snappy
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.