[SOLVED] Passing USB device on LXC not working after upgrade to 7.0

dksoft

Active Member
Apr 17, 2017
23
7
43
60
Dear PVE-friends,

since I upgraded to PVE 7 (LXC 4.0) I can not pass USB device to my priviledged LXC container.
Maybe someone has an idea what's wrong in the configuration from PVE 6:

On the host:
Code:
root@pve:/dev# ls -l /dev/ttyU*
crw-rw-rw- 1 root dialout 188, 0 Jul  8 11:46 /dev/ttyUSB0
crw-rw-rw- 1 root dialout 188, 1 Jul  8 11:46 /dev/ttyUSB1

Extract from client configuration:
Code:
lxc.cgroup.devices.allow: c 188:* rwm
lxc.mount.entry: /dev/ttyUSB0 dev/ttyUSB0 none bind,optional,create=file
lxc.mount.entry: /dev/ttyUSB1 dev/ttyUSB1 none bind,optional,create=file

On the client:
Code:
srv:dev# ls -l ttyU*
crw-rw-rw- 1 root dialout 188, 0 Jul  8 11:46 ttyUSB0
crw-rw-rw- 1 root dialout 188, 1 Jul  8 11:46 ttyUSB1
srv:dev# cat ttyUSB1
cat: ttyUSB1: Operation not permitted
srv:dev#
 
  • Like
Reactions: djdomi
  • Like
Reactions: djdomi
I got mine fixed by the following (needed that chown line for it to get it working)

Bash:
$ nano /etc/pve/lxc/123.conf

change or add the following lines

Bash:
lxc.cgroup2.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net dev/net none bind,create=dir

For your unprivileged container to be able to access the /dev/net/tun from your host, you need to set the owner by running

Bash:
$ chown 100000:100000 /dev/net/tun