How can I connect to Android via USB?

No problem

Once the USB device is attached to the running Qube, then the instructions from the OS provider that is running within the Qube need to be checked into. You can validate that the device is connected to your running Qube correctly with the command

lsusb

if you see the device there within the Qube you have told QubesOS to attach the device to, then its pretty much part of the age old ‘how to get android to work right on linux’ question. Thats a little outside of the scope of QubesOS community, but from my rusty memory I want to say
gvfs-mtp and mtpfs

1 Like

Thank you. I will check it out @Debian.

I do think that there is a problem with Qubes somewhere - never been able to get this to work.
On a f32 qube which is running some Gnome utilities gvfs-mtp-volume-monitor is running and it detects attaching the android device with file transfer enabled, adds an item into the left hand menu of Nautilus (and Dolphin if running) however selecting the item goes away for 5-10 seconds and returns with a “Could not access MTP device 001,00n” popup and deletes the menu items for the device.
The qt package “android-file-transfer” from f32 repos complains about stack corruption and core dumps.
mtp-detect fails and tried to reset the USB device and clobbers it properly.
Sounds like it should be raised as an issue??

@Eric which version of QubesOS are you running? I will drop a fresh install of same to a spare machine and see if I can recreate.

@Plexus standard 4.0 up to date with main repos (11 days ago, so not very last update that may not have flowed thru yet) - f32 up to date and sys-usb on up to date f32-min. My impression is that USB handling is a real can of worms on Qubes, and MTP was just asking too much… have always used a Windows machine and bounced transfers thru a Samba share.

Thanks @Eric

Ive only really done a lot with other USB peripherals but have not ever ran into problems. I know there can be some, as the docs state clearly that sometimes its better to pass through the controller as some devices just plain refuse to work. What im struggling with is that the device is connected to the qube successfully but that the protocol (MTP) doesnt like whats going on under the hood. Im going to have a play during the coming week with the versions you have highlighted.

@Plexus thanks for taking the time. It occurs to me that I am one of those users who stopped using Qubes updater because it always failed and gave no info. So I am behind on salt updates. Had a quick look, and did not see a 1 liner in dom0 that I can use to catch up. I have a lot of extra software and have used distro-sync to keep up to date on Fedora and have accumulated some dependency clashes along the way, that are not causing me any problems.

@Eric : I experience this error also. I click OK in the popup, use the devices widget to disconnect the smartphone from the target qube, immediately reconnect the smartphone to the target qube, and then it works. Have you tried this?

@QubicRoot thanks for the tip, I am not so lucky - tried 4 times in quick succession and nogo. Also tried disable/enable file transfer between attaches and always get the same. Must be a race condition somewhere…

[ed] The phone I am using is a Pixel running android 11 (5dec20)
There is a bug that dom0 and the devices widget get out of sync if the file transfer mode is enabled or disabled while attached to a qube (causes disconnect in both cases that does not propagate to the widget).

@Eric: Sorry to hear. I realize I was not exact above, so to be a bit more explicit:

  • Both USB and target qubes are based on Debian Minimal
  • Phone is OnePlus 3T running /e/
  • Start USB qube if not already running
  • Plug smartphone into USB
  • Change Smartphone to File Transfer
  • Use Devices widget to attach Android device to target qube - Android appears in target qube
  • Try to open Android in Nautilus in target qube - after a few seconds error window appears
  • Click OK to dismiss error window
  • Use Devices widget to detach Android device from target qube
  • Use Devices widget to attach Android device to target qube
  • Open Android in Nautilus in target qube - succeeds

HTH.

@QubicRoot just for the record, I tried a Moto running Android 8 and it does behave as you describe in my configuration. So it looks like Qubes has more problems with newer Android.

[ed] on the strength of this analysis I submitted an issue: https://github.com/QubesOS/qubes-issues/issues/6330

@Eric: FYI, the phone I’m using is on Android 10.

Does anyone know why you can’t even make file transfers between android and sys-usb on Qubes?

What is the solution?

Unfortunately the solution for me is: µSD cards. :confused:

The phone is locked… Can’t open it. Probably hardware backdoored from factory and made that way by default. What do i do and how do i transfer files to qubes?

Transferring files over network should work fine.
Something like nextcloud or syncthing can be used.

Yes but why? Is this done on purpose? Why? Android likes taking the control out of people right… No sd cards, locked phones… Cant transfer files. Or is this some qubes issue?

It is a qubes issue. I don’t know how android does this MTP thing, but i guess it does announce itself differently than for example USB sticks. There is no support for the qubes block device handling (yet).

I can transfer files from my phone attached to sys-usb. It can’t be done trying to assign it from sys-usb to some other qube.
Probably even that can be done using adb over TCP

2 Likes

Yes, you are right:

I was able to access the phone via sys-usb, but I cannot attached the phone to another qube.

Why is that? Should I make a bug report?