Every time I add or remove hardware in Qubes 4.2, my qubes lose their assigned PCI devices or get the wrong ones assigned. This happens even when I just connect/disconnect SATA or NVMe drives between reboots.
Examples of what goes wrong:
sys-usb loses the keyboard controller and gets VGA instead
sys-usb suddenly contains random devices unrelated to USB
sys-net loses the network card
My storage qube gets USB controllers (2 items) instead of SATA controllers (2 items)
Sometimes I see “Unknown device” in assignments
When this happens to system qubes, the OS won’t boot. When it happens to my personal qubes, they either fail to start or don’t work properly.
My Use Case
I regularly need to connect and disconnect storage drives (SATA/NVMe) between boots for my workflow. This shouldn’t break the entire PCI device configuration, but it does.
All this makes Qubes not very useful, because in such cases I always need to reboot with system qubes auto start disabled and reassign (with help of Qubes Manager) literally all devices to qubes (sys-usb, sys-net, and my custom ones) from scratch and then reboot again.
I could understand this if it happened because of real hardware changes, but it ruins my life when I just add or remove drives.
What I Think Is Happening
It seems like PCI enumeration changes when hardware is added/removed, causing BDF addresses (Bus:Device.Function) to shift. Qubes appears to store device assignments by BDF address, so when a device that was at 00:12.0 moves to 00:13.0, my qubes get reassigned to whatever is now at the old address.