Is attaching USB devices to different VMs/qubes possible?

My laptop has three USB ports, and I’m thinking that for low-level access (ie. flashing Android device with fastboot, or Umbrel with Balena Etcher on SD card connected through USB adapter), I would like to connect one of the USB devices to development qube (rather than standard “sys-usb”), because I don’t wanna do this development directly on “sys-usb” (need more disk space, network access, etc – just doesn’t seem like the right approach, although it works).

However, when I connect one of the USB devices in qube/VM setting to “development” qube and remove that USB device from “sys-usb”, even after reboot, connecting anything to any of the USB ports still shows is in the GUI menu as “sys-usb:…”, and disappears when I shutdown “sys-usb”.

Is this possible? Or because maybe it’s all connected through the same PCI bus all USB ports/devices need to be attached to the same VM/qube?

You do get low level access when attaching through sys-usb. Flashing disks devices and disks should work fine.

Yes, they all go with the the pci device. But if you have more than one usb bus you don’t have to put them all in sys-usb. You could put a bus, as a pci device, in another vm.

You can check the device settings of sys-usb, it will tell you how many usb-controllers are attached, if you have more than one you can move one to the development qube.

I had to do this to get some software defined radios working, and it doesn’t work with PVH type qubes.

You haven’t said how many controllers appear in the settings window,
but I am assuming that there is more than one.

You could spend some time (not much) mapping controllers to USB ports.

  1. remove all controllers (what you call “devices”) from sys-usb
  2. restart sys-usb
  3. stop sys-usb
  4. add one controller
  5. start sys-usb
  6. insert usb device in to each port in turn and see if it appears in sys-usb.
  7. stop sys-usb

repeat steps 3-7 for all the USB devices you see in the settings

I actually recommend that everyone do this, as it will help them to
understand their machine and perhaps be able to use Qubes a little

The results may surprise you:
Sometimes there are USB devices/controllers that do not appear to map to
any USB ports.
Sometimes there are USB devices/controllers that appear to map to
the same USB ports.

The first option happens when the USB controller is used for some
internal device - perhaps a camera.
The second usually happens when a USB port supports more than one mode
of USB operation.

I don’t know if this will apply to you.

From what you say, I would guess that you have found the second option -
that you have two controllers mapping to the same ports.
This can happen if the ports support both USB2 and USB3.

In answer to your question: what you describe is possible.
Also, you can attach USB devices to different qubes.
What effect this will have will depend on what USB controllers you have
and how they are mapped to USB ports. Find this out and then you will be
able to do what you want - or perhaps not be able to do what you want,
but at least you will understand why.

I never presume to speak for the Qubes team.
When I comment in the Forum or in the mailing lists I speak for myself.
1 Like

USB/eSATA as well…

Aren’t there any simple program like USBView for linux? I just run it on Windows before installing Qubes.

It looks like there is a port for Ubuntu and other distros.

Hybrid ports like this wont be affected by this issue because they will
not have two USB devices on the same port.

1 Like

Yes, there is. You can install it with apt install usbview
It’s also available for Fedora - sudo dnf install usbview

You can get the same information from lsusb -v

Yes. It works in sys-usb but I don’t want to do things like that in sys-usb because I’m installing bunch of untrusted software and need much more disk space… So I would rather do this in throw-off dev VM, rather then directly in sys-usb.

In sys-usb settings, under devices, I see three “usb” controllers:

00:1d.0 USB controller...
00:14.0 USB controller...
00:1a.0 USB controller...

But when I remove one of those devices from sys-usb and enable under my dev VM, even after reboot, attaching to any of my three USB ports uses sys-usb and the device disappears from the menu when I kill sys-usb VM.

Maybe you are moving a controller that doesn’t control the USB ports, some internal devices can be controlled with USB.

I moved the controllers one at a time to figure out which was connected to what ports.

Look at what sort of controllers they are - Those look like x230
allocations, and 00:14.0 is an xHCI controller.
If you have dual 2.0/3.0 ports, then you may have 2 controllers
governing the same port.
You may have a USB controller allocated to an expansion port if
you have one.

I never presume to speak for the Qubes team.
When I comment in the Forum or in the mailing lists I speak for myself.

What device you are attaching to development?