Connect USB to Windows standaloneVM

Hey!
I can not connect USB drives or an android smartphone to my Windows 10 standaloneVM (Qubes 4.1).

If I try to connect a flash drive it shows connected, but I can see nothing in the WindowsVM.

If I try to connect the phone, I get:

Device attach failed: sh: write error: Invalid argumentAttach timeout, check kernel log for details. /usr/lib/qubes/usb-import: line 1: hostname: not foundVM: "" File: "/usr/lib/qubes/usb-import" Version Control: https://github.com/QubesOS/qubes-app-linux-usb-proxy/blob/master/src/usb-import

Best regards
qun

Sorry, forgot to mention it. I made that steps. So this issue came after that.

Does it work with non-Windows qubes? Does it work inside sys-usb?

I can connect flash drives, but the android shows me an error if I want to choose “file transfer” as USB-connection (for any of the VMs). So it seems to be an issue with the android connection in general.

What exactly did you try from that topic? It’s a huge one with a lot of tips?

I guess it would help if you could give us step-by-step what are you doing, what are you trying to achieve, how you are trying to achieve it and where you are stuck, so we could easily reproduce it and eventually help you. Every detail is important. Just describe it.
For example, did you try to attach it as a block device or a usb device, did you try it via device widget, or via terminal, did you use --persistent option, etc, etc…

I want to attach an android phone (Xiaomi Redmi Note 9 Pro) to the Windows standaloneVM (installed in Qubes 4.1, with the USB-integration steps you mentioned above and with installed qubes-tools)

I tried to attach it via device widget and via terminal, with the same error above. I didn’t use the --persistent option for I don’t know, what it’s for.

I can attach it to the linux mint machine on another laptop, but not here on qubes.

How can I attach it as block or usb device and what is the difference?

Please red this, it should give you an idea what info and how to give and maybe even to help to resolve the issue.

don’t really know how it can help me with my issue.
The phone is mounted on sys-usb:4-1.

With no more info the only thing I can tell is that it looks that there could be a problem with qubes-usb-proxy, or/and the VM you are trying to attach phone to.

Sorry I couldn’t be of a more help with the info you provided us with, I’ve bee using Qubes only since last November and invested a lot of time to learn it, and as I can see you are much longer here, and it can’t work out of the box, mostly because it is security oriented.

Then I guess you need to make it work without Windows first. sys-usb should behave in the same way as a regular Linux OS, so Android phone should be recognized. See this for details: Connecting GrapheneOS phone to Qubes.

See also:

that’s the point, I should get it work with “normal” (linux) VMs.

Thanks for the links above. There is rather much stuff that I don’t really understand :smiley: but I see, that I can connect my Graphene Phone (also the mentioned Xiaomi) to the sys-usb and can browse it with nautilus. But I can not browse it on any other VM.

The device widget shows me the mounted phone in the case of Graphene (trying to mount xiaomi get the mentioned error and no mounted phone in the device widget), but the VM (except the sys-usb) shows nothing.

@enmus no problem, I understand what you mean. The thing is, I use Qubes for a rather long time, but I have no time (and for some things no brain) for understanding some deeper things (deeper for me). I don’t really know what info I can give to you.

You could give us the output of:
$ lsusb
$ lsusb -t
then, while attaching phone to a qube the output of
sudo journalctl -f
until attaching is rejected
as well as
sudo dmesg | grep “usb”

all from sys-usb qube.

Are there any -71, -94, -110 error codes? Search Google on them, etc…

Also, I read that connecting phone via TCP is a great security risk, but cannot elaborate further.

lsusb on sys-usb:
Bus 004 Device 004: ID 2717:ff08 Xiaomi Inc. Redmi Note 3 (ADB Interface)

lsusb -t on sys-usb:

