Connecting Samsung ICS to Ubuntu using MTP
(These notes are mostly for my own benefit).
Android is moving away from USB Mass Storage. You will no longer be able to plug in a USB cable and have your Android show up as a USB disk. There are some good technical reasons for this, but it is a pain if you want to copy some files to your phone. The new system - MTP - isn't automagically detected in Ubuntu. This is something which is likely to be fixed in later versions of Ubuntu - but for now you'll have to hack around it.
The crazy cats at omgUbuntu have a tutorial which I have adapted for the Samasung Galaxy S (running ICS from teamhacksung).
First, install the MTP tools.
sudo apt-get install mtp-tools mtpfs
Connect the phone to the computer using USB.
To check that MTP is installed and working, run the command
mtp-detect
You should see a spool of text as MTP detects the phone.
To create the rules which allow Ubuntu to detect the phone, create a new rule file like so:
sudo nano /etc/udev/rules.d/51-android.rules
Add in this line of text
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666"
If you're using a different device, run this command to get the correct idVendor and idProduct:
mtp-detect | grep idVendor mtp-detect | grep idProduct
We'll need to restart udev so it can pick up the new rule.
sudo service udev restart
Then create a directory in your filesystem which you can use to access your phone.
sudo mkdir /media/GalaxyS sudo chmod a+rwx /media/GalaxyS
Now we need to add ourselves to fuse.
sudo adduser YOURUSERNAME fuse sudo nano /etc/fuse.conf
The last line probably reads
#user_allow_other
Remove the "#" so you're left with:
user_allow_other
Save the file.
We're going to create two commands "android-connect" and "android-disconnect". When run, these will allow you to connect to your phone, then safely disconnect.
echo "alias android-connect="mtpfs -o allow_other /media/GalaxyS"" >> ~/.bashrc echo "alias android-disconnect="fusermount -u /media/GalaxyS"" >> ~/.bashrc source ~/.bashrc
Restart the computer. Make sure the phone is connected via USB. Open a terminal and run
android-connect
Open your file manager and go to "/media/GalaxyS"
Once you're done, disconnect the device by running
android-disconnect
Simon says:
Thanks 🙂 Just make it working on mu ubuntu.... Its annoying so many things we need to do before things start working correctly on linux... But its worth it 😉
dex says:
can you simply set the USB debugging mode? This should set by default the connection to the PC in USB storagew mode, so you'll see the storage and not the MTP.
Another point is that MTP on linux is really slow. Can we find a way to speed it up?
Gustavo says:
Didn't work for me. I get the following message on run the 'android-connect': fuse: bad mount point `/media/GalaxyTab7Plus': Transport endpoint is not connected. My device is Galaxy Tab 7 Plus, it use de same idVendor and idProduct as GalaxyS Can anyone help me?
Hervé says:
I'm on a new version of Precise (12.04). After the nude installation, if I connect my Galaxy S3, I see it in Nautilus, it is automounted. If I try to open it, I see the first level of directories, but they are empty. I followed this post, I typed "android-connect" and when I open Nautilus on /media, it waits and doesn't display anything (even not my other mount points).
Any hint ? How can we connect the Galaxy S3 to Ubuntu ?
Zoltan Horvath says:
This one solved the problem for me: http://gunavara.blogspot.co.uk/2012/11/samsung-galaxy-s3-vs-ubuntu-1204.html
Fabio says:
Same thing here, Galaxy S3 and doesn't work. Just locks up....
Marvin says:
I tried the instructions mentioned here, but no luck 🙁 getting error: “alias android-disconnect=”fusermount -u /media/GalaxyS” “alias: command not found “alias android-disconnect=”fusermount -u /media/GalaxyS” “alias: command not found “alias android-disconnect=”fusermount -u /media/GalaxyS” “alias: command not found “alias: command not found “alias: command not found “alias android-disconnect=”fusermount -u /media/GalaxyS” “alias: command not found “alias android-disconnect=”fusermount -u /media/GalaxyS” “alias: command not found “alias android-disconnect=”fusermount -u /media/GalaxyS” “alias: command not found “alias android-disconnect=”fusermount -u /media/GalaxyS”
now im unable to access any of my folders on my pc. im running ubuntu 12. Please help!!!
paddyrooney says:
Thanks for this great help in getting access to my JB device, just thought this little script might help some people who wish to just click an icon to do this work without having to run a command... so this does not require you to create the ~/.bashrc entry In a terminal
echo " #!/bin/bash if mountpoint -q /media/GalaxyS ; then fusermount -u /media/GalaxyS else mtpfs -o allow_other /media/GalaxyS fi" > MTPattach.sh
Now create a launcher to this file which will mount/umount it
andy says:
I found I could use the samba mount I had setup to share files with a windows PC. I used file expert to connect to samba and then I could browse and copy/paste as needed.
Ali Altaf says:
It doesn't work for Galaxy S3 🙁 , any one help me to resolve this issue
Dan Saint-Andre says:
When I connect my Galaxy Note i717, it identifies as a Galaxy Tab 10.1 before I do any file edits. 'dmesg' does not reveal any other Samsung device detected. How do I get it to ID as a Note i717 (vs. N7000) instead? How do I config once I get a correct ID? Doesn't MTP handle creation and removal of the /media/xxxxx folder and mounting?
Art Elsea, Jr. says:
Brand new Galaxy S III from Sprint running Android 4.1.1
Running Ubuntu 10.04.4 LTS on workstation
kernel 2.6.32-45-generic #101-Ubuntu SMP Mon Dec 3 15:39:38 UTC 2012 x86_64 GNU/Linux
Followed instructions exactly, but android-connect gives error message:
fuse: bad mount point `/media/GalaxyS': Transport endpoint is not connected
Any suggestions or is it a lost cause with 10.04.4 LTS?
Thanks
Karl says:
Got this working with an S3 Mini on Aptosid (Debian-based). Had to enable usb debugging though, jmtpfs (not mtpfs) wouldn't get a connection going any other way. (Possible fix for Art Elsea, Jr.'s problem). The "technical reasons" are garbage: The first two folders I see when mounted are Card and Phone. Seems like Samsung was trying to do something nasty.