Is your docker also corrupt after a reboot? (OMV5, Pi4) This might fix it!

  • I stumbled upon this topic because I have the same issue.


    I've ran the following command

    sudo systemctl edit docker.service is the proper way to add overrides/changes...

    and added this to the file

    [Service]

    ExecStartPre=/bin/sleep 30

    StartLimitInterval=300s

    will this fix the issue at hand?


    omv-extras writes the waitLocalFs.conf. So, I wouldn't change that one. And instead of delay, delete all of the files in /etc/systemd/system/docker.service.d/ and try the following (as root):


    Code
    cat <<EOF > /etc/systemd/system/docker.service.d/waitAllMounts.conf
    [Unit]
    After=local-fs.target $(systemctl list-units --type=mount | grep /srv | awk '{ print $1 }' | tr '\n' ' ')
    EOF

    If that works, I will change omv-extras to use that code.

    Here you suggest something to somebody else. Is this something I can try and might have the same effect as the 1st option that I did?

    • Offizieller Beitrag

    will this fix the issue at hand?

    Try it.


    Is this something I can try and might have the same effect as the 1st option that I did?

    Of course you can try it. I don't have a setup that can test everyone's setup to know if any of these things work. If they work for you, great. I don't think you should have to use both options but if that is the only thing that works, then use it.

    omv 7.1.0-2 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.13 | compose 7.2 | k8s 7.1.0-3 | cputemp 7.0.1 | mergerfs 7.0.5 | scripts 7.0.2


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Of course you can try it. I don't have a setup that can test everyone's setup to know if any of these things work. If they work for you, great. I don't think you should have to use both options but if that is the only thing that works, then use it.

    Had solution 1 not working the 1st time but forgot to start the drives so...my bad. 2nd shutdown and startup appears to have worked.


    I've also tryed your solution. Removed all files in /etc/systemd/system/docker.service.d/ and ran the commands as root. I notice it takes longer for docker and the containers to restart about double as long as solution 1.


    Is it correct that solution 1 will always start after 30 seconds, even if the drives are not fully loaded and that your solution will wait for a full startup before starting docker? If so, I prefer your solution as from a programmers perspective, your solution is the preferred one.


    I'll leave this here too.

    If you can't get solution 2 to work due to being unable to log in as root and adding sudo in front ot cat ... does not work, login as your normal user (pi for me) and run sudo -i to go into root user, run the 4 lines from solution 2 and press Ctrl+D to exit back to your user.

    • Offizieller Beitrag

    Is it correct that solution 1 will always start after 30 seconds, even if the drives are not fully loaded and that your solution will wait for a full startup before starting docker?

    Yep. That is why I was opposed to using a time instead of actually waiting for the drives. Unfortunately, my solution doesn't self update if you add/change the drives in the system.

    omv 7.1.0-2 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.13 | compose 7.2 | k8s 7.1.0-3 | cputemp 7.0.1 | mergerfs 7.0.5 | scripts 7.0.2


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • So, to fix it, I delayed the docker initialization with 30 sec:

    Bash: /lib/systemd/system/docker.service
    ExecStartPre=/bin/sleep 30
    StartLimitInterval=300s


    Thank you for this tip Bas it saved my reboot headache. I had placed the /data folder of NextCloud on another disk (to allow space...) that obviously took a little longer to mount, compared to Docker startup time, and thanks to this delay I had no Portainer containers not running after each reboot. Thank you!


    Next time I will do things in a little more "proper" way as ryecoaaron suggested and Krowi asked, i.e.


    sudo systemctl edit docker.service


    ...and add the following to the "override" file that will be created:

    Code
    [Service]
    ExecStartPre=/bin/sleep 30
    StartLimitInterval=300s

    Thanks again, everyone.

    OpenMediaVault 6.9.13-1 • Intel NUC NUC6CAYH • Intel Celeron J3455 • 2x4GB RAM • Samsung 870 QVO 4TB • USB Boot (System)

    3 Mal editiert, zuletzt von Konsti ()

    • Offizieller Beitrag

    When docker is being installed using omv-extras, an override file is being created to wait with the start of docker until all filesystems mounted in the GUI of OMV are mounted.


    If you installed docker before this change had been implemented, all you have to do is to press the install Docker button again. This will create the override file.


    RE: Docker Containers Starting on Boot Before Volumes are Mounted

    and some posts above


    However, if the time based solution works for you, that is all that matters.

  • Hello macom thank you for your tip. Where is the override file normally located, per your comment?


    As root via SSH, I did systemctl edit docker.service and immediately exited (Ctrl+X). Terminal showed this message:


    Editing "/etc/systemd/system/docker.service.d/override.conf" canceled: temporary file is empty.


    I do not see anything beyond folder /etc/systemd/system/ i.e. no /docker.service.d/ folder there....


    Running OMV 5.6.12-1 on a test home server with Docker reporting version 5:20.10.7~3-0~debian-buster on a rather "clean" installation a few days ago.


    Thank you

    OpenMediaVault 6.9.13-1 • Intel NUC NUC6CAYH • Intel Celeron J3455 • 2x4GB RAM • Samsung 870 QVO 4TB • USB Boot (System)

    • Offizieller Beitrag

    Follow the link in my previous post. It leads you to a post from ryecoaaron which has the link to the source.


    This solution only works for filesystems that have been available when docker was installed. If you mounted filesystems afterwards, you have to press the install docker button again.

  • Hi,

    I'm running OMV with a raspberry pi 2B.Docker storage is configured on the raspberry SD card so no issue; container persistent storage is located on a usb drive so I face the issue described at reboot (only on 2 containers, I have 6 containers started at boot).

    I tried the delay way proposed here delay docker start but no luck.

    I think my issue is related to external drive mount availability so I tried


    omv-extras writes the waitLocalFs.conf. So, I wouldn't change that one. And instead of delay, delete all of the files in /etc/systemd/system/docker.service.d/ and try the following (as root):


    Code

    Code
    cat <<EOF > /etc/systemd/system/docker.service.d/waitAllMounts.conf
    
    [Unit]
    
    After=local-fs.target $(systemctl list-units --type=mount | grep /srv | awk '{ print $1 }' | tr '\n' ' ')
    
    EOF


    and works!!!
    It takes some time to have containers up & running but now I can rely on those containers also after a power outage :D

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!