Mounting an Android 4.0+ device in Ubuntu is pretty tricky, but there is a FUSE filesystem called Go-mtpfs, created by a Google employee because "mtpfs was very unstable" for him, which works great. Read on to find out how to use it and easily install it in Ubuntu using a PPA!

Also see: AirDroid: Manage Your Android Device Using A Browser, however, there are cases when you can't use AirDroid.

By default, when connecting an Android device to an Ubuntu computer, gvfs is used via gphoto2 (because gvfs doesn't have native MTP support yet). And that doesn't always work properly.

Here's my experience with this: trying to mount my Android 4.2.1 phone fails most of the time (I've experienced the same behaviour with Android 4.1 too), usually with some "Sorry, could not display all the contents of "Android": Timeout was reached" errors. It does work at times, but it's very slow and with such an unreliable behaviour, an alternative is always nice.

I didn't try mtpfs but it seems that's not reliable any more either, but what I did try is Go-mtpfs and it works great under Ubuntu 12.10: it's fast and it works every time. Well, unless I forget to unlock the phone when I mount it (it's probably something sleep-related because it doesn't always happen), but anyway.

I've found out about Go-mtpfs from Bilal's blog and I figured it's a bit complicated for regular users to compile it so I've packaged Go-mtpfs and uploaded it to the WebUpd8 Unstable PPA. Along with Go-mtpfs, I've also packed a custom Unity launcher and a script, to be able to easily mount and unmount your Android device without having to use the command line.

Go-mtpfs Ubuntu Unity quicklists

However, while my script (which is used by the custom Unity launcher) tries to display a notification if an error occurs, it shouldn't be considered reliable for properly displaying the errors so my recommendation is to mount / unmount your Android 4.0+ phone or tablet via command line so you can see any possible errors.


Video: see Go-mtpfs in action


Below you can watch a video I've recorded, demoing Go-mtpfs in Ubuntu 12.10 (as well as the custom Unity launcher / script I've created for it):


(direct video link; subscribe to our YouTube channel for more videos)

(In the beginning, I'm showing what happens when you try to mount an Android device with without Go-mtpfs, so it's all waiting and a bunch of errors, if you want to skip to the Go-mtpfs part, skip to 2:05.)



Install Go-mtpfs in Ubuntu


Update: Gvfs has been updated in Ubuntu 13.04 Raring Ringtail, bringing a new MTP backend which allows users to access Android 4.0 devices which do not support the USB Mass Storage. So this should work out of the box with Raring.


Go-mtpfs is available in the WebUpd8 Unstable PPA, for Ubuntu 13.04, 12.10 and 12.04. Add the PPA and install it using the following commands:
sudo add-apt-repository ppa:webupd8team/unstable
sudo apt-get update
sudo apt-get install go-mtpfs

To also install the custom Unity Launcher for Go-mtpfs which lets you mount or unmount the Android device from the Unity Launcher, use the command below:
sudo apt-get install go-mtpfs-unity

Note: I've only tested it in Ubuntu 12.10, using a Samsung Galaxy S II phone (with both Android 4.1 and 4.2.1).

Update 13 February 2013: I've backported the latest libmtp from Raring to Quantal and Precise, the update bringing support for some new devices.

Why did I use the Unstable PPA? Well, I've built Go-mtpfs against the latest libmtp 1.1.5 which is not available in the official Ubuntu repositories and while it didn't break anything, it's better to be safe. Since our Unstable PPA only has a few packages, it can easily be purged in case something doesn't work properly (but everything should work, that's just to make sure). The PPA only has Synaptic GTK3 for Precise and Quantal right now.


Notes: 
  • Unmounting the device via Nautilus does not work!
  • Sometimes you may get an error if the device is locked, so unlock it before trying to mount it;
  • When plugging in an Android device via USB, Ubuntu will try to mount it and it's a good idea to stop this by clicking the unmount icon in Nautilus.

For manual installation instructions, see: THIS post.



How to mount Android 4.0+ phones / tablets in Ubuntu using Go-mtpfs


Go-mtpfs nautilus
Browing the mounted Android device using Nautilus 3.6

Thunar go-mtpfs
Browing the mounted Android device using Thunar 1.6

Installing Go-mtpfs using our PPA, a folder called "MyAndroid" is created under /media. So, to mount your Android device, connect it via USB, unlock it (you'll get an error most of the times if you don't unlock the device when mounting it) and mount it using the following command:
go-mtpfs /media/MyAndroid

To unmount it, use:
fusermount -u /media/MyAndroid

If you want to use the custom Unity launcher I was talking about, search Dash for "Mount Android" and add the icon to the Unity launcher. You can then right click it and and select to mount or unmount your Android device.

It's also worth mentioning that clicking the launcher itself doesn't do anything (but I've got that covered: a notification is displayed, telling the user to right click the icon instead). Also, the mount / unmount notifications have a 5 seconds delay which I've added to make sure the device has enough time to mount/unmount before checking for errors.

And finally, if you're not using Unity, you can still use the custom Unity launcher with a dock such as DockX and others which come with Unity quicklists support (I've used the old Unity quicklists API so it should work even with docks that use the old implementation). To add the launcher to the dock, open a file manager, navigate to /usr/share/applications (because the icon only shows up in Unity) and add the "Mount Android Device" launcher to the dock using drag and drop.


0 comments:

Post a Comment

 
Top