How to get the Samsung Galaxy S5 to work with MTP on Debian 9?

9,628

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

Share:
9,628

Related videos on Youtube

mYnDstrEAm
Author by

mYnDstrEAm

I care about making FOSS, cybersecurity and useful/important knowledge accessible. I learn, collaborate and develop with open source.

Updated on September 18, 2022

Comments

  • mYnDstrEAm
    mYnDstrEAm over 1 year

    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
    
    • kmacdonald
      kmacdonald over 6 years
      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 on this site may be useful. And GAD3R's answer is worth a try too (jmtpfs).
    • Gilberto
      Gilberto almost 6 years
      You can not forget: "the device's screen needs to be unlocked (for security reasons)". That's the point!
  • mYnDstrEAm
    mYnDstrEAm over 6 years
  • mYnDstrEAm
    mYnDstrEAm over 6 years
    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.
  • AmirHossein Rezaei
    AmirHossein Rezaei over 3 years
    use jmtpfs /tmp/myphone instead of mounting in ~/mtp, if you got "bad mount point error"