USB persistent attachment

Original forum link
https://forum.qubes-os.org/t/32420
Original poster
Solène R
Editors
parulin
Created at
2025-02-21 13:46:42
Last wiki edit
2025-02-22 18:14:31
Revisions
2 revisions
Posts count
10
Likes count
10

Introduction

Not so long ago, a new feature was added for USB management: being able to automatically attach devices connected to a given USB port to a given qube.

This is highly specific as you can imagine, it does not filter by device, only by USB port.

This is slightly documented here https://www.qubes-os.org/doc/how-to-use-usb-devices/ but it's very light in my opinion. I may write a PR to update the official doc with the guide if people find it ok.

USB port identification

First, you need to have plugged any USB device on the USB port you want to use. Then, you need to identify the USB port identifier from dom0:

[user@dom0 ~]$ qvm-usb list --all
BACKEND:DEVID        DESCRIPTION                                           USED BY
sys-usb:3-1.3      0bda:8153_Realtek_USB_10_100_1000_LAN_000001
sys-usb:4-10       8087:0026_8087_0026
sys-usb:4-6.2      041d:01e5_025f_HD_Pro_Webcam_C920_6E2F6104
sys-usb:4-6.5      0bda:1100_Realtek_HID_Device
sys-usb:4-7        5986:9102_Sonix_Technology_Co.__Ltd._BisonCam_NB_Pro

Attach

Secondly, you need to tell Qubes OS which qube should receive USB devices connected to a given port.

qvm-usb attach --persistent $MyQube sys-usb:4-6.2

Each time the qube $MyQube will start, the device on port 4-6.2 will be attached to it (a webcam is currently connected to this port). The qube won’t be able to start if no device is plugged, or if the usb port is attached to another qube.

Be aware that if the qube $MyQube is running, anything you connect to that USB port will be attached to the qube. It does not filter by device, but by port.