How can I connect to Android via USB?

Hello everyone

I have an old Galaxy Note 2 and installed /e/ (www.e.foundation) on it on Ubuntu.
If I connect the USB cable to my Desktop running Qubes OS, it does not show up in info bar and I can not connect it to a Qube. It is not recognized at all. What am I doing wrong? I can connect it to Windows and Ubuntu for example. Is it possible to connect/mount it to Qubes?

Hi @linuxfan

I dont connect devices to my Qubes install, but a common reason for androids not even showing up as an available devices to Linux based OS is usually down to the setting on the android device,
With a USB cable, connect your phone to your computer.
unlock the device
On your phone notifications list, tap the “Charging this device via USB” notification.
Under “Use USB for,” select File Transfer

It should then show up as something assignable to a Qube, I would hope

Hello plexus, unfortunately that does not work. I had tried that multiple times. It does not show.

And you have a USB qube running?

@linuxfan After connecting device, and selecting “file transfer mode” then please run this in Dom0 terminal

[user@dom0 ~]$ qvm-usb

and then open a terminal in your USB qube (usually ‘sys-usb’) and run

lsusb

and return the output here. tnx

No, the USB-Qube was not running. Thx a lot!

But how can I mount the smartphone now? When I click in the file program the smartphone it tries to mount it and then it says "Unable to open MTP device 001, 007. I have installed the package mtp-tools. Do I need anything else?

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.