Bug 47214 - Owncloud app fails on container restart
Owncloud app fails on container restart
Status: RESOLVED WORKSFORME
Product: UCS
Classification: Unclassified
Component: App Center
UCS 4.3
Other Linux
: P5 normal (vote)
: ---
Assigned To: App Center maintainers
App Center maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-06-20 10:56 CEST by Moritz Bunkus
Modified: 2018-08-23 11:29 CEST (History)
1 user (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 Moritz Bunkus 2018-06-20 10:56:18 CEST
Basically: the Owncloud app creates a file `/root/setup-ldap.sh` on the host during the `preinst` script and bind-mounts that into the container. However, it also moves `/root/setup-ldap.sh` to `/var/lib/univention-appcenter/apps/owncloud/` on the host when the join script is run. Therefore stopping and starting the container fails afterwards.

More details:

Owncloud app 20180427115720

1. During installation a preinst[1] script is downloaded from the app center and executed on the host. This preinst script creates the file `/root/setup-ldap.sh` on the host. If the creation fails, the script still continues to execute (!) as it isn’t run with set -e. The only result is that later steps start failing, too.
2. Next the Docker image is created.
3. Now a join script[2] is downloaded from the app center, too, and placed in `/usr/lib/univention-install` on the host.
4. That join script is now executed. It tries to move the file `/root/setup-ldap.sh` created by the preinst script to `/var/lib/univention-appcenter/apps/owncloud/` on the host.

If step 4 fails, the join script fails, and an error is emitted by the app center. The app is now in a semi-installed state.

Even if everything works just fine, the Docker container is created with a bind-mount for the file `/root/setup-ldap.sh` on the host to `/etc/owncloud.d/29-ldap.sh`. This works when the container is started for the first time as that first start occurs between steps 2 and 4 — meaning at a point in time when `/root/setup-ldap.sh` has been created but hasn’t been moved to `/var/…/owncloud/data` yet. However, if you simply stop and start the container again, this will now fail with the message that `/root/setup-ldap.sh` doesn’t exist and can therefore not be bind-mounted into the container

Steps to reproduce:

1. Install the Owncloud app
2. Inspect the Docker container and observe the `Mounts` array containing an entry for `/root/setup-ldap.sh`
3. Stop the Docker container.
4. Try to start the Docker container and observe the following nice error message:

> Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "process_linux.go:359: container init caused \"rootfs_linux.go:54: mounting \\\"/root/setup-ldap.sh\\\" to rootfs \\\"/var/lib/docker/overlay/99c664b50e39dc93de0475bb53ed0c4cf20bd1ee480b736938a5981644b54252/merged\\\" at \\\"/var/lib/docker/overlay/99c664b50e39dc93de0475bb53ed0c4cf20bd1ee480b736938a5981644b54252/merged/etc/owncloud.d/29-ldap.sh\\\" caused \\\"not a directory\\\"\""
> Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

This problem occurs more or less often and confuses users on the forums, e.g. here:

https://help.univention.com/t/onwcloud-docker-not-starting-at-boot/9037/

[1] https://appcenter.software-univention.de/univention-repository/4.2/maintained/component/owncloud_20180427115720/preinst
[2] https://appcenter.software-univention.de/univention-repository/4.2/maintained/component/owncloud_20180427115720/inst
Comment 1 Erik Damrose univentionstaff 2018-06-20 11:37:11 CEST
I informed the ISV, fix should be in the next app version
Comment 2 Erik Damrose univentionstaff 2018-08-23 11:29:04 CEST
Fix is in app version 10.0.8-20180604, update from a non working installation is supported (the preinst fixes the issue and starts the container to enable the update)