1

I'm using Linux Mint 13 MATE (based from Ubuntu 12.04) as my main operating system. I have been using the adb shell and use push and pull in transferring to and from my Galaxy Nexus.

As I have read somewhere that the Samsung Galaxy Nexus USB port is sensitive and can easily get broken, I would like to ask if it is safe to just remove the USB cord when I don't need it? Or is there a command I need to type via terminal to have it safely remove or unmount my Galaxy Nexus?

1 Answer 1

2

I've been using my Galaxy Nexus with Kubuntu 12.04 & 12.10 and haven't needed to use a specific eject command.

Saying that, here are instructions which will let you mount and dismount your Galaxy Nexus safely. With this method you can safely mount/dismount and you should still be able to use ADB to pull and push files to/from your device. (Source):

Connecting your Ice Cream Sandwich phone or tablet to Ubuntu for file access

Before you begin, try plugging your phone in and see if it works straight away. At the time of writing, the only official Android Ice Cream Sandwich phone is the Galaxy Nexus, and mine doesn’t work. But future ICS phones might work, depending on whether they have an SD card slot or not, and whether they support exporting the card as USB mass storage. If it works, you should be good to go.

First up, install the necessary tools:

sudo apt-get install mtp-tools mtpfs

Now, connect your Galaxy Nexus to your computer. On your phone, open up the notification drawer, and click on “USB Connection type”. Make sure that MTP is selected.

Then, run these commands:

mtp-detect | grep idVendor

mtp-detect | grep idProduct

You shall get an output like this:

[martyn@martyn-ThinkPad-X220 1] ~ >mtp-detect | grep idProduct
Device 0 (VID=04e8 and PID=6860) is a Samsung GT P7310/P7510/N7000/I9070/I9100/I9300 Galaxy Tab 7.7/10.1/S2/S3/Nexus/Note/Y.
   idProduct: 6860

[martyn@martyn-ThinkPad-X220 1] ~ >mtp-detect | grep idVendor
Device 0 (VID=04e8 and PID=6860) is a Samsung GT P7310/P7510/N7000/I9070/I9100/I9300 Galaxy Tab 7.7/10.1/S2/S3/Nexus/Note/Y.
   idVendor: 04e8

Note down the numbers written in front of idVendor and idProduct, you’ll need those later on.

Now, run this commands:

gksu gedit /etc/udev/rules.d/51-android.rules

A gedit window should open up. Type this text in it, all in a single line:

SUBSYSTEM==”usb”, ATTR{idVendor}==”VENDORID”, ATTR{idProduct}==”PRODUCTID”, MODE=”0666″

Replace VENDORID with the idVendor you had noted down earlier. Similarly, replace PRODUCTID with the idProduct you had noted down. In my case, they were 04e8 and 685c respectively, but they might have been different for you.

Also, remember to re-type the quotes in the line after you’ve copied and pasted it, otherwise udev may output an error.

If you’re in doubt, you can copy the same line from this pastebin instead and then replace PRODUCTID and VENDORID as needed.

Save and close the file. Then, disconnect your phone and run these commands:

sudo service udev restart

sudo mkdir /media/GalaxyNexus

sudo chmod a+rwx /media/GalaxyNexus

sudo adduser YOURUSERNAME fuse

Replace YOURUSERNAME with your Ubuntu user name. Now, run this command:

gksu gedit /etc/fuse.conf

In the Gedit window, remove the # at the beginning of the last line (the one that begins with “#user_allow_other”) like this:

# Set the maximum number of FUSE mounts allowed to non-root users.
# The default is 1000.
#
#mount_max = 1000

# Allow non-root users to specify the 'allow_other' or 'allow_root'
# mount options.
#
user_allow_other

You’re almost done! Now, restart your computer, and then run these three commands :

echo “alias android-connect=\”mtpfs -o allow_other /media/GalaxyNexus\”" >> ~/.bashrc

echo “alias android-disconnect=\”fusermount -u /media/GalaxyNexus\”" >> ~/.bashrc

source ~/.bashrc

Again, do re-type the quotes in each command after you’ve copied, otherwise the command won’t work.

Connect your phone again, and then make sure your phone is using MTP, then run this command:

android-connect

Voila! You can now browse your Android phone contents using Nautilus. Just fire up the file manager, and then in the side bar click GalaxyNexus to browse your phone contents just like you would do with a USB stick. You can also add, remove and modify files just like a normal file system.

You might have noticed that you cannot use the Nautilus eject icon to disconnect the phone. Instead, to safely remove the phone, just run the command:

android-disconnect

From now onward, you just need to run android-connect to mount your phone and then android-disconnect to safely remove your phone. Everything else should be handled automatically. I tried many ways of getting the mount and unmount to happen automatically on cable connect, but this was the best solution I could come up with.

These two commands won’t require root permissions to run. All users who are members of the fuse user group should be able to run these commands without root access.

3
  • Thanks for response Martyn. Problem is, I don't really use Nautilus but I always use SpaceFM as my file browser. And also, I honestly prefer to use the terminal (which I always use guake like next to always). Hmm... I'm wondering though, if I don't do the instructions above (having the command "android-connect"), will it still be alright?
    – AisIceEyes
    Oct 29, 2012 at 16:08
  • I've been using my GNex with linux for ages and have never ejected it and have had no problems. I know that is purely anecdotal but I've not heard of any issues with the GNex usb port.
    – Martyn
    Oct 30, 2012 at 10:36
  • Thanks Martyn. This is my first ever Android device so best be sure than sorry :)
    – AisIceEyes
    Nov 1, 2012 at 17:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .