After searching and having a headache for 5+ hours I wanted to make an easy how to for noobs running ubuntu 10.10.
I found a ton of information on a ton of sites, and after a lot of cross post referencing I finally figured it all out, so I will lay this out in as simple a way possible so nobody has to have the same issues I had.
Pre-requisites: latest android sdk, ubuntu 10.10, general knowlege of linux
Step 1. Obtaining and making fastboot/adb executable
Download THIS package containing the fastboot binary and the 70-android.rules file
extract files anywhere (remember for later use)
copy fastboot binary to your /android-sdk-linux_86/tools/ folder
open terminal and execute
Code:
chmod +x <path to>/android-sdk-linux_86/tools/fastboot
chmod +x <path to>/android-sdk-linux_86/platform-tools/adb
Step 2. Adding your tools and platform tools directories to the path
in teminal execute
Code:
gedit .bashrc
at the end of the file insert
Code:
# enable android tools directories in path
export PATH=${PATH}:~<path to>/android-sdk-linux_86/tools
export PATH=${PATH}:~<path to>/android-sdk-linux_86/platform-tools
Step 3. Getting ubuntu to recognize your phone in adb and fastboot
in terminal execute
Code:
sudo cp <path to>/70-android.rules /etc/udev/rules.d/70-android.rules
sudo chmod a+rx /etc/udev/rules.d/70-android.rules
sudo reboot
Step 4. Make sure it works
after reboot open terminal and execute
Code:
adb devices
as long as it returns a device with HTXXXXXXXXXX you should be golden
There's a typo in the Android SDK paths in your message. You're missing the x in _x86. Was wondering why adb wasn't in my path after I copy pasted that into my .bashrc.
Here's the correct forms.
Code:
chmod +x <path to>/android-sdk-linux_x86/tools/fastboot
chmod +x <path to>/android-sdk-linux_x86/platform-tools/adb
Code:
# enable android tools directories in path
export PATH=${PATH}:~<path to>/android-sdk-linux_x86/tools
export PATH=${PATH}:~<path to>/android-sdk-linux_x86/platform-tools
Another thing that puzzled me was that there appears to be a hard coded username in the udev rules file. Should that be edited too?
Yes, you need to update your udev rules:
http://forum.xda-developers.com/showthread.php?t=640158
I cant seem to find the path to /70-android.rules /etc/udev/rules.d/70-android.rules.
Not sure what you mean?
Try this method
Rogoshin said:
I cant seem to find the path to /70-android.rules /etc/udev/rules.d/70-android.rules.
Click to expand...
Click to collapse
Dude, I put these instructions together sometime in 2010, and should be easy enough to follow. Following all those other instructions used to have me trying for hours to set up adb & fastboot, so when I got a little more familiar with Linux I made my own, with root permissions, so you don't have to sudo anything. You can have adb & fastboot up and running in 5 minutes, if you follow the instructions step by step. http://forum.xda-developers.com/showthread.php?t=820122
blas4me said:
Dude, I put these instructions together sometime in 2010, and should be easy enough to follow. Following all those other instructions used to have me trying for hours to set up adb & fastboot, so when I got a little more familiar with Linux I made my own, with root permissions, so you don't have to sudo anything. You can have adb & fastboot up and running in 5 minutes, if you follow the instructions step by step. http://forum.xda-developers.com/showthread.php?t=820122
Click to expand...
Click to collapse
Well it did not work for me. In step 2 when you have to add auto prompt I get this error "Can't create user application configuration folder /home/rogoshin/.local/share/applications: Not a directory".
What i was looking for is the 70 android rules file.
You create the 70 Android rules file yourself...
danger-rat said:
You create the 70 Android rules file yourself...
Click to expand...
Click to collapse
I thought it was in the link, but the link does not work for me.
If I create the file myself, where do I get the content?
Sendt fra min Galaxy Nexus med Tapatalk
Talderon said:
As stated by DEEsx1 the following is correct:
Code:
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666"
However, it has been a mystery as to why the following location/file does not work for everyone:
Code:
/etc/udev/rules.d/51-android.rules
I am running Ubuntu 9.10 on my laptop with nothing special, just a straight load. the 51-android.rules code did not work for me.
I searched around on a few linux/android forums and found that some people had luck with creating the following file:
Code:
/etc/udev/rules.d/90-android.rules
However, that did not work for me. I had to create the following file:
Code:
/etc/udev/rules.d/99-android.rules
Now, if you are still getting the error, you don't need to reboot, you just need to restart udev:
Code:
sudo /etc/init.d/udev restart
You may also need to restart the adb daemon:
Code:
adb kill-server
adb start-server
adb devices
Now, worse case that I have seen, make sure the phone is not plugged into the computer, reboot the system AND the phone then try again (I have only seen this once).
Hope these tips help!
Click to expand...
Click to collapse
rotohammer said:
Welcome to Linux!
Actually, the more you use it, you'll find that you'll pickup these bits along the way, just like this.
The files are processed in order of their name so 51-xxx is mid-way through, 99-xx is at the tail end of the processing order. Sometimes, the order is important.
Also, after posting the wrong info to you earlier, I deleted the entry I posted. But, it turns out, the Nexus one poses as both id numbers. While in Android its VendorId=18d1, but in the bootloader (waiting in fastboot usb), the VendorId=0bb4.
So, I put both lines in one file today and all is well again.
I.e:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
and I changed my filename to 99-android.rules
then ran:
sudo restart udev
and now I can access the phone as a non root user again, either from adb or fastboot-linux.
Click to expand...
Click to collapse
This should be sufficient...
The auto script creates it for you, but up must have your phone connected for it to add your device id
Sent from my Nexus One using xda premium
blas4me said:
The auto script creates it for you, but up must have your phone connected for it to add your device id
Sent from my Nexus One using xda premium
Click to expand...
Click to collapse
auto script i am not sure i follow
It's a script that automates the process...
danger-rat said:
It's a script that automates the process...[/QUO
Where is this script?
Sendt fra min Galaxy Nexus med Tapatalk
Click to expand...
Click to collapse
The link is in my first post, pay attention!!!!!!!!!!
Sent from my Nexus One using xda premium
blas4me said:
The link is in my first post, pay attention!!!!!!!!!!
Sent from my Nexus One using xda premium
Click to expand...
Click to collapse
After i have completed all the steps, i tried the last command and got "no such command". I tried android rules 99, but maybe with Ubuntu 11.10 i should try a different number.
Sendt fra min Galaxy Nexus med Tapatalk
Try restarting udev, or enter root session on your fs, and make adb and fastboot executables, then restart udev.
Sent from my Nexus One using xda premium
blas4me said:
Try restarting udev, or enter root session on your fs, and make adb and fastboot executables, then restart udev.
Sent from my Nexus One using xda premium
Click to expand...
Click to collapse
This might be the root of the problem, because in usr/local i cant find adb or fastboot.
Related
So after getting a virus or something on my Windows drive and it not wanting to activate even after having my notebook for 3 years I am migrating over to Ubuntu. I have the android sdk setup and also edited my .bashrc file. Whenever I type adb devices it says
Code:
[email protected]:~$ adb devices
???????????? no permissions
[email protected]:~$ adb shell
error: insufficient permissions for device
What do I do to get it to work?
HELP!!!!!!!!!!!
Try sudo adb devices. You're not running adb as root
Sent from my HERO200 using XDA App
Indeed. You must use sudo.
Code:
[email protected]:~$ sudo adb devices
sudo: adb: command not found
This is what I get.
ah, sorry, try sudo ./adb devices
Try
Code:
cd ~/[COLOR="Sienna"]android_sdk_path[/COLOR]/tools/
su
./adb kill-server
./adb start-server
./adb remount
exit
or you can create a text file with:
Code:
#!/bin/bash
./adb kill-server
./adb start-server
./adb remount
and save it as remount.sh, or whatever you want, and place it in your tools folder then from the terminal cd to your tools folder and
Code:
sudo ./remount.sh
and it should work for you after that. That is what I do whenever I connect my hero
Russss said:
Try
Code:
cd ~/[COLOR="Sienna"]android_sdk_path[/COLOR]/tools/
su
./adb kill-server
./adb start-server
./adb remount
exit
or you can create a text file with:
Code:
#!/bin/bash
./adb kill-server
./adb start-server
./adb remount
and save it as remount.sh, or whatever you want, and place it in your tools folder then from the terminal cd to your tools folder and
Code:
sudo ./remount.sh
and it should work for you after that. That is what I do whenever I connect my hero
Click to expand...
Click to collapse
I'm still having some problems. I can type in kill server, start server, remount and it will work that way. But I can not get the script to work.
unCoRrUpTeD said:
I'm still having some problems. I can type in kill server, start server, remount and it will work that way. But I can not get the script to work.
Click to expand...
Click to collapse
I don't know why it isn't working. I attached the script i'm using (rename to remount.sh).
I just do
cd ~/android/tools/
sudo ./remount.sh
and it works, I don't know why it wouldn't unless the file properties are wrong(ownership,executable) I just started using linux about a month ago (linux mint)
I just installed Ubuntu last week, But I was having problems with my hard drive so I switched it out and loaded Windows and Ubuntu 10.04. I now I have to reload everything I had and I think it might have to do with permssions for the file, but I'm not sure. I am going to try that and also try the script again. Thanks for helping me get it to work at least one way.
i think i may be able to help you with this one
first you need to add the location of the sdk folder to your .bashrc file
open a terminal an enter
Code:
gedit /home/yourusername/.bashrc
replace yourusername with the one you use for ubuntu when the file opens up scroll all the way to the bottom and add this line to the bottom
Code:
export PATH=$PATH:/home/xx/Desktop/android-sdk-linux_86/tools
replace /home/xx/Destop/ with your username and where you have the sdk folder stored so for example, if you have it in your home folder and your user name in ubuntu is jo the string wold be
Code:
export PATH=$PATH:/home/jo/android-sdk-linux_86/tools
save the file, next to get adb to recognize your phone you need to create a udev rules file so open a terminal and enter
Code:
sudo gedit /etc/udev/rules.d/51-android.rules
this will open up a blank text file copy and paste this in it
Code:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
save the file and reboot now when you are back to the desktop you should be able to access your phone through adb.
If you still need help PM me and ill help u out on gtalk or aim
codejunkie78 said:
i think i may be able to help you with this one
first you need to add the location of the sdk folder to your .bashrc file
open a terminal an enter
Code:
gedit /home/yourusername/.bashrc
when the file opens up scroll all the way to the bottom and add this line to the bottom
Code:
export PATH=${PATH}:/home/xx/Desktop/android-sdk-linux_86/tools
replace /home/xx/Destop/ with your username and where you have the sdk folder stored so for example, if you have it in your home folder and your user name in ubuntu is jo the string wold be
Code:
export PATH=${PATH}:/home/jo/android-sdk-linux_86/tools
save the file, next to get adb to recognize your phone you need to create a udev rules file so open a terminal and enter
Code:
sudo gedit /etc/udev/rules.d/51-android.rules
this will open up a blank text file copy and paste this in it
Code:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
save the file and reboot now when you are back to the desktop you should be able to access your phone through adb.
Click to expand...
Click to collapse
Thanks. I had everything else setup. All I was missing was the udev rules. It works now. Just looked in the Wiki and the answer was there all along. i must have missed it before.
unCoRrUpTeD said:
Thanks. I had everything else setup. All I was missing was the udev rules. It works now. Just looked in the Wiki and the answer was there all along. i must have missed it before.
Click to expand...
Click to collapse
happy to help!
ok so i am having some of the same problem but i am trying to build a kernel using ubuntu 10.04 and so far eveything was going goo until i had to enter the command adb push config...........and i get comand adb does not exsist and it gives me a list of commands that work. But I need to use adb because of the android and i have tried just about eveything on this forum and i am not getting anything to work. Its wired i was able to root my phone and it had adb commands but when building a kernel it wont work can someone please help me i really wanna try and bulid my own kernel/rom to my likings instead of downloading a bunch of different ones. CAN SOMEONE PLEASE PLEASE HELP
krysalicea said:
ok so i am having some of the same problem but i am trying to build a kernel using ubuntu 10.04 and so far eveything was going goo until i had to enter the command adb push config...........and i get comand adb does not exsist and it gives me a list of commands that work. But I need to use adb because of the android and i have tried just about eveything on this forum and i am not getting anything to work. Its wired i was able to root my phone and it had adb commands but when building a kernel it wont work can someone please help me i really wanna try and bulid my own kernel/rom to my likings instead of downloading a bunch of different ones. CAN SOMEONE PLEASE PLEASE HELP
Click to expand...
Click to collapse
To edit a kernel you will need to get the boot.img either from your phone or from a nandroid.
THIS will give you everything
ok... i am a little confused to what "adb" is and how to get "su" (superuser) via a Terminal app that i downloaded for my phone.
I type "su" and and I get "su: not found" same with "adb"
what am i not understanding?
trying to follow http://forum.xda-developers.com/showthread.php?t=797397 but the commands are not working..
i am a little new to my captivate here, so help me out. I install 2.2 and i would like to root it..
thanks in advance, and forgive my ignorance.
ADB is the Android Debug Bridge. You can read what it is here Android Debug Bridge
To use this you must first install the Android Software Development Kit found here Download the Android SDK
Read up a bit on those and search the forums to find more help. Good luck.
I was / am in the same boat.
I spent 4 hours last night getting it figured out, I sure wish I could find an Android for dummies book.
Anyway, here is what cha do....
once you dowload the adb package unzip it to the root of your c drive, you may want to rename it to some thing shorter, I just called it android.
next download the root package from the root thread here and unzip the files and copy or cut them into the tools folder of the ADB folder you placed on the root of C:
navigate to the tools folder and copy adb.exe and adbwinapi.dll to the system32 directory in windows, you will need to reboot. This will allow you to use the windows cmd line.
now I am on window 7 64 so I ran the commond line as administrator to be safe. to do this click start all prograns accessorires right click cmd and select run as admin.
change directory to the tools folder, for me "cd c:\android\tools"
Connect phone be sure usb debugging is on in the phone, (settings, application, development. it will install drivers. (I manually installed the samsung 64 bit drivers I had downloaded from samsung)
from the command promt type adb devices and hope fully it will see your phone and return with the serial number and them you are good to go with following the instructions to root from there.
I hope this helps...
Cappy
the information on how to use this is really not in one place, I spent 4 hours last night searching all over to figure it out, just so I would not ask and be belittled because there is NOT good information.
I have even been searching for any books I can find on Android so I can understand how this system works, but have found no good ones yet.
I need a nice Android for dummies type thing.
I spent an hour just to figure out it still won't run right unless you change directory to the tools folder where everything is at. ( it's been like 15 years since I messed with dos).
Some where in the wiki or bibles or all the other how toos being posted we really need better information on how to use the tools and what they are.
Cheers
Jeff
http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=android+for+dummies
WOOT looks like they have one now...
Quick Tip: Once you get the Android SDK installed, you can add the location of the Tools directory to the Windows path variable and be able to call the programs from anywhere on your computer.
Masacrk said:
Cappy
the information on how to use this is really not in one place, I spent 4 hours last night searching all over to figure it out, just so I would not ask and be belittled because there is NOT good information.
Click to expand...
Click to collapse
Sorry you feel I was trying to belittle you. I was trying to be helpful by pointing you to the proper information. You know the old saying, "You'll never learn by letting others do it for you."
Sent from my SAMSUNG-SGH-I897 using XDA App
it's all good man I did not mean you.
I was taught along time ago that there are no dumb questions but it don't seem to hold true around here I have noticed.
Quess the new generation are not as patient or willing to help as mine was.
Ha ha ha. Guess I should have picked a better screen name.
Sent from my SAMSUNG-SGH-I897 using XDA App
ugg.. I dont get it.. I finaly got it to connect to the phone, but even in windows when i type in SU I get invalid command..
uggg..
i dont get it.. please help!
go to this thread
http://forum.xda-developers.com/showthread.php?t=797397
at the bottom of the first post you will see a link to Captivate2.2rootpack.zip.
http://forum.xda-developers.com/attachment.php?attachmentid=411708&d=1285997559
download , unzip, copy contents to the tools folder of the sdk package.
Also this thread was a help,
http://forum.xda-developers.com/showthread.php?t=502010
Cheers
Jeff
Masacrk said:
go to this thread
http://forum.xda-developers.com/showthread.php?t=797397
at the bottom of the first post you will see a link to Captivate2.2rootpack.zip.
http://forum.xda-developers.com/attachment.php?attachmentid=411708&d=1285997559
download , unzip, copy contents to the tools folder of the sdk package.
Also this thread was a help,
http://forum.xda-developers.com/showthread.php?t=502010
Cheers
Jeff
Click to expand...
Click to collapse
thanks.. i think i got that far,.. I copied the files into the tools folder and I still get
Code:
$ su,busybox,sqlite3
su,busybox,sqlite3
su,busybox,sqlite3: not found
$
i even copied the files to the android, and ran it from that folder.. still no luck
what am i doing wrong?!? gosh.. i never felt soo dumb about things like this before
eatonjb said:
thanks.. i think i got that far,.. I copied the files into the tools folder and I still get
Code:
$ su,busybox,sqlite3
su,busybox,sqlite3
su,busybox,sqlite3: not found
$
i even copied the files to the android, and ran it from that folder.. still no luck
what am i doing wrong?!? gosh.. i never felt soo dumb about things like this before
Click to expand...
Click to collapse
OK. took me a little while to figure this out, too. Not sure of your level of knowledge of the terminal. If I over-simplified please forgive me.
"Extract RootPack zip file" Did you do this? I think you did from you post. Make sure you've copied the files to your "tools" subfolder in the android sdk folder.
Click the start button, click run, type "cmd", press enter.
When that window opens type "cd.." and press Enter. Keep typing "cd.." and pressing Enter until the only thing you see at the prompt is "c:\"
Now navigate to the Tools folder where ever it is you put the android sdk.
I put mine at "c:\android_sdk" so I would type "cd c:\android_sdk\tools"
Plug your phone into your computer.
Go to home screen>menu>settings>applications>development and select "USB debugging".
At the command prompt type "adb devices" and your phone should return a value (the serial number).
If that works you should be able to follow the directions below.
It's been mention that you should be able to copy the commands from the web page and right click the terminal window and select "Paste". Makes everything faster, easier and more accurate. One other thing to mention: after you perform these steps and you want to do something else through adb where you're instructed to type "su" you'll need to open the SuperUser application on your phone and press "approve" after typing "su".
adb push rageagainstthecage-arm5.bin /data/local/tmp/rageagainstthecage-arm5.bin
adb shell
cd /data/local/tmp
chmod 0755 rageagainstthecage-arm5.bin
./rageagainstthecage-arm5.bin
(wait for you to get kicked from adb)
adb shell
mount -o rw,remount /dev/block/stl9 /system
exit
adb push su /system/bin/su
adb push busybox /system/bin/busybox
adb push sqlite3 /system/bin/sqlite3
adb push superuser.apk /system/app/superuser.apk
adb shell
cd /system/bin
chmod 4755 su
chmod 4755 busybox
chmod 4755 sqlite3
reboot
eatonjb said:
thanks.. i think i got that far,.. I copied the files into the tools folder and I still get
Code:
$ su,busybox,sqlite3
su,busybox,sqlite3
su,busybox,sqlite3: not found
$
i even copied the files to the android, and ran it from that folder.. still no luck
what am i doing wrong?!? gosh.. i never felt soo dumb about things like this before
Click to expand...
Click to collapse
those arent even commands. just random words you put into the terminal....
follow the instructions exactly like PersonOfKnownOrigin has posted. it works
I too was having trouble, turns out the files were extracted and were in a sub folder in the Tools folder so I copied and pasted them directly into the tools folder one by one, that worked great for me. Also, I find it easier to open command shell and use the Android Tools by holding the shift key and right clicking on the Tools folder and choose open command window here. I hope this helps.
I have a stupid path becaue my laptop messed up when I first got it and I haven't been able to fix it because DOS is difficult to me. It works fine but I am too lazy to type such a long path and if you are off at all it dosen't work.
just copy and paste the commands so you don't get them wrong, worked for me. The command is su then hit enter then enter the next command line and hit enter, works like a charm.
ok, I got it.. I misinturpted that the first line (the 3 commands in one line) was a command that I was supposed to run..
it was not..
dohh.. thanks guys for all the help... i felt kinda dumb, but now I think I am kinda smrt. I mean Smart!! (Simpsons Humor)
thanks again for the paitence.
Eaton
Okay so I got everything set up the way the android site says, and they way some other guides I have found said, but when I try starting up adb shell all I get is this error:
error: insufficient permissions for device
Anyone know what the problem may be? Thanks
Just a guess but sounds like it needs superuser and the phone isn't rooted
Sent from my Droid using XDA App
Yeah it sounded like that to me too, but the phone is definitely rooted, and I have the superuser app. I am running D1-MIUI v3.1 right now with no problems, and have run every other ROM under the sun. So that is what is really stumping me.
You need to add a udev android rules file so you can use adb and fastboot. Go to http://wiki.cyanogenmod.com/index.php?title=Howto:_Install_the_Android_SDK and follow the directions on how to set up udev. Run lsusb in a terminal while your droid is connected so you can pull the ID for it. the first 4 numbers are for vendor id and the last 4 are the device numbers. Reboot after you do this and adb and fastboot will both work. This applies for all android phones, just replace the vendor and product id #s and that's it. If you need help, feel free to follow me on twitter and I'll gladly help you all out.
I have written a very simple step by step instruction for that
http://menodev.com/mobile/debugging-your-android-device-on-linux/
Sent from my Milestone using XDA App
I always just start adb as root. Then after the server is started it can be called from a regular user.
Sent from my HERO200 using XDA App
do these commands to fix the issue
Code:
sudo gedit /etc/udev/rules.d/51-android.rules
then add this line to the file
Code:
SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", MODE="0666"
save, exit and reboot your computer.
should fix the issue
Solved:
thanks to a good friend of mine he directed me to this file on GRP dev-site
http://greenromproject.com/showthread.php?269-ADB-The-Easier-Way
open this file in ubuntu software manager, let the package install and reboot system, then adb should work in any directory
Original Post:
ok guys i really didn't want to do this... i followed over 6 different guides now and am getting confused.. there too many methods and they all do not work.... i keep getting .../adb no such file or directory
i spent the last 2 days trying to set up adb on my 10.10 ubuntu, 64-bit system... i edited the bashrc file with the correct path, even typed it in myself because of known issues with ' " ' those things.. i also made the 71-android.rules file with about 3 different variations of this
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
reboot the system, i ran adb kill-server and sudo adb start-server and im still getting message saying .../adb no such file or directory...
only thing i can think of to cause an issue is i updated the system, (not upgrade to 11.04) only update!! installed java jdk and all the needed parts for compiling roms... but just cant seem to get adb working
has anyone else had this type of issue or know how to solve it...? sdk version r12
please someone help
Click to expand...
Click to collapse
...
i keep getting .../adb no such file or directory
...
Click to expand...
Click to collapse
If you get this message, there is no need to look for autoconfig rules or something else, you need to check your path. Try to type
Code:
which adb
if adb cannot be found, you should do a
Code:
export PATH=$PATH:<path to your adb directory>
after that you should be fine for starting adb. If you would like to have it in your path permanently, you shoud add the line above to you .profile file in your home directory.
yeah i already did all that... added the correct path and everything... i tried all these diff methods and none worked, and none were even close to the same as far as what to add to bashrc and the rules.. but i got the issue solved thanks to a file i installed via update manager... rebooted system and adb worked fine
You are unable to just plug in your Nexus 4 in Linux but it is very easy to mount and unmount to move data to/from your sdcard. This is one option that will allow you to utilize Nautilis (or any other file browser) to copy files to/from your Nexus 4. This is written for Ubuntu, but should work the same for other Linux systems. Also, this should work for Nexus 7 and 10.
1. Enable Developer options and enable USB debugging.
2. Install necessary modules to your computer:
sudo apt-get install mtp-tools mtpfs
3. Configure 51-android.rules:
sudo gedit /etc/udev/rules.d/51-android.rules
paste the following at the end of the file (if the file does not exist then just paste):
#LG - Nexus 4
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"
#Samsung - Nexus 7 & 10
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
Save and exit.
4. Make the file executable:
sudo chmod +x /etc/udev/rules.d/51-android.rules
5. Restart udev
sudo service udev restart
6. Create mount point and permissions (will need to do this for other Nexus' if using for the 7 or 10)
sudo mkdir /media/nexus4
chmod 755 /media/nexus4
7. Plug in the Nexus 4 and make sure MTP is enabled.
8. Mount with the following command:
sudo mtpfs -o allow_other /media/nexus4
9. When you have completed your work you must unmount:
sudo umount /media/nexus4
Now each time you need to copy from/to your Nexus 4 to your Linux computer you only need to plug in and run 8, then 9 when you have completed your work.
Good info! I'll try it out on my Ubuntu laptop later.
Thanks!
Awesome. Thanks
sent from my straight out of limbo 2 Nexus 4 using XDA-premium
This isn't so much a Nexus 4 guide as a general Linux mounting guide, but still cool. Thanks!
First, thanks to the OP! Just wanted to add another way for linux.
Just install and run gMTP plug your phone in and click connect. It is in the Ubuntu software center or for other versions of linux at http://gmtp.sourceforge.net/
I prefer adb+qtadb. Better speed and stability compared to mtp i think.
Sent from my Blade using xda app-developers app
Thanks for that write up. On my gentoo box my galaxy nexus worked flawlessly but the nexus 4 did not. Hopefully this will do it!
Sent from my Nexus 4 using Tapatalk 2
Kaar3l said:
I prefer adb+qtadb. Better speed and stability compared to mtp i think.
Sent from my Blade using xda app-developers app
Click to expand...
Click to collapse
Yes QtADB works very nicely also. It requires a little more setup than gMTP, but you are correct that it is a little faster and stable.
Kaar3l said:
I prefer adb+qtadb. Better speed and stability compared to mtp i think.
Sent from my Blade using xda app-developers app
Click to expand...
Click to collapse
the3dman said:
Yes QtADB works very nicely also. It requires a little more setup than gMTP, but you are correct that it is a little faster and stable.
Click to expand...
Click to collapse
Never heard of that. What is it?
Generating random authentication keys
---------- Post added at 07:48 AM ---------- Previous post was at 07:47 AM ----------
Konsyst said:
This isn't so much a Nexus 4 guide as a general Linux mounting guide, but still cool. Thanks!
Click to expand...
Click to collapse
Haven't gotten my N4 yet but I'm gonna try this on my sIII.
Generating random authentication keys
Thanks for your work! very useful..!
Konsyst said:
This isn't so much a Nexus 4 guide as a general Linux mounting guide, but still cool. Thanks!
Click to expand...
Click to collapse
Not such a general Linux guide as a Debian-derivative guide.
Helpful nonetheless marty331 for the correct udev strings, thanks!
I personally think using sshfs and sshdroid is a much more stable solution. MTP support on Linux is... shoddy to say the least.
Thanks given anyway though.
It seems that mtpfs 1.1 is broken. I downgraded to 1.0 and it worked. However, there is usually lag for some reason whenever the screen is off.
I had MTP/PTP crash several sdcards of mine which required me to format them (no write permissions had no way to get that back.)
Ever since that I just use ADB (Android Debugging Bridge) there are several GUI front-ends available in the default deb/rpm repositories, or if you are comfortable with the terminal (and with ADB it's really really simple to master) you can just get the binary and put it in your bin folder and transfer it via that. Highly reliable, speed is about 2-3mb/s -- but it works.
I gave up on this on Debian Testing. My Galaxy Nexus would not mount no matter what udev rules I used and mtpfs is not a solution. Instead, I just use a ftp server on the phone and ftp things to it or push things using adb. I've also tried airdroid a few times. I would not mind trying the sshfs alternative either. Gonna check that one out.
jamcar said:
Never heard of that. What is it?
Click to expand...
Click to collapse
QtADB is just a GUI for ADB and it works very well. Search QtADB on Google and you will find the download page with instructions.
Sent from my Nexus 4 using xda app-developers app
OP's use of udev inspired me to come up with this solution using ADB.
I'll assume you have ADB installed. There's plenty of indepth guides for that elsewhere.
This tutorial will have you playing around in system directories on your Linux install. I tried to make this guide user friendly but you should have at least SOME knowledge of Unix like OSes before you even try this.
Not for the faint of heart.
Get http://https://play.google.com/store/apps/details?id=berserker.android.apps.sshdroid&hl=en from the play store. Enable USB debugging in the developer options on your phone.
Open SSHDroid on your phone and set your port to something other than 22. I use 2222.
Open a terminal window on your computer and elevate yourself to root (Preferably using su -. Otherwise use sudo su -.).
Now that we got that done, try logging into your phone to make sure everything works. It'll be something like
Code:
ssh -p2222 [email protected][yourPhone'sIP]
. If you get asked a password it probably works. Just hit ^C (Ctrl+C) to exit that password prompt since we don't need to go further yet.
Next you'll need to create a passwordless SSH login. Run
Code:
ssh-keygen -t rsa
. Just hit enter to use the defaults on all the questions, we don't need anything more.
Now run
Code:
scp -P2222 ~/.ssh/id_rsa.pub [email protected][yourPhone'sIP]:/emulated/storage/legacy/
. When it asks for the password just type "admin", though it should tell you that anyway.
If the file copied over successfully you should no be able to type
Code:
ssh -p2222 [email protected][yourPhone'sIP]
again and not be prompted with a password at all. Cool!
At this point it's recommended you go into the SSHDroid settings on your phone and untick the "Enable Password" box, though it's not required, especially if you want to ssh to your phone from other devices/computers.
Run lsusb and look for the line that says Google in it. You want to look out for something like
Code:
Bus 001 Device 070: ID 18d1:4ee2 Google Inc.
Copy the two alphanumeric codes before "Google Inc.". The first is your vendor ID and the second is your device ID. You might want to label them so you remember which is which.
Here's the scary part of the tutorial. Use your favorite text editor (preferably command line based) and create a new file at "/etc/udev/rules.d/85-android_mount.rules". Copy and paste this and edit to fit the IDs you got in the previous command.
Code:
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4ee2", RUN+="/usr/local/sbin/phone-mount -m" SYMLINK+="Nexus_4"
SUBSYSTEMS=="usb", ACTION=="remove", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4ee2", RUN+="/usr/local/sbin/phone-mount -u" SYMLINK+="Nexus_4"
It should be obvious where you need to put your Vendor and Device IDs now.
Save it and run these commands.
Code:
chmod +x /etc/udev/rules.d/85-android_mount.rules
chmod 775 /etc/udev/rules.d/85-android_mount.rules
chown root:root /etc/udev/rules.d/85-android_mount.rules
Now we need to create another file at "/usr/local/sbin/phone-mount" and paste this inside.
Code:
#!/bin/bash
export PATH=/opt/android-sdk-update-manager/platform-tools/:$PATH
case "$1" in
-m )
adb wait-for-device
adb forward tcp:2222 tcp:2222
# If you have SSHDroid Pro you just need to add "pro" to the "sshdroid".
adb shell am broadcast -a berserker.android.apps.sshdroid.command.START
sshfs -p2222 -o allow_other,idmap=user [email protected]:/storage/emulated/legacy/ /media/nexus4
exit 0
;;
-u )
umount /media/nexus4
exit 0
;;
esac
We need to modify the permissions for this file too.
Code:
chmod +x /usr/local/sbin/phone-mount
chmod 775 /usr/local/sbin/phone-mount
chown root:root /usr/local/sbin/phone-mount
Almost done. If you don't already have sshfs installed on your Linux install then do so now. You'll also need to enable the "allow_other" option. For my distro it's as simple as editing "/etc/fuse.conf" and uncommenting the "user_allow_other" line. Your results may vary.
Now finally we need to create the actual folder you'll be mounting your Nexus 4 at. If you blindly followed my guide that'll be /media/nexus4.
Code:
mkdir /media/nexus4
chown root:users /media/nexus4
chmod 775 /media/nexus4
Now all we need to do is restart udev. Right now you'll want to make sure the phone is unplugged, then restart your udev daemon. For Debian based distros like Mint, Ubuntu, Debian, Crunchbang, etc. you'd run.
Code:
service udev restart
After it's done restarting you can plug your phone in, wait a few seconds, and hopefully have your phone automount to /media/nexus4 .
You may have to improvise in a few spots because all distros are not the same, especially when you compare something like Gentoo to Debian. If you're having problems with sshfs chances are your answer is on Google. You'll honestly get better help there than having me trying to guess your system.
Also note this is a pretty hacky and dirty way to do things. Don't go yanking your phone's USB cord out without unmounting "/media/nexus4" first. You shouldn't have any problems if you're not reading or writing anything, but there is the potential for data loss and crashing udev.
i got this error at the last step
Code:
Attempting to connect device
PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
LIBMTP libusb: Attempt to reset device
Android device detected, assigning default bug flags
Listing File Information on Device with name: (NULL)
fuse: bad mount point `/media/nexus4': Transport endpoint is not connected
i dont have a nexus 4 and im not on linux. but dermann made a script for this i think.
http://forum.xda-developers.com/showthread.php?p=33499930#post33499930
I've been using AirDroid. Works great for transferring files.