You are not logged in.

#1 2022-11-07 08:04:36

boarim
Member
Registered: 2022-05-28
Posts: 29
Website

libmtp unstable with a GrapheneOS phone

I have a Pixel 6a running the latest GrapheneOS version with an up to date Arch Linux. I want to connect the phone via USB and use the MTP to transfer files back and forth. Since libmtp is already installed, and I want to keep my system clean and minimal, I prefer to stay with this simple CLI solution to pull and push files.

After having plugged the phone, a mtp-detect or mtp-connect works. However, if I try a second time, I got this error and the command hangs:

libmtp version: 1.1.20

Device 0 (VID=18d1 and PID=4ee1) is a Google Inc Nexus/Pixel (MTP).
PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
LIBMTP libusb: Attempt to reset device

I have to either manually unplug and plug again the USB cable, or deactivate and activate again the File Transfer option on the phone.

Also, I think I already have the appropriate udev rules with the android-udev package since I successfully installed GrapheneOS from Arch.


Simplicity is the ultimate sophistication. — Leonardo da Vinci (1452–1519)

Offline

#2 2022-11-07 08:29:04

d.ALT
Member
Registered: 2019-05-10
Posts: 959

Re: libmtp unstable with a GrapheneOS phone

Sanity check:
- Do you have an issues with ADBoverUSB? Does it always work properly?
- Is the USB cable good?


<49,17,III,I>    Fama di loro il mondo esser non lassa;
<50,17,III,I>    misericordia e giustizia li sdegna:
<51,17,III,I>    non ragioniam di lor, ma guarda e passa.

Offline

#3 2022-11-07 23:18:33

boarim
Member
Registered: 2022-05-28
Posts: 29
Website

Re: libmtp unstable with a GrapheneOS phone

d.ALT wrote:

Do you have an issues with ADBoverUSB? Does it always work properly?

I do not wish to enable ADB as it increases the attack surface and kind of defeat the purpose of the GrapheneOS security model.

d.ALT wrote:

Is the USB cable good?

It is brand new, and seems to be shielded. I did not have any issue to flash the phone and install the custom OS with this one. Also, I tried all the USB ports of my computer with the same result.


Simplicity is the ultimate sophistication. — Leonardo da Vinci (1452–1519)

Offline

#4 2022-11-08 07:00:58

boarim
Member
Registered: 2022-05-28
Posts: 29
Website

Re: libmtp unstable with a GrapheneOS phone

I found a workaround for now: replacing libmtp with android-file-transfer. It provides also a simple CLI.

However, this does not fix the problem with libmtp though.


Simplicity is the ultimate sophistication. — Leonardo da Vinci (1452–1519)

Offline

#5 2022-11-08 07:45:48

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,202

Re: libmtp unstable with a GrapheneOS phone

At some point maaaany years ago I gave up and switched to https://aur.archlinux.org/packages/simple-mtpfs and never looked back.
MTP is a shit protocol and every implementation beyond "connect - transfer data - disconnect" is "broken" (to some extent)
You'll not "solve" the problem w/ libmtp since this problem exists for  more that decade (ie. "ever") - this is why all those minimalistic fuse implementations exist.

Online

#6 2022-11-08 09:03:26

d.ALT
Member
Registered: 2019-05-10
Posts: 959

Re: libmtp unstable with a GrapheneOS phone

seth wrote:

MTP is a shit protocol and every implementation beyond "connect - transfer data - disconnect" is "broken" (to some extent)

Only on Windows I can rename, move, delete files and folders inside my Android Phone, sadly Linux can't... mad


<49,17,III,I>    Fama di loro il mondo esser non lassa;
<50,17,III,I>    misericordia e giustizia li sdegna:
<51,17,III,I>    non ragioniam di lor, ma guarda e passa.

Offline

#7 2022-11-08 09:16:25

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,202

Re: libmtp unstable with a GrapheneOS phone

"linux" can't because this mess isn't in the kernel.
I'm pretty sure that simple-mtpfs mounts can, because I've never encountered a device where it failed (unlike libmtp, which implements the other MTP nonsense)

Online

#8 2022-11-09 08:14:29

boarim
Member
Registered: 2022-05-28
Posts: 29
Website

Re: libmtp unstable with a GrapheneOS phone

seth wrote:

At some point maaaany years ago I gave up and switched to https://aur.archlinux.org/packages/simple-mtpfs and never looked back.
MTP is a shit protocol and every implementation beyond "connect - transfer data - disconnect" is "broken" (to some extent)
You'll not "solve" the problem w/ libmtp since this problem exists for  more that decade (ie. "ever") - this is why all those minimalistic fuse implementations exist.

Thank you for the insight. Then, it explains why android-file-transfer works seamlessly.


Simplicity is the ultimate sophistication. — Leonardo da Vinci (1452–1519)

Offline

#9 2022-11-09 15:09:31

d.ALT
Member
Registered: 2019-05-10
Posts: 959

Re: libmtp unstable with a GrapheneOS phone

seth wrote:

"linux" can't because this mess isn't in the kernel

Oh... All of MTP is via an UserSpace layer then? Damn... I miss old times when Android exposed directly Internal Storage... hmm


<49,17,III,I>    Fama di loro il mondo esser non lassa;
<50,17,III,I>    misericordia e giustizia li sdegna:
<51,17,III,I>    non ragioniam di lor, ma guarda e passa.

Offline

Board footer

Powered by FluxBB