Does anyone know the phenomenon that a USB disk falls asleep when it is mounted by sys-usb in an AppVM? It is then not displayed in Nautilus in the AppVM and therefore cannot be used. However, the phenomenon only occurs if the hard disk designed for USB 3.0 is plugged into a USB 3.0 port. Does anyone know how to use the hard disk not only in sys-usb, but also in an AppVM?
Maybe there is some debug info in the logs in sys-usb or AppVM to which you’re attaching it?
Do you know, where to look for the log file?
You can see the logs using journalctl command.
You can also run this command in VM:
sudo journalctl -f
Then attach the USB and check the logs output during this time.
I ran
sudo journalctl -f
in sys-usb before attaching the drive to my AppVM. This is the error log:
Dec 27 18:20:26 sys-usb-dvm systemd[1]: Started User Manager for UID 0.
Dec 27 18:20:26 sys-usb-dvm systemd[1]: Started Session c4 of user root.
Dec 27 18:20:26 sys-usb-dvm kernel: sd 2:0:0:0: [sda] Synchronizing SCSI cache
Dec 27 18:20:26 sys-usb-dvm kernel: sd 2:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
Dec 27 18:20:26 sys-usb-dvm kernel: usbip-host 3-2: usbip-host: register new device (bus 3 dev 3)
Dec 27 18:20:26 sys-usb-dvm kernel: usbip-host 3-2: stub up
Dec 27 18:20:26 sys-usb-dvm mtp-probe[1645]: checking bus 3, device 3: "/sys/devices/pci0000:00/0000:00:07.0/usb3/3-2"
Dec 27 18:20:26 sys-usb-dvm mtp-probe[1645]: bus: 3, device: 3 was not an MTP device
Dec 27 18:20:28 sys-usb-dvm xdg-desktop-por[1536]: Failed to get application states: GDBus.Error:org.freedesktop.portal.Error.Failed: Could not get window list
Dec 27 18:20:48 sys-usb-dvm kernel: usbip-host 3-2: unlinked by a call to usb_unlink_urb()
The drive shuts down when trying to attach it to the AppVM.
What’s the output of this command in AppVM when you attach drive to it?
sudo journalctl -f
It says:
Dez 27 19:28:52 AppVM kernel: usb 2-1: USB controller vhci_hcd.0 does not support streams, which are required by the UAS driver.
The full output is:
Dez 27 19:28:51 AppVM qrexec-agent[2132]: 2023-12-27 19:28:51.739 qrexec-agent[2132]: qrexec-agent-data.c:244:handle_new_process_common: executed: root:QUBESRPC qubes.USBAttach dom0 (pid 2134)
Dez 27 19:28:51 AppVM qrexec-agent[2134]: pam_unix(qrexec:session): session opened for user root(uid=0) by (uid=0)
Dez 27 19:28:51 AppVM systemd[1]: Created slice User Slice of UID 0.
Dez 27 19:28:51 AppVM systemd[1]: Starting User Runtime Directory /run/user/0...
Dez 27 19:28:51 AppVM systemd[1]: Finished User Runtime Directory /run/user/0.
Dez 27 19:28:51 AppVM systemd[1]: Starting User Manager for UID 0...
Dez 27 19:28:51 AppVM systemd[2136]: pam_unix(systemd-user:session): session opened for user root(uid=0) by (uid=0)
Dez 27 19:28:51 AppVM systemd[2136]: Queued start job for default target Main User Target.
Dez 27 19:28:51 AppVM systemd[2136]: Created slice User Application Slice.
Dez 27 19:28:51 AppVM systemd[2136]: Reached target Paths.
Dez 27 19:28:51 AppVM systemd[2136]: Reached target Timers.
Dez 27 19:28:51 AppVM systemd[2136]: Starting D-Bus User Message Bus Socket.
Dez 27 19:28:51 AppVM systemd[2136]: Listening on debconf communication socket.
Dez 27 19:28:51 AppVM systemd[2136]: Condition check resulted in Sound System being skipped.
Dez 27 19:28:51 AppVM systemd[2136]: Listening on D-Bus User Message Bus Socket.
Dez 27 19:28:51 AppVM systemd[2136]: Reached target Sockets.
Dez 27 19:28:51 AppVM systemd[2136]: Reached target Basic System.
Dez 27 19:28:51 AppVM systemd[2136]: Condition check resulted in Sound Service being skipped.
Dez 27 19:28:51 AppVM systemd[2136]: Condition check resulted in Tracker metadata extractor being skipped.
Dez 27 19:28:51 AppVM systemd[2136]: Condition check resulted in Tracker file system data miner being skipped.
Dez 27 19:28:51 AppVM systemd[2136]: Reached target Main User Target.
Dez 27 19:28:51 AppVM systemd[2136]: Startup finished in 93ms.
Dez 27 19:28:51 AppVM systemd[1]: Started User Manager for UID 0.
Dez 27 19:28:51 AppVM systemd[1]: Started Session c6 of user root.
Dez 27 19:28:52 AppVM kernel: vhci_hcd vhci_hcd.0: pdev(0) rhport(0) sockfd(0)
Dez 27 19:28:52 AppVM kernel: vhci_hcd vhci_hcd.0: devid(327682) speed(5) speed_str(super-speed)
Dez 27 19:28:52 AppVM kernel: vhci_hcd vhci_hcd.0: Device attached
Dez 27 19:28:52 AppVM kernel: usb 2-1: SetAddress Request (3) to port 0
Dez 27 19:28:52 AppVM kernel: usb 2-1: new SuperSpeed USB device number 3 using vhci_hcd
Dez 27 19:28:52 AppVM kernel: usb 2-1: New USB device found, idVendor=XXXa, idProduct=0XXX, bcdDevice= 3.01
Dez 27 19:28:52 AppVM kernel: usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Dez 27 19:28:52 AppVM kernel: usb 2-1: Product: USB 3.0 Device
Dez 27 19:28:52 AppVM kernel: usb 2-1: Manufacturer: USB 3.0 Device
Dez 27 19:28:52 AppVM kernel: usb 2-1: SerialNumber: 00000000XXXX
Dez 27 19:28:52 AppVM kernel: usb 2-1: USB controller vhci_hcd.0 does not support streams, which are required by the UAS driver.
Dez 27 19:28:52 AppVM kernel: usb 2-1: Please try an other USB controller if you wish to use UAS.
Dez 27 19:28:52 AppVM kernel: usb-storage 2-1:1.0: USB Mass Storage device detected
Dez 27 19:28:52 AppVM kernel: usb-storage 2-1:1.0: Quirks match for vid XXXa pid 0XXX: 1000000
Dez 27 19:28:52 AppVM kernel: scsi host0: usb-storage 2-1:1.0
Dez 27 19:28:52 AppVM mtp-probe[2180]: checking bus 2, device 3: "/sys/devices/platform/vhci_hcd.0/usb2/2-1"
Dez 27 19:28:52 AppVM mtp-probe[2180]: bus: 2, device: 3 was not an MTP device
Dez 27 19:28:52 AppVM mtp-probe[2200]: checking bus 2, device 3: "/sys/devices/platform/vhci_hcd.0/usb2/2-1"
Dez 27 19:28:52 AppVM mtp-probe[2200]: bus: 2, device: 3 was not an MTP device
Dez 27 19:28:52 AppVM qrexec-agent[2134]: pam_unix(qrexec:session): session closed for user root
Dez 27 19:28:52 AppVM qrexec-agent[2132]: 2023-12-27 19:28:52.738 qrexec-agent[2132]: qrexec-agent-data.c:272:handle_new_process_common: pid 2134 exited with 0
Dez 27 17:29:02 AppVM xdg-desktop-por[2092]: Failed to get application states: GDBus.Error:org.freedesktop.portal.Error.Failed: Could not get window list
Dez 27 17:29:14 AppVM kernel: vhci_hcd: unlink->seqnum 40
Dez 27 17:29:14 AppVM kernel: vhci_hcd: urb->status -104
Dez 27 17:29:14 AppVM kernel: usb 2-1: SetAddress Request (3) to port 0
Dez 27 17:29:14 AppVM kernel: usb 2-1: reset SuperSpeed USB device number 3 using vhci_hcd
Maybe it’s possible to disable UAS and it’ll work but it’s just a guess:
Might be related:
Okay, here is the same issue:
But how to solve it?
Here is a guide to disabling UAS for a specific usb device, but it needs a reboot of the VM. How to disable USB Attached Storage (UAS) - Leo's Notes
You can add kernel option:
usb-storage.quirks=0bc2:3322:u
To your qube using qvm-prefs in dom0 terminal:
s=$(qvm-prefs -- vmname kernelopts) && qvm-prefs -- vmname kernelopts "usb-storage.quirks=0bc2:3322:u $s"
Lets say, my AppVM is set to the kernel option “nopat”. If I want to add an option, I have to run qvm-prefs -s AppVM kernelopts "nopat usb-storage.quirks=0bc2:3322:u
, thats all?
Yes, but you can remove -s
since it’s not needed.
There is a simple solution: Attach device to an AppVM, detach and reattach. The device will wake up. Or use a script in dom0:
device=$(qvm-usb | grep -o -P '(?<=).*(?= begin_of_device_name)' | head -1)
sleep 0.01
qvm-usb attach AppVM ${device}
sleep 1
qvm-usb detach AppVM ${device}
sleep 1
qvm-usb attach AppVM ${device}
notify-send "Lets start"