USB device mounting

Setup:
Hassio in LXC container running on QNAP NAS
USB device: Aeotec Z-Stick and CC2530

Before:
I have passed the two ACM devices to the Hassio LXC container and the Hardware tab of Hassio shows /dev/ttyACM1 and /dev/ttyACM2

Now:
All of a sudden (May be since HA 0.94.3) the same USB devices is also shown as /dev/serial/by-id/. So I have 4 devices listed under my serial (2 and 2 duplicated). I have not done anythings with the QNAP NAS

Problem:
I can’t run any add-on (zigbee2mqtt and community SSH) that needs to access USB serial devices due to the fact that add-ons are not privilege containers and cannot access /dev/serial/by-id/. As a result, the add-on sees the /dev/serial/by-id/ but returns an error when in fact it cannot access the /dev/serial/by-id/

Any thought? Thanks

1 Like

Hello Adam,

I have a similar or maybe even the same problem.
Everything was working fine for HA 0.92.2 but, after I updated to HA 0.95.4, I got the following error when I try to start some add-ons (Node-Red, Visual Studio Code, …):

error gathering device information while adding custom device “/dev/serial/by-id/usb-xxxx_xxxx-xxxx”: no such file or directory

Have you found a solution for this case?

Thank you,
Jonas

No.

What is your setup?

Hey,

Similar to yours. I have Hassio in Ubuntu LXC container running on QNAP too but I only have Aeotec Z-Stick (/dev/ttyACM0).

From what I understood, we should configure QNAP to expose /dev/serial/by-id to LXC container. Although I couldn’t find a proper configuration to do it now, I found a temporary fix for this issue (which it might not be ideal).

  1. ssh to QNAP and then, ssh to LXC container

  2. Create directory

/dev/serial/by-id

  1. Create symbolic link

ln -s /dev/ttyACM0 /dev/serial/by-id/usb-xxxx_xxxx-xxxx

  1. Start the add-ons inside Hassio. It worked for Node-Red and Visual Studio Code but it should work for any add-on with the same error.

I hope that helps you too. Let me know.

Thanks for the tip! I followed your suggestion and it works.
As far as I know, QNAP doesn’t expose /serial/by-id, so I assume the serial/by-id/ was created by Hassio. I guess by defining a symlink in QNAP and it overwrite those created by Hassio. Then the add-on being non-privileged container is able to access them again.

There are reports saying QNAP will overwrite the symlink every time it reboots. So I have added the symlink command in the startup script.

Hey,

I am glad it worked for you too.
When I created the first time I didn’t have time to test everything properly but after reading your message, I restarted my server and lost the symlink. So, I had to add the symlink commands in a startup script too.

Agree, Hassio is creating the serial/by-id devices and somehow, the addons consider the list of devices from Hassio and not from LXC container. I believe it was a requested change since there were some issues related to using direct /dev/ttyACM0 or /dev/ttyACM1. Probably you know but you can check the list of devices in Hass.io -> System -> Hardware from Home Assistant page.

Unfortunately, I don’t know how to avoid Hassio to create those devices or change the addon configuration to not consider them.

I will keep trying to find a better solution for that, and I will keep you posted if I find one. It will be great if you let me know in case you find one too.

Thanks,
Jonas

1 Like