Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
I don't think it's Samsung.... and I think it is Android. My Honeycomb powered device is the exact same way where you have to use MTP only. I think this is how all post 2.3 Android devices are going to be. – user38662 Dec 20 '11 at 16:58

4 Answers

up vote 23 down vote accepted
+50

Okay so I found out that (in my case anyway), it was a problem of not having the latest libmtp files on my system. So I fixed the problem and made this writeup to help others: http://www.humans-enabled.com/2011/12/how-to-fix-samsung-galaxy-nexus-mtp.html Cheers! Shannon

Summary of the link:
There is a bug in the libmtp bundled with the latest Ubuntu. This bug is fixed in the latest libmtp source. Steps to build from source:

  1. sudo apt-get install libusb-dev
  2. wget http://downloads.sourceforge.net/project/libmtp/libmtp/1.1.1/libmtp-1.1.1.tar.gz
  3. tar -xvf libmtp-1.1.1.tar.gz
  4. cd libmtp-1.1.1
  5. ./configure --prefix=/usr
  6. make
  7. sudo make install
  8. sudo cp 69-libmtp.rules /etc/udev/rules.d (mayby not needed)
  9. sudo service udev restart
share|improve this answer
1  
The issue seems to be fixed in packages for Ubuntu 12.04, so those can be used if you are brave enough to do it. I grabbed them from launchpad.net/ubuntu/+source/libmtp/1.1.1-1 and created the packages for system (and the same for gmtp) – Tatu Lahtela Dec 20 '11 at 7:32
@Shannon. Thanks. This is the best solution. Wish I had found it first. – MountainX Jan 25 '12 at 1:25
2  
rhythmbox still freezes and gives errors (LIBMTP_Send_Representative_Sample(): could not get object info.) when trying to access the nexus, and nautilus gives: Unable to mount Galaxy Nexus; Error initializing camera: -60: Could not lock the device. Poo. – waspinator Jul 14 '12 at 15:28

Have you tried Bilal Akhtar suggestion at omgubuntu?

Connecting your Ice Cream Sandwich phone or tablet to Ubuntu for file access

First up, install the necessary tools:

sudo apt-get install mtp-tools mtpfs

Now, connect your Galaxy Nexus to your computer. On your phone, open up the notification drawer, and click on “USB Connection type”. Make sure that MTP is selected.

enter image description here

Then, run these commands:

mtp-detect | grep idVendor

mtp-detect | grep idProduct

You shall get an output like this:

enter image description here

Now, run this commands:

gksu gedit /etc/udev/rules.d/51-android.rules

A gedit window should open up. Type this text in it, all in a single line:

SUBSYSTEM==”usb”, ATTR{idVendor}==”VENDORID”, ATTR{idProduct}==”PRODUCTID”, MODE=”0666″

Replace VENDORID with the idVendor you had noted down earlier. Similarly, replace PRODUCTID with the idProduct you had noted down. In my case, they were 04e8 and 685c respectively, but they might have been different for you. Also, remember to re-type the quotes in the line after you’ve copied and pasted it, otherwise udev may output an error. If you’re in doubt, you can copy the same line from this pastebin instead and then replace PRODUCTID and VENDORID as needed.

Save and close the file. Then, disconnect your phone and run these commands:

sudo service udev restart

sudo mkdir /media/GalaxyNexus

sudo chmod a+rwx /media/GalaxyNexus

sudo adduser YOURUSERNAME fuse

Replace YOURUSERNAME with your Ubuntu user name. Now, run this command:

gksu gedit /etc/fuse.conf

In the Gedit window, remove the # at the beginning of the last line (the one that begins with “#user_allow_other”) like this:

enter image description here

You’re almost done! Now, restart your computer, and then run these three commands :

echo “alias android-connect=\”mtpfs -o allow_other /media/GalaxyNexus\”" >> ~/.bashrc

 

echo “alias android-disconnect=\”fusermount -u /media/GalaxyNexus\”" >> ~/.bashrc

 

source ~/.bashrc

Again, do re-type the quotes in each command after you’ve copied, otherwise the command won’t work.

Connect your phone again, and then make sure your phone is using MTP, then run this command:

android-connect

Voila! You can now browse your Android phone contents using Nautilus. Just fire up the file manager, and then in the side bar click GalaxyNexus to browse your phone contents just like you would do with a USB stick. You can also add, remove and modify files just like a normal file system.

To safely remove the phone, just run the command:

android-disconnect

From now onward, you just need to run android-connect to mount your phone and then android-disconnect to safely remove your phone. Everything else should be handled automatically. I tried many ways of getting the mount and unmount to happen automatically on cable connect, but this was the best solution I could come up with.

These two commands won’t require root permissions to run. All users who are members of the fuse user group should be able to run these commands without root access.

That’s it! You’ve successfully connected your Ice Cream Sandwich phone to your Ubuntu computer. The process may be long for a newbie, but I’m sure someone will come around and make a GUI for all of this so that everything happens smoothly :)

share|improve this answer
Yes, already tried most ways of using the mtpfs-tools. As Shannon found out, it was apparantly a bug in libmtp. – Leo Dec 19 '11 at 8:35
It works, but I have some questions. 1. What does that udev configuration do, why doesn't it work without it? 2. By what magic does it know which device to mount when you do mtpfs, or does it simply support only 1 connected device at a time? – Bart van Heukelom Mar 23 '12 at 21:53
Also when copying a large file (with Nautilus) it will appear to copy very fast (50MB/s) but during that time it doesn't copy anything. Only when the progress bar hits 100% it will start the real copy (and the interface hangs). Maybe some kind of buffer option can be disabled? – Bart van Heukelom Mar 23 '12 at 22:06
Unfortunately I don't know the answers you want. I'm sorry. – desgua Mar 24 '12 at 2:10
Did all of this, but getting this message when trying to android-connect: fusermount: failed to open /etc/fuse.conf: Permission denied fusermount: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf even though I edited /etc/fuse.conf as instructed. – dmt0 May 29 '12 at 2:41
show 1 more comment

All programs based on libmtp still seem to have issues with the Galaxy Nexus (as of libmtp 1.1.3). Programs based on gphoto2 work for me.

Personally I'm using gphotofs, available in a package of the same name.

Use gphotofs ~/mymountpoint to mount, then fusermount -u ~/mymountpoint to unmount when you're done.

share|improve this answer
Just upgraded to 12.04 and it seems that libmtp 1.1.3 is not working correctly like you said. Will have to investigate this a bit more. gphotofs is working perfectly though so thanks for the suggestion! – Leo Sep 20 '12 at 6:50
Using gphotofs leaves me with a single directory that is empty. – Nathan Osman Feb 21 at 2:43

Just a small workaround, connect your ICS based phone with good old MASS STORAGE http://forum.xda-developers.com/showthread.php?t=1556367

adb install UMS1.0.apk
share|improve this answer
1  
Whilst this is a good solution for some phones, this only works if a phone has a seperate sd-card. In relation to the original question this wouldn't work with the Galaxy Nexus. – coversnail Apr 1 '12 at 10:10

protected by Community Apr 12 '12 at 18:43

This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.

Not the answer you're looking for? Browse other questions tagged or ask your own question.