Skip to content

Passthough USB to LXC Container

Info

All this commands need to be run on the Proxmox host.

Stop Container

First we need to stop the container we want to add the USB device to.

Bash
pct stop [CTID]

Get Info

First we need to get the Bus and Device ID of the USB device we want to passthrough. To do this we use the lsusb command.

Bash
lsusb

Example output:

Bash
1
2
3
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

In this case we are looking for the RTL2838 DVB-T device. What's important is the Bus and Device ID. In this case Bus 001 Device 002.

Bash
ls -l /dev/bus/usb/[BUS]/[DEVICE]
Example Output:
Bash
crw-rw---- 1 root plugdev 189, 1 Aug 29 22:07 /dev/bus/usb/001/002

Important in this output is the number 189 (1) .

  1. Save this number for later.

Add USB to LXC Container

Go to the configs of your containers

Bash
cd /etc/pve/nodes/pve/lxc

Open the config of the container you want to add the USB device to.

Bash
nano [CTID].conf

Add the following line to the config.

Warning

Replace [NUMBER] with the number you saved earlier.

And replace [BUS] and [Device] with the Bus and Device ID of the USB device you want to passthrough.

Bash
lxc.cgroup.devices.allow: c [NUMBER]:* rwm
lxc.mount.entry: /dev/bus/usb/[BUS]/[Device] dev/bus/usb/[BUS]/[Device] none bind,optional,create=file

Rights for the Container

Bash
chmod o+rw /dev/bus/usb/[BUS]/[Device]

Start Container

Bash
pct start [CTID]

Source

10. google result🙃