How to access an Android 4 phone
It now takes a lot of fiddling to get this to work due to changes to the Media Device(MTP) file system protocol with usb connections. See this post for example. I have found several ways to access a Samsung Galaxy Note - in order of difficulty (for me!) these are:
Method 1 with USB
apt-get install gphotofs mkdir ~/android-device # or any other place with user permissions
Connect the phone, and in usb settings choose "Connect as Camera(PTP)"
The media folders can now be displayed in thunar.
Before disconnecting, close the file browser and
fusermount -u ~/android-device
(EDIT: typo correction)
Weirdly I have found that sometimes the whole android filesystem is accessible by choosing "Connect as Media device(MTP)".
After a long delay a pop-up may say your pc doesn't have the correct software to display files, but then it mounts itself (on /dev/sdb in my case).
This has occurred whether PTP or MTP have been selected, which isn't supposed to happen! fusermount -u may not work then so
umount -l /dev/sdb
If you are lucky enough for this to happen, then you won't need to do the next method....
Method 2 with USB
Instead of using mtpfs to access an MTP filesystem, use the go-mtpfs library which simplifies everything
Install go-mtpfs, using a method found here: http://novaspirit.com/blog/?p=121
sudo apt-get install golang fuse git-core libmtp-dev libfuse-dev sudo adduser $USER fuse mkdir ~/tmp/go export GOPATH=~/tmp/go go get github.com/hanwen/go-mtpfs sudo mv ~/tmp/go/bin/go-mtpfs /usr/bin mkdir ~/android-device
Now, go-mtpfs is installed. To mount your android device run
go-mtpfs ~/android-device &
Contents of your phone can be found at ~/android-device folder in your home directory.
To unmount run these commands
fusermount -u ~/android-device
If this doesn't work due to a "filesystem busy etc" message, then umount it
To make it even more simple you can add aliases to your .bashrc file
alias android-on='go-mtpfs ~/android-device &' alias android-off='fusermount -u ~/android-device'
I have found that trying to remount, with the same instance of Thunar open, sometimes results in failure. The mount command shows
Locked(DeviceFs(GT-N on /home/damo/android-device type fuse....)
I get round it with
umount -l /home/damo/android-device
and restarting Thunar
These inconsistencies are frustrating, but I find a direct usb connection is easier than the other options.
Method 3 with a web app using wifi or tethering
Your Android, on the Web
AirDroid is a free and fast app that helps you manage your Android from a desk web browser, all over the air.
※ One less cable.
Move things on and off your Android device without a USB cable. Even when the device is not nearby.
※ One less screen.
Send and receive SMS from your big-screen computer, without being distracted by the small-screen thing.
※ One less worry.
Locate and lock your Android when it’s lost. Cannot get it back? Simply wipe all data remotely.
Pros: Good interface, easy to use, works well, log in via google/facebook etc if you want (option to stay logged in for an extended period)
Cons: Image galleries load slowly and it takes ages if multiple files need selecting; needs wifi connected
(Watch the camera view remotely, so you can get a screenshot of the sh** who has just stolen your phone )
Method 4 with SSH/FTP
Works fine if you know your way around that stuff, and know the username and password for the phone.
I have tried AndFTP
AndFTP is a FTP, FTPS, SCP, SFTP client. It can manage several FTP configurations. It comes with both device and FTP file browser. It provides download, upload, synchronization and share features with resume support. It can open (local/remote), rename, delete, update permissions (chmod), run custom commands and more. SSH RSA/DSA keys support. Share from gallery is available. Intents are available for third party applications. SCP and folder synchronization are available in Pro version only.
[I haven't spent any time investigating the oddities, and I haven't used ftp/ssh much, so if anyone can shed any light on these, we can add them to the HowTo.....]
Hope this is useful
Last edited by damo (2014-02-07 00:28:14)
Thanks for taking the time to type this up, I'm sure it will be useful in the future when I finally get around to rooting my phone
I've not failed, I've just found a thousand ways that don't work.
Since Gnome 3.8, there's gvfs-mtp, which works without a hitch. I think you can just install this from unstable or whatever.
i have a samsung gs3 running cyanogenmod 10.1.3
when i set my phone into mobile hot spot, enable usb storage, and connect to it, #! automounts my phone just like a usb drive.
That's good - newer Android? more recent #!?
I started all this so my 82 yr old mother could get the photos off her smartphone onto her crunchbang/xfce laptop with the minimum of hassle. Her previous phone and camera would plug'n'play on Mint, now she clicks a launcher that runs a script to mount and d/l stuff. I'm not willing to try the latest android/testing repos on her hardware, and risk it becoming unusable!
my cm rom is based on android 4.2.2
and i'm using #! waldorf
maybe it's a cm aftermarket feature, but idk
Last edited by xero (2013-10-23 20:40:35)
Thanks for the help. Access aquired.
Thanks for the tutorial. I have a question.
Using the first method above allows me to view my MotoX's photos. I was able to import the photos using Shotwell (veeerrrry slowly, for some reason). However, when I tried to unmount using 'fusermount -u gphotofs', I got unexpected results. A message was returned:
entry for /home/superwow/gphotofs not found in /etc/mtab
Umount -l /dev/sdb showed I had mounted several tmpfs (temp file systems I think, which should be Android). Lsusb showed I was attached to sda mountpoints, and several tmp folders.
I tried to troubleshoot and then left the computer for a couple of hours to run errands. It was not plugged in and shut itself down when the battery ran down. Reconnecting to power, rebooting the computer, and trying to access the drive again by repeating the steps, I get
superwow@rlyeh:~$ gphotofs ~/MotoX_gfilesystem fusermount: failed to access mountpoint /home/superwow/MotoX_gfilesystem: Permission denied
Has shutdown and inappropriate unmounting borked my gphotofs? How to fix it?
First off - thanks for the tutorial - it really helped.
Superwow - I had the same error as you. Turns out, the fusermount example in the tutorial is mistaken - the syntax should be 'fusermount -u mount-point-name' and not 'fusermount -u gphotofs'. So I named my folder where I mounted my phone MOTO_G which means the fusermount unmount command in my case reads:
fusermount -u MOTO_G
hope this helps.
I haven't done it on 4.x but I use FTPServer.
Setup the server, make sure it is bound to your local wifi; (make sure that your wifi router isn't set to block client to client communications, most aren't but if things aren't working right, check this). If you need to get something from your phone to your computer, just start the sever on your phone, and use your favorite FTP client to browse your phone's files.
Thanks for the tutorial Damo, it's been an enormous help.
With a couple of hiccups I was able to get method 2, gomtpfs, working so access my Samsung Galaxy S4. It wasn't absolutely essential since I use an rsync app to sync photos from my phone to a Raspberry Pi file server and to sync Oggcasts to the phone, but I wanted to be able to access files on my phone on my laptop anytime without booting to LinuxMint or something much worse from Redmond, Washington.
Running Waldorf 64bit with a 3.12 bpo kernel (after a reinstall over the past couple of days when I borked my system install other linux distros to an external USB 3.0 drive)
I also had to install pkg-config to be able to execute the 'go get github.com/hanwen/go-mtpfs' command (you must have already had it installed and I didn't)
'go-mtpfs ~/android-device &' failed with an error saying I did not have permission to execute /bin/fusermount. I had added myself to the fuse group and running addgroup again confirmed it. sudo go-mtpfs worked so I tried rebooting after which it worked so something didn't recognize my being in the group after the addgroup command.
After rebooting go-mtpfs ~/android-device gave an error from the phone even after unplugging and replugging. Going into the usb menu on the phone setting it to connect as a camera then setting it back to connect as an MTP device worked.
Next I want to look at udev to see if I can have the system do the mount automatically when the phone is plugged in.
Nothing new for me as far as MTP is concerned, I have only had problems with MTP (random on/offs, ....) on my GT8730 and am tempted to equally blame it on the implementations on the phone and the client library.
I don't see what would justify MTP's existence if SSH via sshfs or a FTP client/ftpfs do the job much better. I even can use rsync again.
I know that the thread is old but i need a few basic help.
I Own a Nexus 7 and i am trying to install go-mtpfs solution. But I have 2 problems
karoto@Deadalus:/$ sudo apt-get install libmtp-dev Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: libmtp-dev : Depends: libusb-1.0-0-dev but it is not going to be installed E: Unable to correct problems, you have held broken packages.
If I execute
karoto@Deadalus:/$ sudo apt-get install libusb-1.0-0-dev Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: libusb-1.0-0-dev : Depends: libusb-1.0-0 (= 2:1.0.11-1) but 2:1.0.17-1+b1 is to be installed E: Unable to correct problems, you have held broken packages.
Did I missed something here? or.. ?
And thus I am not able to proceed to go get..
Last edited by karamelos (2014-03-14 10:07:36)
Thanks for the great howto, damo. I used method #2 this morning to successfully access my new Samsung Galaxy Note 10.1, 2014 Edition tablet under CrunchBang 11 to transfer a couple of files.
04/11/2014 edit: I was using the go-mtpfs method this morning and ran into instances where it wasn't reliable. I would run the command to connect a device, open a file manager, and not see anything at all.
I also tried using bluetooth, but that didn't work at all, at least using the blueman app.
So, I did a bit of research on the web about using other forms of wireless transfer and came across an app called WiFi File Transfer Pro in the Google Play Store; $1.40 and it works great.
Last edited by KrunchTime (2014-04-11 13:50:31)
Linux User #586672
Come and Die -- Kyle Idleman
I am trying to make it work as MTP and not Camera.
karoto@Deadalus:~$ sudo apt-get install golang fuse git-core libmtp-dev libfuse-dev [sudo] password for karoto: Reading package lists... Done Building dependency tree Reading state information... Done fuse is already the newest version. fuse set to manually installed. libfuse-dev is already the newest version. git-core is already the newest version. golang is already the newest version. Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: libmtp-dev : Depends: libusb-1.0-0-dev but it is not going to be installed E: Unable to correct problems, you have held broken packages.
On stock Iceweasel not all features work with Airdroid, so try Chromium instead. On an HTC One found this method to be extremely quick and simple for upload and download
I have a Motorola Moto G Android Kitkat 4.4.3 and Method 2 worked flawlessly. Thanks for taking the time to make a this excellent tutorial!
Last edited by matthias2223 (2014-06-09 01:29:10)
too many steps guys try this sudo apt-get install gmtp http://gmtp.sourceforge.net/ i just got my first smartphone (Motorola Moto G Android Kitkat 4.4.2) two weeks ago and i used this. it seems i had it already installed a long time ago in case a smartphone user needed my help. it transfers every file i throw at it and even drag and drop works and im on waldorf.
Last edited by edps (2015-03-29 20:58:44)
jmtpfs worked flawlessly for me! thanks!