Ubuntu – Getting MTP enabled devices to work with Ubuntu

mtp

Since Ubuntu 13.04 storage access to external devices via MTP is supposed to work out of the box via a GVFS-MTP module.

While this question is about the Galaxy Nexus, other Android devices as well as Windows Phones and MTP enabled media players are also supported.

For troubleshooting see this anwser.


I am having quite a bit of problems getting file-transfers working over MTP with the Galaxy Nexus. I am using Kubuntu 11.10 64-bit, and this is what I have done and the results I get:

  1. Added rule for device in /etc/udev/rules.d/51-android.rules. The rule is the following and works for adb:

    SUBSYSTEMS=="usb", ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6860", MODE="0666", OWNER="leob" #Galaxy Nexus
    
  2. Restarted udev (and computer just to make sure).

Adb works, and all methods for reading from the device via MTP seems to work (I have tried mounting with mtpfs, gmtp and using the mtp-tools package directly). When I try to write to the device however, nothing I have tried works.

As an example, running mtp-newfolder test_dir 0 0 gives the following output:

libmtp version: 1.1.0
Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7510/Galaxy Tab 10.1.
Folder creation failed.
ERROR: Could not close session!

If I run mtp-folders after a failed mtp-newfolder without re-plugging the device, I get the following output:

Attempting to connect device(s)
Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7510/Galaxy Tab 10.1.
PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
LIBMTP libusb: Attempt to reset device
mtp-folders: Successfully connected
Friendly name: (NULL)
Error 1: Get Storage information failed.
Error 2: PTP Layer error 02fe: get_all_metadata_fast(): could not get proplist of all    objects.
Error 2: (Look this up in ptp.h for an explanation.)
Error 2: PTP Layer error 02fe: get_handles_recursively(): could not get object handles.
Error 2: (Look this up in ptp.h for an explanation.)
LIBMTP_Get_Storage()
: Resource temporarily unavailable
OK.

Accompanied by the following in dmesg:

[ 1000.912082] usb 2-4: reset high speed USB device number 7 using ehci_hcd
[ 1001.045877] usb 2-4: usbfs: process 3166 (mtp-folders) did not claim interface 0 before use

Does anyone have any idea about what to do?

EDIT:

I also tried the PTP mode. Again, reading works fine, but I cannot write anything to the device.

Best Answer

  • Since Ubuntu 13.04, storage access to external devices via MTP works out of the box via a GVFS-MTP module.

    Related question: Are there any plans to improve mtp support on future Ubuntu releases?

    For troubleshooting, see this answer.


    For me, it was a problem of not having the latest libmtp files on my system. So I fixed the problem and made this write-up to help others.

    Summary of the link: There was a bug in the libmtp bundled with older Ubuntu releases. This bug was already fixed in the latest source of libmtp.