9

So I'm trying to share files between the Samsung Galaxy S5 with Android and my Debian9/KDE machine using MTP instead of KDE Connect.

The problem is that I keep getting:

The process for the mtp protocol died unexpectedly.

When trying to copy over files.

It also often says

No Storages found. Maybe you need to unlock your device?

I can view some of the phone's contents in dolphin after trying for a while: pressing "Allow" whenever the dialog on the phone asks for it while trying to open it in dolphin which correctly detects it as Samsung Galaxy S5.

I once could successfully copy over a bunch of images.

I already tried sudo apt-get install --reinstall libmtp-common. syslog has things like the following:

usb 1-5: usbfs: process 7907 (mtp.so) did not claim interface 0 before use
usb 1-5: reset high-speed USB device number 35 using xhci_hcd
usb 1-5: usbfs: process 7909 (mtp.so) did not claim interface 0 before use
colord-sane: io/hpmud/pp.c 627: unable to read device-id ret=-1
usb 1-5: USB disconnect, device number 35
usb 1-5: new high-speed USB device number 36 using xhci_hcd
usb 1-5: usbfs: process 7930 (mtp.so) did not claim interface 0 before use
usb 1-5: usbfs: process 7930 (mtp.so) did not claim interface 0 before use
usb 1-5: usbfs: process 7930 (mtp.so) did not claim interface 0 before use
mYnDstrEAm
  • 4,008
  • 13
  • 49
  • 108
  • 1
    The problem with `MTP` is that some phones, perhaps especially those from Samsung, implement MTP in incompatible ways. Some comments (and links) from another [samsung-device-related question](https://unix.stackexchange.com/questions/385268/access-files-on-samsung-gt-s5230-avila) on this site may be useful. And GAD3R's answer is worth a try too (`jmtpfs`). – njsg Sep 03 '17 at 08:52
  • You can not forget: "the device's screen needs to be unlocked (for security reasons)". That's the point! – Gilberto Jun 28 '18 at 13:30

1 Answers1

6

Install the jmtpfs package

apt install jmtpfs

Edit your /etc/fuse.conf as follows

# Allow non-root users to specify the allow_other or allow_root mount options.

user_allow_other

Create an udev rule. Use lsusb or mtp-detect to get the ID of your device

nano /etc/udev/rules.d/51-android.rules

with the following line:

SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666", OWNER="[username]"

Replace 04e8 and 6860 with yours , then run:

udevadm control --reload

Reconnect your device , open the terminal and run:

mkdir ~/mtp
jmtpfs ~/mtp
ls ~/mtp

sample output:

Card  Phone

To unmount your device use the following command:

fusermount -u ~/mtp

Also you can use the go-mtpfs tool:

Mount MTP devices over FUSE

mkdir ~/mtp
go-mtpfs ~/mtp

A graphical tool to mount your device : gmtp:

simple file transfer program for MTP based devices

sudo apt install gmtp
gmtp

kio-mtp

access to MTP devices for applications using the KDE Platform

GAD3R
  • 63,407
  • 31
  • 131
  • 192
  • Great - thank you; but [is there also a way to do this without having to add 'user_allow_other' to /etc/fuse.conf (for security)?](https://unix.stackexchange.com/questions/390221/alternative-to-adding-user-allow-other-to-etc-fuse-conf-for-security) – mYnDstrEAm Sep 04 '17 at 20:46
  • 2
    I really would love to mark your answer as the solution but it simply does not work for me. I hence had to use KDE Connect. After having to rerun commands many times I get errors incl: `jmtpfs ~/mtp2` `ignoring libusb_claim_interface() = -6PTP_ERROR_IO: failed to open session, trying again after resetting USB interface LIBMTP libusb: Attempt to reset device` `ls: cannot access '/home/username/mtp': Input/output error` `fusermount: failed to unmount /home/username/mtp: Device or resource busy`. Once `ls ~/mtp` showed the right thing and once I could view the files on the SD card in dolphin. – mYnDstrEAm Sep 06 '17 at 22:58
  • 1
    use jmtpfs /tmp/myphone instead of mounting in ~/mtp, if you got "bad mount point error" – AmirHossein Rezaei Dec 22 '20 at 20:04