I have an USB device for my home automation.
Every time my container boots I need to do chmod 666 /dev/ttyUSB0 before my systemd daemon starts, otherwise I get a permission denied: mqttbroker npm[1189]: #033[31mZigbee2MQTT:error#033[39m 2020-10-31 15:30:43: Error: Error while opening serialport 'Error: Error: Permission denied, cannot open /dev/ttyUSB0'
Is there a permanent way to fix this?
I added the USB with: lxc config device add mqttbroker ttyusb unix-char path=/dev/ttyUSB0
EDIT: Some version info:
# lxd --version
4.7
# uname -a
Linux server-01 5.4.0-52-generic #57-Ubuntu SMP Thu Oct 15 10:57:00 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
There should be no issue with access of the device from the host. You should set the uid, gid, mode so that in the instance (the container) mqttbroker is happy.