Skip to content

Instantly share code, notes, and snippets.

@AntaeusNar
Created January 24, 2023 03:29
Show Gist options
  • Select an option

  • Save AntaeusNar/47577502b7dd560d5ba1d52f558d8473 to your computer and use it in GitHub Desktop.

Select an option

Save AntaeusNar/47577502b7dd560d5ba1d52f558d8473 to your computer and use it in GitHub Desktop.
Proxmox USB to LXC Passthrough
Based off of a lot of mess and reading:
https://asokolsky.github.io/proxmox/octoprint.html
https://medium.com/@konpat/usb-passthrough-to-an-lxc-proxmox-15482674f11d
https://linuxcontainers.org/lxc/manpages/man5/lxc.container.conf.5.html
However, I think that some of the general confusion is due to not understand what all of the different steps, commands, and files are doing.
I managed to get it all to work reliably, and simply in 2 basic steps.
Step 1) Find the USB you want to pass from the host to the lxc, and make sure it doesn't move.
To find the usb you want:
root@host: lsusb
This will give you an ID number made of the vendor and the product, seperated by a colon.
Use the ID number and the known subsystem in a new udev role to symlink the usb device to any name you like.
Reload the udev roles and look run:
root@host: ls -la /dev
you will find a symlink from the orginal device to one you have named in the udev roles
Step 2) Mount that symlink in the lxc
edit /etc/pve/lxc/<lxc-id>.conf to include
lxc.mount.entry: <source in host> <destination in lxc> none bind,optional,create=file
USE THE SYMLINK YOU MADE IN STEP ONE AS THE SOURCE!!!!!!
restart the lxc and your done!
use user@lxc: lsusb and user@lxc: ls -la /dev to confirm it worked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment