Can't attach newer phone (error: Invalid argument)

(I know there’s a bunch questions abut this in the but most of them list a different error or fail to provide a solution)

Qubes version: Qubes release 4.2.3 (R4.2)
App qube os: Fedora 40
Problem: Can’t attach newer androids to an app qube. I am able to attach an android that is about 6 or so years old or older. But not the newer phones.
Current phone: Android 15 Pixel 8 running Graphene OS (this was also an issue with the stock os on another android device, so it’s not a Graphene issue)
Error: Qubes exception -= device attach failed /usr/lib/qubes/usbimport line 94
write error: Invalid argument

How to replicate:

  • Plug android in
  • Set it to file transfer
  • The USB Debugging mode is on (I’m a developer and the phone isn’t there to transfer photos, it’s there to send apps to via Android studio, so turning Debug mode is not a solution for me. Not that it would matter)
  • The device shows up in Qubes Devices ok
  • I select the device and try to attach it to an app qube.
  • Error happens: Qubes exception -= device attach failed /usr/lib/qubes/usb-import line 94
    write error: Invalid argument

(if I’m looking at the right qube (sys-usb) file (/usr/lib/qubes/usb-import) and line (94), its: ‘echo “$port” > $DEVPATH/detach’ that’s failing)

I dug around on the forum and someone told someone else to run some commands, so here’s the output
(on dom0):

qvm-usb
BACKEND:DEVID   DESCRIPTION                               USED BY
sys-usb:2-12.1  18d1:4ee7_Google_Pixel_8a_47131JEKB05269  
sys-usb:2-12.2  17a0:0002_audio-technica____AT2020_USB    work (identity=0000:0000::'?''*''*''*''*''*''*')
sys-usb:2-12.3  046d:c534_Logitech_USB_Receiver

(on sys-usb):

lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd QEMU Tablet
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 1a40:0801 Terminus Technology Inc. USB 2.0 Hub
Bus 002 Device 003: ID 17a0:0002 Samson Technologies Corp. Q1U dynamic microphone
Bus 002 Device 004: ID 046d:c534 Logitech, Inc. Nano Receiver
Bus 002 Device 031: ID 18d1:4ee2 Google Inc. Nexus/Pixel Device (MTP + debug)
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

(as you can see, my microphone is attached to that qube just fine. Like I said, when I attach an ancient android to it all works fine. It’s just the newer version, like my Pixel 8

I’ve only seen one other person report the exact same error (Correctly handle USB attach of Android device in USB debugging mode · Issue #5717 · QubesOS/qubes-issues · GitHub), but I don’t see anyone replying to them with a solution. (there was one person but their post got removed)

Pls help. My old phone is gonna kick the bucket and then I can’t test apps on my desktop anymore without getting rid of qubes.

From what I saw when I was looking at the same problem, there’s no simple solution. There are ways to set up adb specifically, but not full passthrough.
The only method that I found to use the full device with a qube is to pass a usb controller to the qube. Then plug the phone into that usb controller. The downside to that is unfortunately that you need a spare usb controller for the passthrough, not as big of a deal on desktops but much harder on laptops.

Oh no! Do you know if every port on a desktop is its own controller? And I’m guessing a hub would all be on the same controller? I don’t wanna accidentally disconnect my keyboard and mouse. Do you know if on reboot the controller pass reverts to normal?

Often there are a couple ports to each controller. For instance, the front ports are probably on one controller while the ones on the back are probably on another. I can’t guarantee that though. On a desktop, it’s easiest to get another usb pcie card and pass that through. It will not revert upon a reboot. Passing through a usb controller is the same process as passing through a gpu.
Hiding it from dom0 in grub, then running qvm-pci attach
It will permenately attach the usb controller to that qube until you detach it.

A hub would be all on the same controller. You can run lspci to see what pci devices tou have attached and how many are usb controllers.

You’re generally safe passing through most hardware. USB controller passthrough does revert back to dom0 on reboot unless the qube it’s assigned to is set to autostart. If you pass through a mouse to a qube and then restart your computer, it won’t remain attached to that qube or cause issues—it will default back to dom0 until you manually start the qube and reattach the controller. At least, that’s how it was in 4.1, I’m almost certain. Please correct me if I’m wrong or if I misunderstood you! Trust me, I once accidentally passed through my CPU to a qube lol. Instant crash, but a reboot fixed everything.

1 Like

You might be right, I’m basing all of my pcie passthrough knowledge on gpu passthrough, where the device is hidden from dom0 in grub so that it doesn’t attach to dom0. I’m not sure if that’s required for usb controllers or not. This way, dom0 never attaches to the device, and the qube has it for whenever it starts. However, if that’s not required for usb controllers, thats great.

Also, passing through your cpu is a feat! Good that you managed to fix it with a reboot.