November 16, 20232 yr Hello! Fairly recently I've started using the docker functionality within unraid. I'm having problems with permissions from within a docker container and i'm a novice at both linux and docker itself. I'm trying to pass through a usb device to my container by id, rather than by "usb device". Because when I do that, it (seemingly) randomly switches from location "/dev/ttACM0" to "/dev/ttACM1" and vice versa. So passing through by id appears to be the way forward. Now i'm passing through a device by id using the following value: /dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230807104003-if00:/dev/zigbee Within the container itself, the device now has the following permissions "crw-rw----". With these permissions, the application within the container cannot access the device. When i manually edit the permission within the container using the following command: chmod a+rwx /dev/zigbee , the application can acces the device without any problems. The issue with this is that whenever the container is restarted, the permissions obviously get reset. Setting Post Arguments only seem to execute on the host machine, but maybe i'm missing something. How can i "permanently" change the permissions for the passed through device on "/dev/zigbee"? As a note: running the container in privileged mode also allows the application to use the device, but i'm trying to avoid that for obvious reasons. Edited November 16, 20232 yr by Donrenegade
November 27, 20232 yr Author Solution I'm not sure whether this is the intended way to do this, but adding the following has fixes my issues: Unraid => Docker => Under Docker Containers, select container and edit => Enable Advanced View ... Under Post Arguments, I added the following: && docker exec -u root homeassistant sh -c "chmod a+rwx /dev/zigbee" The device can now be accessed without needing privileged mode!
January 10, 20242 yr Community Expert I just stumbled on this post. I was going to post on the unraid forum 'How to pass through a USB without Privileged mode being ticked'. You never got any replies, but your solution works fine for me. Is this the correct way of doing this ? I am passing through a currentcost device like such - and it would not work unless prilileged : /dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0:/dev/currentcost
January 11, 20242 yr Community Expert Back again on this - I just upgraded unraid from 6.12.4 to 6.12.6 and the home assistant docker container lost access to its USB controller. I changed it to priveleged and it is working again. So did the upgrade to 6.12.6 break this 'process' of adding this to the post arguments : && docker exec -u root homeassistant sh -c "chmod a+rwx /dev/currentcost" I dont want to have to run this as privelaged if I dont have to......
March 5, 20242 yr use: advanced view extra parameters and enter: --device=/dev/ttyUSB0:/dev/ttyUSB0 to pass trough a device without privileged
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.