Thursday, July 19, 2012

Connect Nexus 7 to Linux via MTP using USB

Android 4.1 use the MTP (Media Transfer Protocol) and Linux doesn't natively support MTP. Something it doesn't work well with Linux/Ubuntu. When I connect my Nexus 7 to a Server running Linux using USB, none USB device appears and I have to mount it via MTP for accessing the file system.

How to Connect Nexus 7 to Linux
Open the terminal window and type the commands to setup.
* First install the necessary tools:
sudo apt-get install mtp-tools mtpfs
* Set up a UDEV rule
gksu gedit /etc/udev/rules.d/51-android.rules
* Type this text in it. Make sure all are in a single line:
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666", OWNER="your-username-in-the-linux"
* Set up a mount point
sudo service udev restart
sudo mkdir /media/Nexus7
sudo chmod a+rwx /media/Nexus7
* Plug your Nexus 7 in and select MTP on the tablet, then enter:
sudo mtpfs -o allow_other /media/Nexus7
* Now You can browse your Android phone contents or add/remove/modify files using Nautilus. When you need To unmount, try this:
sudo umount mtpfs

Thank you. This worked well for me with Daniel's comment making all the difference. I only see the folders:Alarms DCIM Movies Notifications Playlists RingtonesAndroid Download Music Pictures PodcastsI wanted to copy my clockworkmod backup to ubuntu but I am still struggling to see that :(

Couldn't quite get this method to work. downloaded a program from the Ubuntu software center called gMTP. Was able to get my music on to my Nexus using that. Not as seemless as dragging and dropping files there but it did what I needed it to so.

This method did not work for me. I ended up downloading gMTP from the Ubuntu software center. I was able to connect and copy my music from my Ubuntu Pc to the Nexus 7 pretty quickly. Not as easy as drag and drop or copy and paste but did what I needed