Wednesday, December 21, 2011

Galaxy Nexus Enable MTP File Transfer in Ubuntu Linux

The packages for MTP in the Ubuntu 11.10 repos are built from outdated source and are the cause of most of the MTP file transfer woes. I've gone ahead and removed the updated packages from the Ubuntu 12.04 repos both 32 & 64 bit versions. These have to be installed in a certain order to avoid issues so install as follows:


sudo dpkg -i libmtp9_1.1.1-1_amd64.deb
sudo dpkg -i libmtp-common_1.1.1-1_all.deb
sudo dpkg -i libmtp-runtime_1.1.1-1_amd64.deb
sudo dpkg -i mtp-tools_1.1.1-1_amd64.deb

Final package that needs to be install:

sudo apt-get install -y mtpfs

*After install make sure that the following packages are installed 
mtp-tools libmtp-runtime libmtp9 libmtp-common mtpfs
  • First we must create a mount point for your Galaxy Nexus:
sudo mkdir /media/Nexus
  • Now we must assign the proper read/write privileges to the directory:
sudo chmod 775 /media/Nexus
  • We have to create a file the enables your Linux system to see your Galaxy Nexus:
sudo gedit /etc/udev/rules.d/99-android.rules
  • Copy & Paste the following into the file then save and close:
#Acer
SUBSYSTEM=="usb", SYSFS{idVendor}=="0502", MODE="0666"
#Dell
SUBSYSTEM=="usb", SYSFS{idVendor}=="413c", MODE="0666"
#Foxconn
SUBSYSTEM=="usb", SYSFS{idVendor}=="0489", MODE="0666"
#Garmin-Asus
SUBSYSTEM=="usb", SYSFS{idVendor}=="091E", MODE="0666"
#Google
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
#HTC
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
#Huawei
SUBSYSTEM=="usb", SYSFS{idVendor}=="12d1", MODE="0666"
#Kyocera
SUBSYSTEM=="usb", SYSFS{idVendor}=="0482", MODE="0666"
#LG
SUBSYSTEM=="usb", SYSFS{idVendor}=="1004", MODE="0666"
#Motorola
SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", MODE="0666"
#Nvidia
SUBSYSTEM=="usb", SYSFS{idVendor}=="0955", MODE="0666"
#Pantech
SUBSYSTEM=="usb", SYSFS{idVendor}=="10A9", MODE="0666"
#Samsung
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"
#Sharp
SUBSYSTEM=="usb", SYSFS{idVendor}=="04dd", MODE="0666"
#Sony Ericsson
SUBSYSTEM=="usb", SYSFS{idVendor}=="0fce", MODE="0666"
#ZTE
SUBSYSTEM=="usb", SYSFS{idVendor}=="19D2", MODE="0666"

  • Now we must make the file executable:
sudo chmod +x /etc/udev/rules.d/99-android.rules
  • Download and unzip the mount/unmount scripts I've written for you in your home directory:
  • Make the scripts executable:
sudo chmod +x mount-nexus.sh unmount-nexus.sh
  • Enable MTP transfer on your Galaxy Nexus by entering into Settings-Device-Storage select Menu in the bottom right hand corner then "USB computer connection" make sure "Media device (MTP)" is selected.
  • Connect the Galaxy Nexus to your computer:  *USB Debugging must be disabled*
  • With the mount and unmount scripts in your home directory execute the mount command by typing the following:
./mount-nexus.sh
  • Execute the unmount command by typing the following:
./unmount-nexus.sh

