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

dksoft

Active Member
Apr 17, 2017
23
7
43
59
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
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!