buanet / ioBroker.docker

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

[Problem]: Bootloop after 7.1.0+ update when using USB symlinks #301

Closed r748 closed 1 year ago

r748 commented 1 year ago

Description

I have configured my system to always bind my USB devices (Aeotec Z-Wave Stick and Conbee2) under a static name, so in case I unplug a device, it is reachable under the same path when plugged back in. Up until 7.0.1 this worked fine. The log showed the following chown/chmod errors, but the container started just fine and both Z-Wave and Zigbee devices worked flawlessly.

--------------------------------------------------------------------------------
-----                Step 4 of 5: Applying special settings                -----
--------------------------------------------------------------------------------

Some adapters have special requirements/ settings which can be activated by the use of environment variables.
For more information see ioBroker Docker Image Docs (https://docs.buanet.de/iobroker-docker-image/docs/).

Z-Wave is activated by ENV.
Running setup script...
[setup_zwave.sh] Openzwave is NOT installed. Going to install it now... Done.
Done.

Usb-device-support is activated by ENV.
chown: cannot access '/dev/aeotec-z-wave-stick': No such file or directory
chmod: cannot access '/dev/aeotec-z-wave-stick': No such file or directory
Setting permissions for /dev/aeotec-z-wave-stick... Done.
chown: cannot access '/dev/conbee2': No such file or directory
chmod: cannot access '/dev/conbee2': No such file or directory
Setting permissions for /dev/conbee2... Done.

When upgrading to 7.1.0 or higher, the container enters a bootloop at the following point:

--------------------------------------------------------------------------------
-----                Step 4 of 5: Applying special settings                -----
--------------------------------------------------------------------------------

Some adapters have special requirements/ settings which can be activated by the use of environment variables.
For more information see ioBroker Docker Image Docs (https://docs.buanet.de/iobroker-docker-image/docs/).

ZWAVE is \"true\". Running setup script...
[setup_zwave.sh] Openzwave is NOT installed. Going to install it now... Done.
Done.

USBDEVICES is set.
chown: cannot access '/dev/aeotec-z-wave-stick': No such file or directory
Setting permissions for /dev/aeotec-z-wave-stick... 

It would be great, if it were possible to continue using symlinks for the Z-Wave and Zigbee controllers.

Image version

v7.1.0+

Docker logs

--------------------------------------------------------------------------------
-------------------------     2022-11-22 08:03:03      -------------------------
--------------------------------------------------------------------------------
-----                                                                      -----
----- ██╗  ██████╗  ██████╗  ██████╗   ██████╗  ██╗  ██╗ ███████╗ ██████╗  -----
----- ██║ ██╔═══██╗ ██╔══██╗ ██╔══██╗ ██╔═══██╗ ██║ ██╔╝ ██╔════╝ ██╔══██╗ -----
----- ██║ ██║   ██║ ██████╔╝ ██████╔╝ ██║   ██║ █████╔╝  █████╗   ██████╔╝ -----
----- ██║ ██║   ██║ ██╔══██╗ ██╔══██╗ ██║   ██║ ██╔═██╗  ██╔══╝   ██╔══██╗ -----
----- ██║ ╚██████╔╝ ██████╔╝ ██║  ██║ ╚██████╔╝ ██║  ██╗ ███████╗ ██║  ██║ -----
----- ╚═╝  ╚═════╝  ╚═════╝  ╚═╝  ╚═╝  ╚═════╝  ╚═╝  ╚═╝ ╚══════╝ ╚═╝  ╚═╝ -----
-----                                                                      -----
-----              Welcome to your ioBroker Docker container!              -----
-----                    Startupscript is now running!                     -----
-----                          Please be patient!                          -----
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
-----                          System Information                          -----
-----                    arch:                x86_64                       -----
-----                    hostname:            iobroker                     -----
-----                                                                      -----
-----                          Version Information                         -----
-----                    image:               v7.1.2                       -----
-----                    build:               2022-11-12T20:56:04+00:00    -----
-----                    node:                v16.18.1                     -----
-----                    npm:                 8.19.2                       -----
-----                                                                      -----
-----                        Environment Variables                         -----
-----                    SETGID:              1000                         -----
-----                    SETUID:              1000                         -----
-----                    USBDEVICES:          /dev/aeotec-z-wave-stick;/dev/conbee2 -----
-----                    ZWAVE:               true                         -----
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
-----                  Step 1 of 5: Preparing container                   -----
--------------------------------------------------------------------------------

Updating Linux packages on first run...
dpkg-preconfigure: unable to re-open stdin: 
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 29424 files and directories currently installed.)
Preparing to unpack .../libk5crypto3_1.18.3-6+deb11u3_amd64.deb ...
Unpacking libk5crypto3:amd64 (1.18.3-6+deb11u3) over (1.18.3-6+deb11u2) ...
Setting up libk5crypto3:amd64 (1.18.3-6+deb11u3) ...
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 29424 files and directories currently installed.)
Preparing to unpack .../libkrb5support0_1.18.3-6+deb11u3_amd64.deb ...
Unpacking libkrb5support0:amd64 (1.18.3-6+deb11u3) over (1.18.3-6+deb11u2) ...
Setting up libkrb5support0:amd64 (1.18.3-6+deb11u3) ...
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 29424 files and directories currently installed.)
Preparing to unpack .../libkrb5-3_1.18.3-6+deb11u3_amd64.deb ...
Unpacking libkrb5-3:amd64 (1.18.3-6+deb11u3) over (1.18.3-6+deb11u2) ...
Setting up libkrb5-3:amd64 (1.18.3-6+deb11u3) ...
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 29424 files and directories currently installed.)
Preparing to unpack .../libgssapi-krb5-2_1.18.3-6+deb11u3_amd64.deb ...
Unpacking libgssapi-krb5-2:amd64 (1.18.3-6+deb11u3) over (1.18.3-6+deb11u2) ...
Setting up libgssapi-krb5-2:amd64 (1.18.3-6+deb11u3) ...
Processing triggers for libc-bin (2.31-13+deb11u5) ...
Done.