30 comments:

  1. guide followed to the letter until the end but when I give the command
    . / mount-nexus.sh
    nexux the partition appears on your desktop but if I double click it I get this message with the ban and says that the file type is unknown: (
    Soluziuoni please: P
    Sorry for my English but I am Italian and I do not know English so I tried to use google translate xD

    ReplyDelete
  2. @killJoy I'm pretty sure you have the Nexus set to connect as "Camera" (PTP) not "Media device" (MTP)

    ReplyDelete
  3. ok man risolto grazie thanks

    ReplyDelete
  4. Followed everything exactly, however, when I try to mount I get "command not found"

    ReplyDelete
  5. @Zach Are the scripts in your home folder and are you trying to execute them from the home folder? Did you identify them as executables by "chmod +x"?

    ReplyDelete
  6. Hi,
    I'm under Ubuntu 11.10.
    I was experiencing a huge speed issue when I used PTP. So, I've been looking for advices and found another site before yours explaining how to mount GN as an MTP device . Same speed problem. So I've found yours, followed each step thoroughly... but the speed problem was the same... I did it twice, but the result was still be the same (But no pb under XP on anorther computer... arrrgh !!! :) ) My usb slots work correctly : I used them all with my GN and usb keys.

    Have you got any suggestion ?

    ReplyDelete
  7. Did everything you said till I got to:
    ./mount-nexus.sh
    However I got the following error:
    fuse: mountpoint is not empty
    fuse: if you are sure this is safe, use the 'nonempty' mount option
    Not sure what exactly that means...and what is wrong.
    Do you have any idea?

    ReplyDelete
  8. Hi everbody,
    I've found kind of a solution that could be usefull to some of you... At least, for me it worked to fix my speed issues.
    Here's the link :
    http://www.humans-enabled.com/2011/12/how-to-fix-samsung-galaxy-nexus-mtp.html
    May be a tuto mixing all this shall be made by someone (I might write one in french if I've got time enough) ;)
    Hope it can help.

    ReplyDelete
  9. worked perfectly in Linux Mint 12 for me, thanks!

    ReplyDelete
  10. I'm having a big problem doing this in Mint 12.

    When I enter this command:

    sudo gedit /etc/udev/rules.d/99-android.rules


    It opens a window where I can copy and paste as you instruct and then save the file, however I get this response in the terminal. As you can imagine, plugging my phone in and running the mount/unmount files does not work:

    (gedit:12648): Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.WFJR7V': No such file or directory

    (gedit:12648): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory

    (gedit:12648): Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.2MAV7V': No such file or directory

    (gedit:12648): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory

    (gedit:12648): Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.MM7I7V': No such file or directory

    (gedit:12648): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory

    Any ideas? I'm by no means a Linux expert yet but I followed your directions exactly with one exception. I had some of the MTP packages installed already, however, I removed them completely before trying your method. I'm hoping that you maybe have a little insight for me. It'd be nice to be able to mount this thing. Ugh, why did they have to use MTP?

    Thanks in advance!

    ReplyDelete
  11. Hey Dmoralize, I got that same error, but mine still works and Im on Mint 12. Ive noticed it can take a minute or so to mount. So just run Lou's mount script and just wait a little while and see if it mounts. Like I said, mine takes about a minute to mount...

    ReplyDelete
  12. Lou! thank you so much for you work...i need help. i followed your steps to the tee..i'm on ubuntu 11.10

    Could not display "/media/Nexus".
    Error: Error stating file '/media/Nexus': Transport endpoint is not connected
    Please select another viewer and try again.

    ReplyDelete
  13. Hi,
    I'm in the same point as andrewp3481. Did this got a solution?

    ReplyDelete
  14. Just gave this a try on my Verizon G-Nexus... After mounting, the connection is very, very slow. I don't get any notifications when connecting (I'm using Kubuntu BTW), but the 'Nexus' folder shows up in the Dolphin file manager, and several minutes later, the 'Playlist' folder shows up inside the 'Nexus' folder, but no other folders show up (possibly a permissions problem?). It won't allow me to create any new directories inside either 'Nexus' or 'Playlist', and it's not showing any files in either folder.

    Very disappointing. I love the phone, and especially the pure Android experience, but this is not a viable solution if I can't get my files over to the phone. I've tried doing it on a Windows computer, but it didn't give me all of the files I asked it to copy over (?). I really don't know another phone I could change over to; I had so much trouble with my DroidX that I'm not going back to Moto anytime soon. Just have to wait, I guess. Thanks anyway Lou, I could see how this solution might work, but I don't think my phone is cooperating.

    ReplyDelete
  15. I'm running stable Debian squeeze. I've always seen "Don't mix stable with anything." Most of the mixed systems tutorials are for mixing testing and unstable. So without libmtp9 installing what are my real options....

    ReplyDelete
  16. I just tried to follow your instructions on Ubuntu 11.04 and hit a roadblock downloading the mount/unmount scripts it seems something terrible has happened to the server hosting them...

    ReplyDelete
  17. I am having the same problem as ServiceComputers, help! Btw, Lou you are amazing

    ReplyDelete
    Replies
    1. @Tara @ServiceComputers sorry guys Multiupload the site I was using to host the scripts as well as the MTP packages decided to shut down quite a bit of their content I'm assuming due to the Megaupload debacle. I will include the contents of the scripts below just copy and paste into gedit title them whatever you want but make shure ".sh" is at the end also make sure you make them executable by "chmod +x nameofyourscript.sh"

      mount-nexus.sh

      #!/bin/sh
      sudo mtpfs -o allow_other /media/Nexus

      unmount-nexus.sh

      #!/bin/sh
      sudo umount /media/Nexus


      Hope this helps!

      Delete
    2. This comment has been removed by the author.

      Delete
  18. Hey Lou,

    I tried using the steps you provided here, but I'm getting the following:

    kimbo@kimbo-laptop ~/Downloads $ sudo dpkg -i libmtp9_1.1.1-1_amd64.deb
    dpkg: error processing libmtp9_1.1.1-1_amd64.deb (--install):
    cannot access archive: No such file or directory
    Errors were encountered while processing:
    libmtp9_1.1.1-1_amd64.deb

    I looked and saw that I had the packaged installed (except for mtpfs, which I installed), and I tried going through the rest of the instructions as you had them laid out. The mount point was created and it looks like it was mounted, but when I try to open the Nexus folder it just spins its wheels. Help!

    EDIT: Actually, it does appear that my laptop sees it (took a while), but the only folder that shows up is Playlists...

    ReplyDelete
  19. Are the MTP packages available anywhere else, since multiupload isn't responding?

    Do you know how old a version of ubuntu this will work with? I'm running 10.04 on my netbook. We a machine with a more recent version, but it is usually booted to windows..

    Thanks.

    ReplyDelete
  20. Hi does anybody knows were to get the ./mount-nexus.sh and ./unmount-nexus.sh scripts now? the posted links doesn't seem to be working now.

    Thanks

    ReplyDelete
  21. Cocha, on Feb 4th Lou posted the source to the scrips above, look up!!! I found that the sudo is not needed since your OS should reset the ownership and group of the /media/Nexus dir to whoever ran the script.

    I just put this in my .bash_aliases file:

    alias android-connect="mtpfs -o allow_other /media/Nexus"
    alias android-disconnect="fusermount -u /media/Nexus"

    However the real issue now is that libmtp-common_1.1.1-1_all.deb is no longer available anywhere, not even on Ubuntu sites. There is a newer version but it is guaranteed to break your install so don't try it.

    ReplyDelete
  22. I just found the libmtp-common_1.1.1-1_all.deb package. I have put them all on my server, see below. Just cd to the directory where you downloaded them and run:

    http://tetrasys-design.net/download/libmtp/

    sudo dpkg -i libmtp9_1.1.1-1_amd64.deb libmtp-common_1.1.1-1_all.deb libmtp-runtime_1.1.1-1_amd64.deb mtp-tools_1.1.1-1_amd64.deb

    This worked for me, now everything works and I can read and write to the Nexus. There are also the taralls in that directory which you will not need on Ubuntu.

    ReplyDelete
  23. This comment has been removed by the author.

    ReplyDelete
  24. "Download and unzip the mount/unmount scripts I've written for you in your home directory:"
    Errr..where from?

    ReplyDelete
  25. Hi Lou!

    I'm kind of new linux user and I have a Galaxy S2, can you help me to enable MTP on this device to interact with Linux Mint 12?

    ReplyDelete
  26. Hi Lou: Nice tutorial, I also just got and love the phone but I cannot find the script archive file to download from your blog. Thanks, Augie

    ReplyDelete
  27. HEY WENT THROUGH ALL THE STEPS LOOKS LIKE I WAS DOING GOOD I MADE GEDIT SCRIPTS FOR MOUNT AND UNMOUNT IN MY HOME DIRECTORY WHEN IT CAME TIME TO MOUNT MY GNEX I GOT THIS ERROR,

    ./mount-nexus.sh: line 1: mount-nexus.sh: command not found
    Listing raw device(s)
    Device 0 (VID=04e8 and PID=685c) is a Samsung Galaxy Nexus/Galaxy S i9000/i9250, Android 4.0 updates.
    Found 1 device(s):
    Samsung: Galaxy Nexus/Galaxy S i9000/i9250, Android 4.0 updates (04e8:685c) @ bus 1, dev 9
    Attempting to connect device
    Android device detected, assigning default bug flags




    DEBUGGING IS DISABLED PER YOUR REQUEST, PLEASE ASSIST

    ReplyDelete