Adding a unix-char device to a container that is not always plugged in


I am new to LXD/LXC and I looking for a way to add a device that can be deconnected before starting a container.

Namely, I have a devkit that uses a FTDI chip for serial communication. I use the command lxc config device add plnx FTDIPort unix-char source=/dev/ttyUSB1 path=/dev/ttyUSB1 and that works if the usb cable is plugged in.

However, the lxc container won’t start if the USB isn’t plugged in.

Is there a way to add the /dev/ttyUSB1 in a way that the USB doesn’t have to be plugged in for the LXC to start?

The reason I am asking is that we are in early development for the product and the tools we use need an older ubuntu version. So I am using the container to still have an up to date Ubuntu version running the tools. However, I am testing different configuration and sometimes, the USB isn’t plugged in and adding and removing the char-device every time is starting to be cumbersome.


Yes add required=false to the device’s config.

What’s more it will detect when it appears and hotplug it in to the running container.

1 Like

Thank you for your help, it worked!

1 Like