Bug 39273 - docker.io package fails to upgrade if docker is running
docker.io package fails to upgrade if docker is running
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Docker
UCS 4.0
Other Linux
: P5 normal (vote)
: UCS 4.1
Assigned To: Daniel Tröder
Arvid Requate
: interim-2
Depends on: 38549
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-27 11:58 CEST by Daniel Tröder
Modified: 2015-11-17 12:12 CET (History)
4 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2015-08-27 11:58:50 CEST
+++ This bug was initially created as a clone of Bug #38549 +++

docker.io version 1.6.2~dfsg1 (in the docker scope) wants to not restart the service in case of an upgrade, so they added to debian/rules "dh_installinit --no-restart-on-upgrade":

override_dh_installinit:
        dh_installinit --name=docker --no-restart-on-upgrade

This expands into

----------- prerm ---------------------

# Automatically added by dh_installinit
if [ -x "/etc/init.d/docker" ] && [ "$1" = remove ]; then
        invoke-rc.d docker stop || exit $?
fi
# End automatically added section

------------- postinst -----------------

# Automatically added by dh_installinit
if [ -x "/etc/init.d/docker" ]; then
        update-rc.d docker defaults >/dev/null
        invoke-rc.d docker start || exit $?
fi
# End automatically added section
--------------------------------------

Before (without --no-restart-on-upgrade) the prerm did not have the "&& [ "$1" = remove ]" condition.

Now neither an update nor a reinstall is possible if the service is running, because postinst fails with "invoke-rc.d docker start || exit $?".

To fix this a decision has to be made, if the package should restart the daemon (and thus all containers(!), see https://github.com/docker/docker/issues/2658) when upgrading/reinstalling or not.
Comment 1 Daniel Tröder univentionstaff 2015-10-05 09:37:21 CEST
The current behavior (docker 1.6.2~dfsg1-1.19.201 in UCS 4.1-0) if the "-d" flag is used when starting a Docker container is:
* Containers are started as children of Docker and daemonized. So Docker can be closed (using start-stop-daemon / init script) without the containers getting killed. They stay fully functional.
* The problem is, that when Docker is started again, it discovers all running containers… and kills them! Reattaching is not currently implemented.

BTW: ucs-4.1-0/base/univention-firewall/conffiles/etc/security/packetfilter.d/20_docker.sh needs a running docker service to discover the used port forwardings. If the univention-firewall is restarted when docker is stopped, it will not recreate the necessary port forwardings for the existing, detached containers.
Comment 2 Daniel Tröder univentionstaff 2015-10-23 10:15:19 CEST
Fixed with 64771 in univention-docker: the docker init script exits with 0 if docker is already stopped or already started, both prerm und postinst are then happy in either case.

@support: Please note, that if a user manually uninstalls docker.io and installs it again, the init script will be the original one of docker.io and an upgrade will fail, unless univention-docker is reinstalled, which will not be possible at that time, so a purge of docker.io will be needed first.
Comment 3 Arvid Requate univentionstaff 2015-10-27 19:29:13 CET
Ok, works. Changelog not required.
Comment 4 Stefan Gohmann univentionstaff 2015-11-17 12:12:43 CET
UCS 4.1 has been released:
 https://docs.software-univention.de/release-notes-4.1-0-en.html
 https://docs.software-univention.de/release-notes-4.1-0-de.html

If this error occurs again, please use "Clone This Bug".