Registering maintenance script as command... Done.

--------------------------------------------------------------------------------
-----             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.

Fixing "sudo-bug" by replacing sudo with gosu... Done.

Hostname in ioBroker matches the hostname of this container.
No action required.

--------------------------------------------------------------------------------
-----                Step 4 of 5: Applying special settings                -----
--------------------------------------------------------------------------------

Some adapters have special requirements/ settings which can be activated by the use of environment variables.
For more information see ioBroker Docker Image Docs (https://docs.buanet.de/iobroker-docker-image/docs/).

ZWAVE is \"true\". Running setup script...
[setup_zwave.sh] Openzwave is NOT installed. Going to install it now... Done.
Done.

USBDEVICES is set.
chown: cannot access '/dev/aeotec-z-wave-stick': No such file or directory
Setting permissions for /dev/aeotec-z-wave-stick... 
buanet commented 1 year ago

The error cannot access '/dev/aeotec-z-wave-stick': No such file or directory tells me that your config is not correct at some point.

Are you absolutely sure you mounted your device with the --device option when creating your container? Just setting the env "USBDEVICES" is not enough!

If you did so, why don't you use /dev/serial/by-id/... path to mount your devices? Please correct your config and you will be fine running the new image versions...

If you need any help, join the ioBroker forum or one of the othe ioBroker communities at discord, facebook or telegram.

Regards, André

r748 commented 1 year ago

Thanks for the quick reply.

Yes, I'm using the --device option and using /dev/serial/by-id/... produces the same error. Only if I use the /dev/ttyACMx path the container starts successfully. But I've had cases that after unplugging or rebooting, the dongles weren't always mounted on the same ttyACMx, that's why I would prefer to use static paths. Any idea why this doesn't work?

buanet commented 1 year ago

Please show me your container config. Are you using cli or some kind of ui (portainer?)? Docker-compose? What system are you working on? DiskStation? Unraid? any other NAS?

This is from my docker-compose, working with latest image version:

    environment:
      - USBDEVICES=/dev/serial/by-id/rflink
    devices:
      - /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0:/dev/serial/by-id/rflink

Can you verify the path of the device you are using on the host?

 andre@vm-debian-docker:~$ ls -al /dev/serial/by-id/
insgesamt 0
drwxr-xr-x 2 root root 80  4. Nov 13:25 .
drwxr-xr-x 4 root root 80  4. Nov 13:25 ..
lrwxrwxrwx 1 root root 13  4. Nov 13:25 usb-1a86_USB2.0-Serial-if00-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13  4. Nov 13:25 usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20220713142537-if00 -> ../../ttyACM0
r748 commented 1 year ago

I'm using Portainer on OpenMediaVault. This is my Docker-Compose with the working config. If I use the currently commented lines, then I get the bootloop:

version: '2'

networks:
  default:
    external: true
    name: docker_public_enp4s0f0

services:
  iobroker:
    container_name: iobroker
    image: buanet/iobroker:v7.1.2
    hostname: iobroker
    restart: unless-stopped
    volumes:
      - /mnt/dockerdrive/iobroker:/opt/iobroker
      - /mnt/dockerdrive/userscripts:/opt/userscripts
      - /srv/dev-disk-by-uuid-03009889-6bfa-4f4c-8bf1-2dd595715acc/iobroker-backup:/opt/iobroker/backups
    environment:
      - ZWAVE=true
#1      - USBDEVICES=/dev/aeotec-z-wave-stick;/dev/conbee2
#2      - USBDEVICES=/dev/serial/by-id/usb-0658_0200-if00;/dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2128334-if00
      - USBDEVICES=/dev/ttyACM1;/dev/ttyACM0
    devices:
#1      - /dev/aeotec-z-wave-stick:/dev/ttyACM0 # Z-Wave-Stick
#2      - /dev/serial/by-id/usb-0658_0200-if00:/dev/ttyACM0 # Z-Wave-Stick
#1      - /dev/conbee2:/dev/ttyACM1 # deConz
#2      - /dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2128334-if00:/dev/ttyACM1 # deConz
      - /dev/ttyACM1:/dev/ttyACM0 # Z-Wave-Stick
      - /dev/ttyACM0:/dev/ttyACM1 # deConz
    networks:
      default:
        ipv4_address: 192.168.2.6
    labels:
      - "com.centurylinklabs.watchtower.monitor-only=true"

Here's the output of ls -al /dev/serial/by-id/

rob@homeserver:/home/rob$ ls -al /dev/serial/by-id/
insgesamt 0
drwxr-xr-x 2 root root 80 21. Nov 20:59 .
drwxr-xr-x 4 root root 80 21. Nov 20:59 ..
lrwxrwxrwx 1 root root 13 21. Nov 20:59 usb-0658_0200-if00 -> ../../ttyACM1
lrwxrwxrwx 1 root root 13 21. Nov 20:59 usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2128334-if00 -> ../../ttyACM0
buanet commented 1 year ago

Hi, sorry for the delay.

Your config is not correct. Let's break this down.

What's working:

    environment:
      - USBDEVICES=/dev/ttyACM1;/dev/ttyACM0
    devices:
      - /dev/ttyACM1:/dev/ttyACM0 # Z-Wave-Stick
      - /dev/ttyACM0:/dev/ttyACM1 # deConz

#BTW why did you switch the path (ACM1 mounts to ACM0 and ACM0 mounts to ACM1)???

That means:

    environment:
      - USBDEVICES=[path1_in_container];[path2_in_container]
    devices:
      - [path1_on_host]:[path1_in_container] # Z-Wave-Stick
      - [path2_on_host]:[path2_in_container] # deConz

What is correct! The path before the : is the path on the host, the path after it is the path that is mapped to inside the container. The env DEVICES contains only the paths from inside the container. Now check #1 and #2

#1

    environment:
      - USBDEVICES=/dev/aeotec-z-wave-stick;/dev/conbee2
    devices:
      - /dev/aeotec-z-wave-stick:/dev/ttyACM0 # Z-Wave-Stick
      - /dev/conbee2:/dev/ttyACM1 # deConz

#2

    environment:
      - USBDEVICES=/dev/serial/by-id/usb-0658_0200-if00;/dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2128334-if00
    devices:
      - /dev/serial/by-id/usb-0658_0200-if00:/dev/ttyACM0 # Z-Wave-Stick
      - /dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2128334-if00:/dev/ttyACM1 # deConz

You get the problem? If not, take another look at the code after "That means:"...


This would be the solution I preferring:

    environment:
      - USBDEVICES=/dev/zwave;/dev/conbee
    devices:
      - /dev/serial/by-id/usb-0658_0200-if00:/dev/zwave
      - /dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2128334-if00:/dev/conbee

Don't forget to configure your Adapters/ Software inside the container to to use the path /dev/zwave for Z-Wave-Stick and /dev/conbee for deConz.

Regards, André

r748 commented 1 year ago

Oh... I feel so stupid now...

I hadn't realized that the environment USBDEVICES variable requires the paths inside the container. I had used the paths on the host, that's why my config was messed up!

All issues are resolved now, thank you very much for your detailed answer and help André!!

Best regards, Rob