Dec 18, 2011

How To: Fix Samsung Galaxy Nexus MTP File Transfer for Ubuntu GNU/Linux 11.10

So I've been so lucky as to have a spankin' new Samsung Galaxy Nexus phone with Android Linux "Ice Cream Sandwich" version from Verizon bestowed upon me! Yeah!

I have to tell you, I am thoroughly enjoying this phone! I'm loving it! I really like the big screen, the great on-screen keyboard, the snazzy new Ice Cream interface, and most of all the 4G Internet speed.

There was only one little surprise for me with this new phone: Having to use the Media Transfer Protocol "MTP" ( ms ft technology), and/or the Photo Transfer Protocol "PTP" to transfer files to/from the device instead of USB Block mode. Both of my previous phones, the Moto Droid and then the Droid Incredible, used USB block mode instead.

The way USB block mode works is that when you plug the device into the USB port with the cable it is simply detected as an external USB drive. This is nice because no additional applications or proprietary frameworks are needed to access the drive.

With the Samsung Galaxy Nexus however,  you have to install some additional software so you can mount the device using "MTP" Media Transfer Protocol. I think it would be nice if you had the choice of using whichever one you want.

Update 01/02/13 - Want to skip having to compile anything and simply access your device as a drive instead? Then simply install "Go-mtpfs" from +WebUpd8. See this link for the instructions.

MTP works with GNU/Linux, but it requires the installation of some extra applications to get connected to the device. One such application is called gMTP by Darran Kartaschew (aka Chewy509).


The gMTP program is a graphical utility that lets you add/delete/copy/make folders/etc. to your device via MTP. gMTP is available in the Ubuntu Software Center.

The only problem I had with gMTP, which depends upon libmtp from sourceforge.com, is that the latest libmtp hadn't been updated on my Ubuntu (11.10) yet. So, since I had the older libmtp, I was experiencing a bug where trying to copy files onto my Samsung Galaxy Nexus wasn't working properly. At least one other person was having this problem, according to this post on sourceforge.com.  To make a long story short, I posted my complaint on G+ and then magically.. +Paul Eubanks suggested that I should check into installing the newer libmtp to fix the problem. This hit the nail on the head! Thanks Paul!
 
Eventually, probably within a few weeks or months, libmtp will be updated for Ubuntu, and then you won't experience the bug I did.. But until then, here are the instructions for installing the newer libmtp, after compiling it from source.

Warning:The method outlined here is meant to be an experimental / quick fix for testing. I say this because standard conventions of installing replacement shared libraries are not used here. For some great information on the subject, please have a look at this great post by Jeremy Mac Wright.

Assuming you are still OK with making such experimental changes to your system, here are the instructions:

Step 1. Install the libusb-dev dependency package so you can build libmtp
sudo apt-get install libusb-dev
Step 2. Download the latest libmtp tar.gz from here:
http://sourceforge.net/projects/libmtp/files/libmtp/

Step 3. cd into the same directory where you downloaded the new libmtp*.tar.gz and extract the tar package:
tar xvf libmtp-1.1.1.tar.gz
Step 4. cd into the libmtp directory you just extracted , then compile and install using configure/make/make install:
cd libmtp-1.1.1/
./configure --prefix=/usr
make
sudo make install
Step 5 (maybe optional). Not sure if I needed this step or not, but if everything in the last step went well, you'll now have the 69-libmtp.rules file in the current directory, and you can copy it to /etc/udev/rules.d to ensure you can access the phone through the USB.
sudo cp 69-libmtp.rules /etc/udev/rules.d
Step 6. Install the handy gMTP Graphical MTP file access utility:
sudo apt-get install gmtp
Step 7. Try to run gMTP and see if it connects to your device. If not, then refresh things by unplugging your phone, rebooting the computer, then plugging in your phone again. Then, try to launch gMTP from the Unity/Gnome menu again, see below.




Step 8. You should see something like below when you click connect. Also you should be able to copy files to and from the device with ease.



If you want to check to ensure your computer has the newer libmtp, run this command:
ls -lah /usr/lib/libmtp*
You should see something like below.. notice the libmtp.so.9.0.1 and file date there
svanwagner@ubuntu-scythe:/usr/lib$ ls -lah libmtp.* -rw-r--r-- 1 root root 725K 2011-12-18 01:12 libmtp.a -rwxr-xr-x 1 root root 921 2011-12-18 01:12 libmtp.la lrwxrwxrwx 1 root root 15 2011-12-18 01:12 libmtp.so -> libmtp.so.9.0.1 lrwxrwxrwx 1 root root 15 2011-12-18 01:12 libmtp.so.9 -> libmtp.so.9.0.1 -rw-r--r-- 1 root root 256K 2011-08-09 06:10 libmtp.so.9.0.0 -rwxr-xr-x 1 root root 611K 2011-12-18 01:12 libmtp.so.9.0.1
Here's an extra tip: The gMTP program version 1.2.0 has the root of the filesystem "/" set for the "Download" control (by default). So if you launch the program normally, when you select a file and click "Download", you'll get an error because the program will have tried to save the file to "/", which unless you run your computer as root - is not writable by regular users. To fix this problem, you should open Edit > Preferences for gMTP, then place a checkmark by "Always show Download Path", as shown in the picture below. With this setting enabled, you'll be prompted for a location to store the file when clicking "Download", and you can pick something like Desktop or your Documents folder so you can get your files.



That's it! Now you can move files on and off your Samsung Galaxy Nexus device with ease!

Update: pointed out how the libmtp update does not help the problem with connecting  the Nexus to Banshee or even Rhythmbox.

To have Banshee see your Samsung Galaxy Nexus (Android):
  • Close out of banshee completely
  • Plug in your phone and open the root folder (select open folder on plug-in prompt)
  • Create an empty file, rename it to ".is_audio_player" (no quotes)
  • Open the Banshee Music player and it will see your device
To have Rhythmbox see your Samsung Galaxy Nexus (Android):
  • Simply enable Debugging Mode on the Phone, then attach it to the computer
Credit:
http://www.omgubuntu.co.uk/2011/01/banshee-doesnt-show-android-fix/
https://bugs.launchpad.net/ubuntu/+source/banshee/+bug/896376

Want to try a different way? See here: http://www.omgubuntu.co.uk/2011/12/how-to-easily-mount-the-galaxy-nexus-on-ubuntu-11-10-via-unity/

If you'd like to leave a comment, please do so below.


Cheers!
Shannon VanWagner
12-18-11