Cannot access /dev/ttyACM0 from toolbox container

I’m on SB 31, and I can’t access /dev/ttyACM0 from inside the toolbox container.

My user is a member of dialout (on the host and in the container).

I think the problem is that in the container the owner/group of /dev/ttyACM0 is nobody.

On the host:

$ ls -al /dev/ttyAC*
crw-rw----. 1 root dialout 166, 0 Dec 15 15:35 /dev/ttyACM0
crw-rw----. 1 root dialout 166, 1 Dec 15 15:37 /dev/ttyACM1

In the container:

$ ls -al /dev/ttyAC*
crw-rw----. 1 nobody   nobody 166,  0 Dec 15 15:35 /dev/ttyACM0
crw-rw----. 1 nobody   nobody 166,  1 Dec 15 15:37 /dev/ttyACM1
1 Like

How are you starting the container?
Is it a rooted or rootless container?
How are you passing the device through?

Sorry didn’t spot you’re using toolbox…

You will need to change the perms on the device, if as an example, you have something like fred:100000:65536 in your /etc/subgid file then dialout which has a GID of 18 in the container will map to something like 1000018 outside the container. Something along the lines of:
sudo setfacl -m g:100018:rw /dev/ttyACM0
on the host should allow the dialout group in the container access to the device, this ACL will not survive a reboot so you will want to setup a udev rule to add it when the device node is created.

To identify the correct group id, in the container run:
sg dialout -c ‘sleep 1000’
then on the host run:
ps -eo “user,group,args” | grep sleep
this should show the UID and GID of the process.