buanet / ioBroker.docker

Official Docker Image for ioBroker
https://www.iobroker.net
MIT License
200 stars 68 forks source link

[Problem]: Trouble when mounting partition containing iobroker volume automatically via fstab #503

Open et-tommy opened 1 month ago

et-tommy commented 1 month ago

Description / Beschreibung

System: Pi CM4 (32G eMMC, 8G RAM) on a Waveshare IO Bord with PCIe Interface. NVMe SSD attached to PCIe Interface. NVMe contains 1 Ext4-partition ("nvme0n1p1"), where all docker volumes are stored. Running Raspberry OS lite (bookworm) Docker Image 10.0.0 NodeJS: 20.18.0 NPM: 10.8.2

On the docker system, several containers are running, e.g. iobroker, zigbee2mqtt, mosquitto, rasspberrymatic, pihole, portainer, homeassistant

When all the containers were set up, their volumes were located at /var/lib/docker/volumes which was initially at the eMMC. Since the volumes meed nore memory, I deceided to attach a NVMe SSD via the PCIe port.

Process of migration:

  1. stop docker - sudo systemctl stop docker
  2. rename the volumes Folder: /var/lib/docker/volumes_bkp
  3. create a new /var/lib/docker/volumes Folder and to mount the Partition of the NVMe. sudo mount /dev/nvme0n1p1 /var/lib/docker/volumes
  4. copy all files/Folders from /var/lib/docker/volumes_bkp to /var/lib/docker/volumes
  5. start docker - sudo systemctl start docker

Result: all Containers restarted successfully.

To automount the NVMe at Startup I added a line in the /etc/fstab file. UUID=351b005a-a268-4417-972c-e4106351e298 /var/lib/docker/volumes/ ext4 defaults,auto,users,rw,nofail 0 0

After a reboot of the system, the mount works in general. All containers can be started and find the data in their volumes, but iobroker stucks in a Startup loop, with the error: Connecting to database: Permissionn denied.

When I do de mount manually (stopping docker, umount, mount with sudo mount /dev/nvme0n1p1 /var/lib/docker/volumes, start docker), iobroker starts up regular.

I have no idea what might be the difference in the two ways of mounting the NVMe.

Image version

V10.0.0

Docker logs / Docker Protokoll

--------------------------------------------------------------------------------
-------------------------     2024-10-17 20:03:57      -------------------------
--------------------------------------------------------------------------------
-----                                                                      -----
----- ██╗  ██████╗  ██████╗  ██████╗   ██████╗  ██╗  ██╗ ███████╗ ██████╗  -----
----- ██║ ██╔═══██╗ ██╔══██╗ ██╔══██╗ ██╔═══██╗ ██║ ██╔╝ ██╔════╝ ██╔══██╗ -----
----- ██║ ██║   ██║ ██████╔╝ ██████╔╝ ██║   ██║ █████╔╝  █████╗   ██████╔╝ -----
----- ██║ ██║   ██║ ██╔══██╗ ██╔══██╗ ██║   ██║ ██╔═██╗  ██╔══╝   ██╔══██╗ -----
----- ██║ ╚██████╔╝ ██████╔╝ ██║  ██║ ╚██████╔╝ ██║  ██╗ ███████╗ ██║  ██║ -----
----- ╚═╝  ╚═════╝  ╚═════╝  ╚═╝  ╚═╝  ╚═════╝  ╚═╝  ╚═╝ ╚══════╝ ╚═╝  ╚═╝ -----
-----                                                                      -----
-----              Welcome to your ioBroker Docker container!              -----
-----                    Startupscript is now running!                     -----
-----                          Please be patient!                          -----
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
-----                          System Information                          -----
-----                    arch:                aarch64                      -----
-----                    hostname:            iobroker                     -----
-----                                                                      -----
-----                          Version Information                         -----
-----                    image:               v10.0.0                      -----
-----                    build:               2024-10-16T01:43:46+02:00    -----
-----                    node:                v20.18.0                     -----
-----                    npm:                 10.8.2                       -----
-----                                                                      -----
-----                        Environment Variables                         -----
-----                    DEBUG:               true                         -----
-----                    SETGID:              1000                         -----
-----                    SETUID:              1000                         -----
--------------------------------------------------------------------------------

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!                            DEBUG LOG ACTIVE                            !!!!
!!!!               Environment variable DEBUG is set to true.               !!!!
!!!! This will extend the logging output and may slow down container start. !!!!
!!!!          Please make sure to deactivate if no longer needed.           !!!!
!!!!     For more information see ioBroker Docker image documentation:      !!!!
!!!!           https://docs.buanet.de/iobroker-docker-image/docs/           !!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

--------------------------------------------------------------------------------
-----                   Step 1 of 5: Preparing Container                   -----
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
-----             Step 2 of 5: Detecting ioBroker Installation             -----
--------------------------------------------------------------------------------

Existing installation of ioBroker detected in "/opt/iobroker".

--------------------------------------------------------------------------------
-----             Step 3 of 5: Checking ioBroker Installation              -----
--------------------------------------------------------------------------------

(Re)setting permissions (This might take a while! Please be patient!)... Done.

[DEBUG] Checking multihost settings... 
[DEBUG] No multihost settings detected.
[DEBUG] Done.

[DEBUG] Checking custom objects db settings... 
[DEBUG] No custom objects db settings detected.
[DEBUG] Done.

[DEBUG] Checking custom states db settings... 
[DEBUG] No custom states db settings detected.
[DEBUG] Done.

Checking database connection... Failed.
[ERROR] error: exec failed: permission denied

Please check your configuration and try again.
For more information see ioBroker Docker image docs (https://docs.buanet.de/iobroker-docker-image/docs).

[DEBUG] Debug mode prevents the container from exiting on errors.
[DEBUG] This enables you to investigate or fix your issue on the command line.
[DEBUG] If you want to stop or restart your container you have to do it manually.
[DEBUG] IoBroker is not running!
Marc-Berg commented 1 week ago

Unfortunately, I've only just seen the issue. I could imagine that the behavior is related to the fact that symbolic links are not handled correctly. Try adding the “bind” parameter.

UUID=351b005a-a268-4417-972c-e4106351e298 /var/lib/docker/volumes/ ext4 defaults,auto,users,rw,nofail,bind 0 0