/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M    |__ Port 2: Dev 5, If 0, Class=Vendor Specific Class, Driver=, 480M    |__ Port 4: Dev 2, If 10, Class=CDC Data, Driver=cdc_acm, 480M    |__ Port 4: Dev 2, If 1, Class=Communications, Driver=cdc_acm, 480M    |__ Port 4: Dev 2, If 8, Class=Communications, Driver=cdc_wdm, 480M    |__ Port 4: Dev 2, If 6, Class=Communications, Driver=cdc_mbim, 480M    |__ Port 4: Dev 2, If 4, Class=CDC Data, Driver=cdc_acm, 480M    |__ Port 4: Dev 2, If 2, Class=CDC Data, Driver=cdc_acm, 480M    |__ Port 4: Dev 2, If 0, Class=Communications, Driver=, 480M    |__ Port 4: Dev 2, If 9, Class=Communications, Driver=cdc_acm, 480M    |__ Port 4: Dev 2, If 7, Class=CDC Data, Driver=cdc_mbim, 480M    |__ Port 4: Dev 2, If 5, Class=Communications, Driver=cdc_wdm, 480M    |__ Port 4: Dev 2, If 3, Class=Communications, Driver=cdc_acm, 480M/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M        |__ Port 1: Dev 3, If 0, Class=Chip/SmartCard, Driver=, 12M/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M    |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 480M

sudo journalctl -f while attaching the phone on sys-usb:

