Sharing same USB port (device) between Guests?

KenHorse

Member
Mar 18, 2022
60
0
11
69
I have a need for the same USB > serial adapter (FTDI based if that makes any difference) between 2 different VMs. I've tried through the usual process (assigning the adapter in each VM) but that doesn't allow both access - only one gets to use it.

Is there a way?
 
You cannot connect a single USB device to two VMs at the same time, just as you can't with physical machines.
You could use different USB ports and switch the USB device manually (by uinplugging and plugging) ibetween the two. Or use a physical USB switch (or USB Hub Based KVM) connected to both ports to do the switching with the press of a button. Depending on the price, maybe a second identical USB device might be cheaper.
Or use a single port and enable USB hotplug on both VMs and remove the USB device from one VM configuration and add it to the other VM configuration to switch (and the other way around to switch back). That can probably be scripted via the Proxmox API or a clever command-line script over SSH.
 
1 device = 1 vm. or something with an arduino and send udp packet over network.
 
This is a remote application where only one VM will ever be active at any given time (1 VM is Debian, the other is Windows). I was hoping to keep it simple ;)
 
This is a remote application where only one VM will ever be active at any given time (1 VM is Debian, the other is Windows). I was hoping to keep it simple ;)
If you stop one VM before starting the other, then there should be no problem. Can you explain in more detail what steps to take to make it fail to work?
Alternatlively, make it one VM that dual boots either into Debian or into Windows ;-)
 
One VM cannot be stopped (running a mission critical program under Debian but not always using the USB > serial device) while the other one (Windows) only needs to run while actually being used to communicate serially (not frequently).

I think I answered my own question....
 
Try enabling USB hotplug and you can take the USB device temporarily from the always running Debian and start the Windows VM.
Or maybe you can separate the "mission critical" part of the Debian VM from the "needs to use USB-to-serial" part of the Debian VM? It looks like the USB-to-serial is not critical (all the time), as you said.
Or maybe you can create a VM that does two virtual serial interfaces to one physical serial interface (via the USB device). Both Debian and Windows can just connect via to their own virtual serial device (UNIX socket piped from one VM to another) and the third VM can do the actual switchting from one of the two sources to the USB device.

Maybe there are more possibilities when you look at the flow the data, instead of focusing on the one single USB-to-serial device.
 
Not sure if thread opener has the same idea like me. I would like to pass a usb device connected on host1 to another host2.
Internally that should work with usbip or someting.
Is this supported by Proxmox somehow?
 

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!