Pass a serial PORT (not usb) through to an LXC container

tobywhiting10

Member
Jan 15, 2022
14
0
6
UK
tobywhiting10.com
I'm trying to pass through a serial port to an LXC container, not a USB serial port a hardware port
(specifically on the back of an R320 with a ups connected to it going to a container with nut server installed)

I can find plenty of guides for USB serial adapters for things like Zigbee and Z wave devices, but can't seem to get a standard serial port alone working.

Code:
# list serial devices (i need ttyS0 to be attached)
root@thinboi:~# setserial -g /dev/ttyS[0123]
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: 16550A, Port: 0x02f8, IRQ: 3
/dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4
/dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3

# (I do also have a usb serial adapter for Zigbee which can be ignored)
root@thinboi:~# dmesg | grep tty
[    0.504438] printk: console [tty0] enabled
[    2.583645] 00:02: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A
[    2.604782] 00:03: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[   13.032505] systemd[1]: Created slice system-getty.slice - Slice /system/getty.
[   18.545724] usb 2-1.2: cp210x converter now attached to ttyUSB0
[   84.170284] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
[1649070.333622] [    933]     0   933     1468      224    53248        0             0 agetty
[1649070.333749] [1207145] 100000 1207145      705      128    40960        0             0 agetty
[1649070.333752] [1207146] 100000 1207146      705       96    45056        0             0 agetty
[1649070.333756] [1207147] 100000 1207147      705       96    40960        0             0 agetty

How would I go about attaching the serial port to a CT container?

thanks
 
Add something like dev0:/dev/ttyS0,gid=THE_GROUP_NUMBER_YOU_WANT,uid=THE_USER_NUMBER_YOU_WANT to the container configuration file, to make the host serial port available in the container?
 
Can you elaborate on "THE_GROUP_NUMBER_YOU_WANT" & "THE_USER_NUMBER_YOU_WANT"
The line you provided definitely seems to come up a lot, but I could not find these values for a serial port, only usb devices
 
Can you elaborate on "THE_GROUP_NUMBER_YOU_WANT" & "THE_USER_NUMBER_YOU_WANT"
The line you provided definitely seems to come up a lot, but I could not find these values for a serial port, only usb devices
Who are the user and group on the Proxmox host (try ls -l /dev/ttyS0 for example) for the serial port device you want to make available?
The user is probably root and the container root user (with ID 100000 on the host) has ID 0 inside the container; use uid=0 in that case.
For the group, find the group ID inside the container for the same group (name) as on the host and use that number. In my case (TV tuner), the group for the dvr0 etc. was video which had ID 44 inside the Ubuntu container and I therefore used gid=44.
 

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!