Apr 20 08:50:32 sys-usb systemd[2953]: Started Daily Cleanup of User's Temporary Directories. Apr 20 08:50:32 sys-usb systemd[2953]: Reached target Paths. Apr 20 08:50:32 sys-usb systemd[2953]: Reached target Timers. Apr 20 08:50:32 sys-usb systemd[2953]: Starting D-Bus User Message Bus Socket. Apr 20 08:50:32 sys-usb systemd[2953]: Listening on Multimedia System. Apr 20 08:50:32 sys-usb systemd[2953]: Condition check resulted in Sound System being skipped. Apr 20 08:50:32 sys-usb systemd[2953]: Starting Create User's Volatile Files and Directories... Apr 20 08:50:32 sys-usb systemd[2953]: Finished Create User's Volatile Files and Directories. Apr 20 08:50:32 sys-usb systemd[2953]: Listening on D-Bus User Message Bus Socket. Apr 20 08:50:32 sys-usb systemd[2953]: Reached target Sockets. Apr 20 08:50:32 sys-usb systemd[2953]: Reached target Basic System. Apr 20 08:50:32 sys-usb systemd[1]: Started User Manager for UID 0. Apr 20 08:50:32 sys-usb systemd[2953]: Reached target Main User Target. Apr 20 08:50:32 sys-usb systemd[2953]: Startup finished in 1.540s. Apr 20 08:50:32 sys-usb systemd[1]: Started Session c10 of User root. Apr 20 08:50:33 sys-usb audit: BPF prog-id=54 op=LOAD Apr 20 08:50:33 sys-usb audit: BPF prog-id=55 op=LOAD Apr 20 08:50:33 sys-usb systemd[1]: Starting Hostname Service... Apr 20 08:50:34 sys-usb audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-hostnamed comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' Apr 20 08:50:34 sys-usb systemd[1]: Started Hostname Service. Apr 20 08:50:35 sys-usb kernel: usbip-host 4-2: usbip-host: register new device (bus 4 dev 7) Apr 20 08:50:35 sys-usb kernel: usbip-host 4-2: stub up Apr 20 08:50:35 sys-usb kernel: usbip-host 4-2: USB disconnect, device number 7 Apr 20 08:50:35 sys-usb kernel: usbip-host 4-2: recv a header, 0 Apr 20 08:50:35 sys-usb qrexec-agent[2945]: 2022-04-20 08:50:35.568 qrexec-agent[2945]: process_io.c:187:process_io: vchan connection closed early (fds: -1 -1 25, status: -1 -1) Apr 20 08:50:35 sys-usb kernel: usb 4-2: new high-speed USB device number 8 using xhci_hcd Apr 20 08:50:36 sys-usb kernel: usb 4-2: New USB device found, idVendor=2717, idProduct=ff08, bcdDevice= 4.14 Apr 20 08:50:36 sys-usb kernel: usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 Apr 20 08:50:36 sys-usb kernel: usb 4-2: Product: ATOLL-AB-IDP _SN:06B1B783 Apr 20 08:50:36 sys-usb kernel: usb 4-2: Manufacturer: Xiaomi Apr 20 08:50:36 sys-usb kernel: usb 4-2: SerialNumber: 4d918746 Apr 20 08:50:36 sys-usb mtp-probe[3019]: checking bus 4, device 8: "/sys/devices/pci0000:00/0000:00:08.0/usb4/4-2" Apr 20 08:50:36 sys-usb mtp-probe[3019]: bus: 4, device: 8 was not an MTP device Apr 20 08:50:36 sys-usb mtp-probe[3029]: checking bus 4, device 8: "/sys/devices/pci0000:00/0000:00:08.0/usb4/4-2" Apr 20 08:50:36 sys-usb mtp-probe[3029]: bus: 4, device: 8 was not an MTP device Apr 20 08:50:36 sys-usb mtp-probe[3056]: checking bus 4, device 8: "/sys/devices/pci0000:00/0000:00:08.0/usb4/4-2" Apr 20 08:50:36 sys-usb mtp-probe[3056]: bus: 4, device: 8 was not an MTP device Apr 20 08:50:36 sys-usb qrexec-agent[2947]: pam_unix(qrexec:session): session closed for user root Apr 20 08:50:36 sys-usb kernel: kauditd_printk_skb: 4 callbacks suppressed Apr 20 08:50:36 sys-usb kernel: audit: type=1106 audit(1650437436.982:258): pid=2947 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:session_close grantors=pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask,pam_lastlog acct="root" exe="/usr/lib/qubes/qrexec-agent" hostname=? addr=? terminal=? res=success' Apr 20 08:50:36 sys-usb audit[2947]: USER_END pid=2947 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:session_close grantors=pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask,pam_lastlog acct="root" exe="/usr/lib/qubes/qrexec-agent" hostname=? addr=? terminal=? res=success' Apr 20 08:50:37 sys-usb audit[2947]: CRED_DISP pid=2947 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:setcred grantors=pam_rootok acct="root" exe="/usr/lib/qubes/qrexec-agent" hostname=? addr=? terminal=? res=success' Apr 20 08:50:37 sys-usb kernel: audit: type=1104 audit(1650437437.030:259): pid=2947 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:setcred grantors=pam_rootok acct="root" exe="/usr/lib/qubes/qrexec-agent" hostname=? addr=? terminal=? res=success' Apr 20 08:50:37 sys-usb qrexec-agent[2945]: 2022-04-20 08:50:37.501 qrexec-agent[2945]: qrexec-agent-data.c:272:handle_new_process_common: pid 2947 exited with 0 Apr 20 08:50:37 sys-usb systemd[1]: session-c10.scope: Deactivated successfully. 

sudo dmesg | grep “usb” on sys-usb:

