No access to USB serial device in LXC after device reboots

Jan 12, 2023
21
0
1
Hello,

i have a priveleged CT with octoprint inside. The printer is connected by USB.

If the printer is connected and I have started the LXC everything is workig fine.
If I switch off the printer and switch it on later again, the connection to the printer is not possibe anymore until I have restarted the complete LXC.

What I did:

Creating an udev rule for a symlink to the /dev/tty of the printer:
SUBSYSTEM=="tty", ATTRS{idVendor}=="2c99", ATTRS{idProduct}=="0002" SYMLINK+="ttyPrusa", KERNEL=="ttyUSB[0-9]*", MODE="0666"

which works:
Code:
ls -la /dev/tty*
lrwxrwxrwx 1 root root          7 Oct 16 18:47 /dev/ttyPrusa -> ttyACM0
crw-rw-rw- 1 root dialout 166,  0 Oct 16 18:47 /dev/ttyACM0

/etc/pve/nodes/pve/lxc/110.conf:
Code:
arch: amd64
cores: 1
hostname: octoprint
memory: 1024
net0: name=eth0,bridge=vmbr0,hwaddr=BC:24:11:36:9A:6F,ip=dhcp,type=veth
ostype: debian
rootfs: pve2:vm-110-disk-0,size=8G
swap: 512
lxc.cgroup2.devices.allow: a
lxc.cap.drop:
lxc.cgroup2.devices.allow: c 81:* rwm
lxc.cgroup2.devices.allow: c 166:* rwm
lxc.mount.entry: /dev/ttyPrusa dev/ttyUSB0 none bind,optional,create=file
lxc.mount.entry: /dev/video20 dev/video0 none bind,optional,create=file
lxc.mount.entry: /dev/video21 dev/video1 none bind,optional,create=file

if I do a ls -la /dev/ttyUSB0 in the LXC I got:

If it works:
crw-rw-rw- 1 root dialout 166, 0 Oct 16 18:34 /dev/ttyUSB0

After power on/off the printer
c--------- 0 root root 166, 0 Oct 16 19:02 /dev/ttyUSB0

Restarting octoprint with systemctl restart prusa.service
does not help, only complete reboot of LXC.
Seems as if the /dev/tty is blocked.

The log file of the node while switching on the printer looks like this:
Code:
Oct 16 20:23:37 pve kernel: usb 1-1.4.2: USB disconnect, device number 18
Oct 16 20:23:48 pve audit[1146000]: AVC apparmor="DENIED" operation="mount" class="mount" info="failed perms check" error=-13 profile="lxc-110_</var/lib/lxc>" name="/run/systemd/unit-root/" pid=1146000 comm="(install)" srcname="/" flags="rw, rbind"
Oct 16 20:23:48 pve kernel: audit: type=1400 audit(1729153428.495:171): apparmor="DENIED" operation="mount" class="mount" info="failed perms check" error=-13 profile="lxc-110_</var/lib/lxc>" name="/run/systemd/unit-root/" pid=1146000 comm="(install)" srcname="/" flags="rw, rbind"
Oct 16 20:23:49 pve kernel: usb 1-1.4.2: new full-speed USB device number 19 using xhci_hcd
Oct 16 20:23:49 pve kernel: usb 1-1.4.2: New USB device found, idVendor=2c99, idProduct=001a, bcdDevice= 1.00
Oct 16 20:23:49 pve kernel: usb 1-1.4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Oct 16 20:23:49 pve kernel: usb 1-1.4.2: Product: Original Prusa MK4S
Oct 16 20:23:49 pve kernel: usb 1-1.4.2: Manufacturer: Prusa Research (prusa3d.com)
Oct 16 20:23:49 pve kernel: usb 1-1.4.2: SerialNumber: 10589-3742441634918764
Oct 16 20:23:49 pve kernel: cdc_acm 1-1.4.2:1.0: ttyACM0: USB ACM device

is AVC apparmor="DENIED" operation="mount" class="mount"
the error message for my problem ?

Any idea what I can do ? I am not an Linux expert, more a user.

Thank you in advanced
Peter
 
Last edited:

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!