Tty device passthrough

I am passing a USB/Serial device /dev/ttyACM0 to the LXD container Ubuntu 18.04.

host /dev/ttyACM0 root:dialout

container: /dev/ttyACM0 root:root

sudo chown root:dialout /dev/ttyACM0 doesn’t retain permissions after reboot.
I have seen this post and @huru2000 was trying to connect a device that I am trying but G5. I was able to connect it but my problem is this device permissions.

Can you show the full command that create the LXD device?

lxc config device add mycontainer ttyACM0 unix-char path=/dev/ttyACM0

I have created a udev rule in a container and it is not processed.

udevadm monitor showed no events after udevadm control --reload-rules

Does it mean that udev rules are not supported in lxc/lxd containers?

If the primary issue is with the uid/gid of the character device in the container, then see the documentation on how to specify them at


Thank you so much for pointing me in the right direction.

lxc config device add mycontainer ttyACM0 unix-char mode=0666 gid=20 path=/dev/ttyACM0 did the trick.
(I could leave a default mode=0660 and use only gid=20 (dialout), but 0666 is a peace of mind)
It is a steep learning curve.

By the way, how can I add multiple
lxc config set mycontainer raw.lxc "lxc.cgroup.devices.allow ...

lxc config show --expanded mycontainer lists only one lxc.cgroup.devices.allow

The raw.lxc is a multiline option which means it needs to be treated a bit differently. Do it like similar to this:

printf 'lxc.cgroup.devices.allow = c 10 237\nlxc.cgroup.devices.allow = b 7 *' | lxc config set mycontainer raw.lxc -

If everything is fine, then it should appear as follows:

$ lxc config show mycontainer
  raw.lxc: |-
    lxc.cgroup.devices.allow = c 10 237
    lxc.cgroup.devices.allow = b 7 *

You can even edit directly the configuration with lxc config edit mycontainer to make it look like above.

Thanks again!

Also wrote a blog post on this,