Device= 4.14 [  503.329510] usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [  503.329579] usb 4-2: Product: ATOLL-AB-IDP _SN:06B1B783 [  503.329627] usb 4-2: Manufacturer: Xiaomi [  503.329663] usb 4-2: SerialNumber: 4d918746 [ 1158.883284] usb 4-2: USB disconnect, device number 3 [ 1734.639277] usb 4-2: new high-speed USB device number 4 using xhci_hcd [ 1734.767885] usb 4-2: New USB device found, idVendor=2717, idProduct=ff08, bcdDevice= 4.14 [ 1734.767969] usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 1734.768039] usb 4-2: Product: ATOLL-AB-IDP _SN:06B1B783 [ 1734.768155] usb 4-2: Manufacturer: Xiaomi [ 1734.768195] usb 4-2: SerialNumber: 4d918746 [ 1768.804740] usbcore: registered new device driver usbip-host [ 1768.870842] usbip-host 4-2: usbip-host: register new device (bus 4 dev 4) [ 1768.878163] usbip-host 4-2: stub up [ 1769.013809] usbip-host 4-2: USB disconnect, device number 4 [ 1769.014004] usbip-host 4-2: recv a header, 0 [ 1769.317161] usb 4-2: new high-speed USB device number 5 using xhci_hcd [ 1769.448174] usb 4-2: New USB device found, idVendor=2717, idProduct=ff08, bcdDevice= 4.14 [ 1769.448259] usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 1769.448329] usb 4-2: Product: ATOLL-AB-IDP _SN:06B1B783 [ 1769.448399] usb 4-2: Manufacturer: Xiaomi [ 1769.448437] usb 4-2: SerialNumber: 4d918746 [ 2146.283661] usbip-host 4-2: usbip-host: register new device (bus 4 dev 5) [ 2146.318624] usbip-host 4-2: stub up [ 2146.435749] usbip-host 4-2: USB disconnect, device number 5 [ 2146.436234] usbip-host 4-2: recv a header, 0 [ 2146.739116] usb 4-2: new high-speed USB device number 6 using xhci_hcd [ 2146.873550] usb 4-2: New USB device found, idVendor=2717, idProduct=ff08, bcdDevice= 4.14 [ 2146.873635] usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 2146.873706] usb 4-2: Product: ATOLL-AB-IDP _SN:06B1B783 [ 2146.873754] usb 4-2: Manufacturer: Xiaomi [ 2146.873815] usb 4-2: SerialNumber: 4d918746 [ 2230.298667] usbip-host 4-2: usbip-host: register new device (bus 4 dev 6) [ 2230.322652] usbip-host 4-2: stub up [ 2230.443406] usbip-host 4-2: USB disconnect, device number 6 [ 2230.443688] usbip-host 4-2: recv a header, 0 [ 2230.746181] usb 4-2: new high-speed USB device number 7 using xhci_hcd [ 2230.881231] usb 4-2: New USB device found, idVendor=2717, idProduct=ff08, bcdDevice= 4.14 [ 2230.881262] usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 2230.881287] usb 4-2: Product: ATOLL-AB-IDP _SN:06B1B783 [ 2230.881304] usb 4-2: Manufacturer: Xiaomi [ 2230.881326] usb 4-2: SerialNumber: 4d918746 [ 2557.349106] usbip-host 4-2: usbip-host: register new device (bus 4 dev 7) [ 2557.375864] usbip-host 4-2: stub up [ 2557.507926] usbip-host 4-2: USB disconnect, device number 7 [ 2557.508095] usbip-host 4-2: recv a header, 0 [ 2557.811143] usb 4-2: new high-speed USB device number 8 using xhci_hcd [ 2557.943646] usb 4-2: New USB device found, idVendor=2717, idProduct=ff08, bcdDevice= 4.14 [ 2557.943787] usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 2557.943858] usb 4-2: Product: ATOLL-AB-IDP _SN:06B1B783 [ 2557.943926] usb 4-2: Manufacturer: Xiaomi [ 2557.943984] usb 4-2: SerialNumber: 4d918746 

TCP? In which way has TCP something to do with attaching USB on qubes?

There’s a way to connect the phone via adb over TCP, but it has security implications.

Did you simpy try to deactivate USB debugging options and then tried to attach the phone to other (Linux for now) qube from sys-usb?

with deactivated USB debugging it connects, but can not open the device.
lsusb on the VM to which is the device connected shows, that the device IS conntected via MTP.

Maybe your android create multiple USB devices and you need to pass them all to another VM simultaneously (maybe even with --persistent so all devices will be connected simultaneously at the VM boot time)?
Just a thought.

i get no connection with usb debugging, as it seems the only solution is to install needed adb-fastboot in sys-usb or to connect the usb-port directly to the VM. I got it with the second way.