[SOLVED] USB Serial Device in LXC Container

silmaril

Member
Mar 24, 2021
4
0
6
Munich, Germany
I am struggling to get a USB infrared serial device to work with an unprivileged LXC container running TurnKey GNU/Linux 16.1 (Debian 10/Buster).
The device is an infrared serial converter - the only relevant info is propably that it uses an FT232 chip.

Code:
lsusb
Bus 001 Device 002: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC

ls  -l /dev/bus/usb/001/002
crw-rw-r-- 1 root root 189, 1 Mar 24 20:11 /dev/bus/usb/001/002

I created the file /etc/udev/rules.d/98-irhead.rules with this content:
Code:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="irhead", MODE="0660", GROUP="dialout
and did service udev reload && udevadm trigger.

in /etc/pve/lxc/101.conf I added
Code:
lxc.cgroup.devices.allow: c 189:* rwm
lxc.mount.entry: /dev/irhead dev/irhead none bind,optional,create=file

After restarting the container, i can see the device inside my container:
Code:
# ls -la /dev/ir*
crw-rw---- 1 nobody nogroup 189, 1 Mar 24 19:57 /dev/irhead

Great! But unfortunately I cannot read from this device, not even with sudo:
Code:
# sudo cat /dev/irhead
cat: /dev/irhead: Permission denied
I already tried to chown this device, but this also results in "Permission denied".

This looks like I am really close to my goal but I am missing some small detail to make it fully work.
What else could I try?
 
hi,

can you post output of ls -aln /dev/ir* from your container?
 
maybe you can change your udev rule to mount with 664 and see if you can read it then
 
maybe you can change your udev rule to mount with 664 and see if you can read it then

Yes, this worked so far that I can now simply type cat /dev/irhead inside the container and I see new data coming in until I press Ctrl-C.

I have no idea, why the Smartmeter adapter in iobroker cannot receive any data, though.
Something still seems to be different, but I'm not sure how much of this is the fault of the LXC environment any more...
 
Yes, this worked so far that I can now simply type cat /dev/irhead inside the container and I see new data coming in until I press Ctrl-C.
great!

I have no idea, why the Smartmeter adapter in iobroker cannot receive any data, though.
Something still seems to be different, but I'm not sure how much of this is the fault of the LXC environment any more...
if above works then it's likely another issue (which would be its own thread).

but you can always check the logs and the journals and post them in a new thread if you see something weird
 

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!