dleidert / openmediavault-upgrade

Script to upgrade openmediavault from one major release into the next
GNU General Public License v3.0
48 stars 1 forks source link

post.d/10-reinstall-omvextras: E: Sub-process /usr/bin/dpkg returned an error code (1) #18

Closed godfuture closed 3 years ago

godfuture commented 3 years ago

Following comment https://github.com/dleidert/openmediavault-upgrade/issues/15#issuecomment-757361491 I have tested snapshot "e15e0f707981ee005cdf408187cc49347aa93d36". Tracking the issue in upgrade log file, docker cannot be started during package updates:

Setting up docker-ce (5:20.10.2~3-0~debian-buster) ...
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
invoke-rc.d: initscript docker, action "restart" failed.
* docker.service - Docker Application Container Engine
   Loaded: loaded (ESC]8;;file://media-server.mydomain.de/lib/systemd/system/docker.service^G/lib/systemd/system/docker.serviceESC]8;;^G; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Sat 2021-01-09 21:57:32 CET; 7ms ago
     Docs: ESC]8;;https://docs.docker.com^Ghttps://docs.docker.comESC]8;;^G
  Process: 16491 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock ESC[0;1;31m(code=exited, status=1/FAILURE)ESC[0m
 Main PID: 16491 (code=exited, status=1/FAILURE)
dpkg: error processing package docker-ce (--configure):
 installed docker-ce package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)
run-parts: /root/openmediavault-upgrade-e15e0f707981ee005cdf408187cc49347aa93d36/post.d/10-reinstall-omvextras exited with return code 100

This is related to my special setup which is related to the feature in omv docker-plugin to move the docker home to other partition/mounts.

Checking details in systemd reveals that docker-ce cannot write to my docker home mount: chmod /srv/dev-disk-by-label-docker/Home: read-only file system

Question: is the remount read-only always required?

dleidert commented 3 years ago

This is related to my special setup which is related to the feature in omv docker-plugin to move the docker home to other partition/mounts.

What does that mean? What/why is docker trying to write to that partition? Can you quote me the part of /etc/openmediavault/config.xml or any related configuration file which controls this?

Checking details in systemd reveals that docker-ce cannot write to my docker home mount: chmod /srv/dev-disk-by-label-docker/Home: read-only file system

Question: is the remount read-only always required?

It is just a safety measurement. Some people want to make sure nothing happens to their data. In my personal opinion it is not necessary at all. But it didn't hurt, so I implemented it. You can disable the script as described before.

I am wondering however. In an earlier issue report you told me that the shares aren't there at all. Now you say that the share is indeed mounted as read-only. Did you add these shares to your VM?

godfuture commented 3 years ago

What does that mean? What/why is docker trying to write to that partition? Can you quote me the part of /etc/openmediavault/config.xml or any related configuration file which controls this?

cat /etc/openmediavault/config.xml | grep docker | less: 
          <name>docker</name>
        <command>/usr/bin/docker exec --user www-data nextcloud php -f cron.php</command>
        <command>/usr/bin/docker exec --user www-data nextcloud php -f occ preview:pre-generate</command>
        <fsname>/dev/disk/by-label/docker</fsname>
        <dir>/srv/dev-disk-by-label-docker</dir>
  <omvextras><testing>0</testing><extras>0</extras><dockerStorage>/var/lib/docker</dockerStorage><webport>9000</webport><agentport>8000</agentport><yachtport>8001</yachtport></omvextras></system>
          <source>/srv/dev-disk-by-label-docker</source>

I am wondering however. In an earlier issue report you told me that the shares aren't there at all. Now you say that the share is indeed mounted as read-only. Did you add these shares to your VM?

I will explain myself a little: I have setup omv system on RAID1, luks and lvm2. This is not according to stardard, I know. But to me this solutions seems useful to have safety in hardware and data and lvm snapshot capabilities. I have created a separate partition to host docker container config and home. So this partition is part of my system disk and therefore available out of box with restore in virtualbox. Many other drives are still missing and therefore a vast majority of my mounts are not available e.g. nextcloud data drive. Still omv4 docker-plugin allowed users to move their home to other locations. My docker home is now read only.

Does this make sense to you?

I think moving docker home is not uncommon, but docker partition is I admit. Should I simply disable mount read-only? Probably this issue is not a problem for the majority of users...

dleidert commented 3 years ago

Well I need to know where the partition or directory for docker is stored in /etc/openmediavault/config.xml. I need the exact node so I can use xmlstarlet to extract it from the config. Then I could use it to prevent the mount point from being remounted read-only. I guess it is the node that contains either or both of the <dir> and <source> entries. If you want you can provide me with the config (e.g. as gist in your github namespace) or figure out the node yourself or just disable the remount-script.

dleidert commented 3 years ago

I'm wondering if disabling the docker service during the upgrade is the easiest way to go here. The installation won't try to start the service then.

godfuture commented 3 years ago

I'm wondering if disabling the docker service during the upgrade is the easiest way to go here. The installation won't try to start the service then.

To my knowledge we do not need docker to be started. Would systemctl disable docker be feasible here?

dleidert commented 3 years ago

I have had the same thought and already pushed a possible fix. It runs successfully in a VM with docker setup to use a home directory on one of the shares.

dleidert commented 3 years ago
wget -qO- https://github.com/dleidert/openmediavault-upgrade/archive/4_fix_18.tar.gz | tar -xz
sudo openmediavault-upgrade-4_fix_18/omv-release-upgrade-5
godfuture commented 3 years ago

I am in the middle of the upgrade, but I have created a vm snapshot before update. Shall I go back?

You are trying to run this script from Debian '10.7', not Debian 'stretch'.
run-parts: /root/openmediavault-upgrade-4_fix_18/check.d/01-debian-version exited with return code 1
dleidert commented 3 years ago

Yes, please. If you want to continue from where you were you will have to disable the docker service, then apt-get install -f, then you can run run-parts --exit-on-error -v post.d/.

godfuture commented 3 years ago

Current state: I restored my snapshot and successfully executed:

wget -qO- https://github.com/dleidert/openmediavault-upgrade/archive/4_fix_18.tar.gz | tar -xz
sudo openmediavault-upgrade-4_fix_18/omv-release-upgrade-5

But for now I can't start docker service. I am checking the logs, if this is related to my setup or upgrade. Unfortunately systemctl status docker.service and journalctl -xe are not providing a lot details.

dleidert commented 3 years ago

Maybe /var/log/daemon.log and /var/log/syslog can provide more information? Or starting docker from the command line?

godfuture commented 3 years ago

I do not have concrete answers, but since I upgraded the kernel to 5.8, the issues got solved. I guess the upgrade worked out fine, even though I am struggling with nginx now :) but that is related to omv5. Thanks for your help! Closing...