linuxserver / docker-grocy

A container for grocy - the ERP application for your kitchen https://grocy.info
GNU General Public License v3.0
333 stars 44 forks source link

Container startup / chown takes a long time. #21

Closed clydegale closed 3 years ago

clydegale commented 4 years ago

linuxserver.io

If you are new to Docker or this application our issue tracker is ONLY used for reporting bugs or requesting features. Please use our discord server for general support.


Expected Behavior

After starting the container it should spin up in a reasonable amount of time

Current Behavior

Container startup takes a very long (~5min) time to execute /var/run/s6/etc/cont-init.d/50-config After manual entering the container and adding "echo" between the commands in 50-config it seems that the last line seems to be the culprit:

chown -R abc:abc \
    /app/grocy \
    /config

Steps to Reproduce

  1. Start the container
  2. Check the logs
  3. Measure the time until the webserver is available

Environment

OS: Ubuntu 16.04.6 LTS
CPU architecture: x86_64 How docker service was installed: apt-get install docker-ce

# docker --version
Docker version 18.03.1-ce, build 9ee9f40

Command used to create docker container (run/create/compose/screenshot)

image

Docker logs

[s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] 01-envfile: executing... [cont-init.d] 01-envfile: exited 0. [cont-init.d] 10-adduser: executing... usermod: no changes


      _         ()
     | |  ___   _    __
     | | / __| | |  /  \
     | | \__ \ | | | () |
     |_| |___/ |_|  \__/

Brought to you by linuxserver.io

To support LSIO projects visit: https://www.linuxserver.io/donate/

GID/UID

User uid: 911 User gid: 911

[cont-init.d] 10-adduser: exited 0. [cont-init.d] 20-config: executing... [cont-init.d] 20-config: exited 0. [cont-init.d] 30-keygen: executing... using keys found in /config/keys [cont-init.d] 30-keygen: exited 0. [cont-init.d] 50-config: executing...

tobbenb commented 4 years ago

It's a bug in docker that on some combinations of kernel and docker manifests. You can try to upgrade Ubuntu and also docker, but there are no guarantee it will resolve the issue. This should only happen on first boot though.

I see now that you have not set the PUID or the PGID. That be a reason if you map a host path for /config.

clydegale commented 4 years ago

I tried it with custom PUID/PGID but its the same behaviour. Maybe I need to finally upgrade to a newer LTS version. Thanks

tobbenb commented 4 years ago

Did you wipe the host folder for /config before setting the PUID and PGID? You must do it or else the permissions are wrong.

tscibilia commented 4 years ago

I can confirm this, I'm actually running into the same exact issue. I'm on Ubuntu 18.04.4 LTS with Docker version 19.03.8, build afacb8b7f0. The log doesn't seem to compete (stuck at 50-config).

If I could offer any other config info, please let me know.

EDIT: Nevermind, it took nearly 1hr but after I pruned the docker system and re-ran the compose file, it loaded. Again, took a really long time to get past the 50-config stage.

tobbenb commented 4 years ago

It's a bug in docker that we can't do much about. Disk io also plays a role in this as I had to move away from a Jenkins build node VM, same Ubuntu as you, hosted on ssd with btrfs. Moved it to another ssd formatted as xfs and the long time was gone.

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

dustinmm80 commented 3 years ago

I am also running into this issue, launching the grocy image into k3s. This is the only linuxserver image out of ~25 that I have launched that has this issue.

Can you link to the Docker bug you mentioned?

aptalca commented 3 years ago

https://github.com/docker/for-linux/issues/388

dustinmm80 commented 3 years ago

Thanks, I guess this is not only an issue for docker, but a containerd issue as well. I'm trying to install this via the helm chart onto a k3s cluster with nodes that don't have docker installed. Strange that it is only happening with the grocy image.

dustinmm80 commented 3 years ago

I was able to get the pod running by setting these values for https://github.com/k8s-at-home/charts/tree/master/charts/stable/grocy

probes:
  startup:
    spec:
      initialDelaySeconds: 0
      timeoutSeconds: 1
      periodSeconds: 5
      failureThreshold: 90
aptalca commented 3 years ago

fixed in #43