09-28-2013 05:01 PM
36 12
  1. ohiomoto's Avatar
    Let me say this first:

    This guide is for Linux users that want to use their favorite OS to work with their phone. The information found here can be found elsewhere on the Internet, but it did take a little work to dig it up so I figured I would put together a guide that that a noob should be able to follow. Please keep in mind, that I'm a noob also. I am a programmer by trade and I have used Linux for several years now, but I don't claim to be an expert. I should be able to help with minor problems, but you need to follow the steps here exactly as I'm just compiling the best sources I could find. I will cite those sources so that you can check them out for yourself.

    1) Installing the Android SDK/ADB/Fastboot on Linux (64-bit Lubuntu 11.10 in this case).
    2) How to Unlock and Root your Galaxy Nexus.
    3) How to return your Galaxy Nexus to Factory Sate.
    4) User Issues and Workarounds.*

    *Here is the best part, I will try to keep a list of user Issues and Workarounds!

    [HL]This is where you can help. If you are having an issue that is not solved with one reply, please put it in another thread and post the link here. I will post the link here so that others can use it to help you. Once you are sure your problem is solved, simply mark that thread solved. This way the discussion, progress and solutions can stay on topic in that thread and it will be easier for you and others to follow. If you end up solving the problem within this thread, please post a summary of the problem and the solution and I will put a link to that post so that others can find it.

    Doing this will make this thread more useful because other users won't have to dig through pages and pages of replies to see if someone else had the same problem as you did. Think of it as paying it forward. [/HL]

    Lastly, if there are any experienced Linux Rooter and ROM'ers out there, please reserve a post or two on the first page of this thread that you could use to add to this guide. I would love the help and will be sure to link your post.

    EDIT: I realize the threads look long, but there isn't all that much to do. I'm just being very verbose so that anyone should be able to follow the guide. I'm trying to make it "so easy a caveman could do it" so please bear with me.
    01-04-2012 10:44 PM
  2. ohiomoto's Avatar
    1) Installing the Android SDK/ADB/Fastboot on Linux with 64-bit support!

    EDIT: You could follow this guide if you like or you could use a script will take care of it for you. You can find more information HERE. I used it with 64-bit Lubuntu 12.04 and it worked great.

    I found that working with the Galaxy Nexus with Linux was actually really easy once I figured out how to get the Android SDK working with my 64-bit Linux system. I used 64-bit Lubuntu 11.10 which is just a light weight version of Ubuntu so this guide should work for Ubuntu users.

    (If you are using something other than Ubuntu, then you probably don't need this guide. If you feel your distro of choice needs it, please add a post or a dedicated thread for it and I will add a link or simply add the information to this guide.)

    This part of the guide should get your computer to the point where you can unlock, root and restore your phone. This will probably be the hardest part of the entire process and it isn't even that hard. I know this looks like a lot of work, but it shouldn't take more than 30 minutes or so. Once you get this done you will be rewarded because everything after this will be easy peasy!

    WARNING: If the thought of typing commands in a terminal scares you to death, then using Linux to Unlock and Root you phone might not be for you. There are some great "one click" methods for Windows out there if that's more your style.

    1) Install Java
    You need to get a Java SDK on your machine.

    To see if you have a Java JDK, open your terminal and type in the following command:
    [BOX="Command:"]java -version[/BOX]
    (If you have never used the terminal in Ubuntu, you should find it in your accessories menu or by pressing Ctrl+Alt+T. You can copy and past the command and press enter. Also, if you are typing in commands or directories, you can type the first few letters and double press Tab for auto-complete options.)

    If you have Java JDK, you will see something like this:
    [BOX="Command:"]Aspire-3820:~$ java -version
    java version "1.6.0_23"
    OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10)
    OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)[/BOX]

    I'm using OpenJDK6.0 but any Java JDK should do. In Lubuntu you can use Synaptic Package Manager to install the OpenJDK. If you are using Ubuntu (without Synaptic) you may want to check out the first reference at the bottom of this post.

    You could also use Google to find a guide like this one: how to install jdk on Ubuntu 11.10 Which simply says to type the following command in your terminal to get OpenJDK:
    [BOX="Command:"]sudo apt-get install openjdk-7-jdk[/BOX]

    Or this for the Sun JDK:
    [BOX="Command:"]sudo add-apt-repository ppa:ferramroberto/java
    sudo apt-get update
    sudo apt-get install sun-java6-jdk sun-java6-plugin[/BOX]

    2) Install Android SDK/ADB?Fastboot
    Now you need to download the Android JDK for Linux from here: Android SDK | Android Developers

    Once it's done downloading, open your file manager and go to Downloads. Find the zip you just downloaded, right click the file and choose "Extract Here" to unpack it. You will then have a folder named android-sdk-linux. Copy the file and paste it in your home directory. (You can delete the zip file you pasted if you want to clean things up a bit.) The end result is that you have a android-sdk-linux folder to your home directory.

    The command lines to accomplish this same task would look like this:
    [BOX="Command:"]cd Downloads
    tar xfvz android-sdk_r16-linux.tgz
    mv android-sdk-linux/ ~[/BOX]

    Now we need to cd (change directory) to the android-sdk-linux folder and run the update script:
    [BOX="Command:"] cd ~/android-sdk-linux/tools/
    ./android update sdk[/BOX]

    Click install and wait for it to do its thing. This will take a little while. When finished you should find a folder called "platform-tools" inside your android-sdk-linux directory. Inside "platform-tools" you should see "adb" and "fastboot". (If for some reason you don't see fastboot, you can download it HERE. Extract the contents, place it in the "platform-tools" folder and rename it to fastboot.)

    While you wait for the update to finish, lets get the Galaxy Nexus ready for work. You need to make sure USB debugging is enabled. You do this on your phone with settings/applications/development menu options and checking the USB debugging box. Now wait until the SDK is finished updating and we will test your phone.

    If you are on 64-bit Linux, you will need run the following command before moving on to the next step:
    [BOX="64-bit only Command:"]sudo apt-get install ia32-libs[/BOX]

    When the updated is complete, plug you phone (power should be on) into the USB port on your computer. DO NOT choose USB storage. You should see the usb debugging connected message in your notifications screen.

    Now lets see if ADB sees your phone:
    [BOX="Command:"]cd platform-tools/
    ./adb devices[/BOX]

    If you are lucky, you will see something like this:
    List of devices attached


    This means ADB is working! You can continue to step 4. The rest of us will need to set up uDev rules before ADB sees or phone.

    3) Setting up uDev rules (if needed)
    This shouldn't be too difficult. First make sure you don't already have android.rules set up.
    [BOX="Command:"]ls /etc/udev/rules.d/[/BOX]

    If you find something with "android.rules" you should probably rename it with the mv command. For example I'll just add .bak to mine:
    [BOX="Command:"]mv /etc/udev/rules.d/91-android.rules /etc/udev/rules.d/91-android.rules.bak[/BOX]

    This next command will create a new android.rules file. If your Linux distro doesn't have gedit, you can try leafpad (in Lubuntu) or use nano, vim, etc:
    [BOX="Command:"]sudo gedit ~/etc/udev/rules.d/99-android.rules[/BOX]

    Now paste the following into the file:
    [BOX="Copy and paste:"]#Acer
    SUBSYSTEM=="usb", SYSFS{idVendor}=="0502", MODE="0666"
    SUBSYSTEM=="usb", SYSFS{idVendor}=="413c", MODE="0666"
    SUBSYSTEM=="usb", SYSFS{idVendor}=="0489", MODE="0666"
    SUBSYSTEM=="usb", SYSFS{idVendor}=="091E", MODE="0666"
    SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
    SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
    SUBSYSTEM=="usb", SYSFS{idVendor}=="12d1", MODE="0666"
    SUBSYSTEM=="usb", SYSFS{idVendor}=="0482", MODE="0666"
    SUBSYSTEM=="usb", SYSFS{idVendor}=="1004", MODE="0666"
    SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", MODE="0666"
    SUBSYSTEM=="usb", SYSFS{idVendor}=="0955", MODE="0666"
    SUBSYSTEM=="usb", SYSFS{idVendor}=="10A9", MODE="0666"
    SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"
    SUBSYSTEM=="usb", SYSFS{idVendor}=="04dd", MODE="0666"
    #Sony Ericsson
    SUBSYSTEM=="usb", SYSFS{idVendor}=="0fce", MODE="0666"
    SUBSYSTEM=="usb", SYSFS{idVendor}=="19D2", MODE="0666"[/BOX]

    Save the file and close your editor. Now lets change permissions for android.rules:
    [BOX="Command:"]ls /etc/udev/rules.d/sudo chmod a+r /etc/udev/rules.d/99-android.rules[/BOX]

    Now make sure your phone is not plugged into your computer and restart uDev and ADB:
    [BOX="Command:"]sudo service uDev restart
    ./adb kill-server
    ./adb start-server[/BOX]

    Now ADB should work. Try the devices command again:
    [BOX="Command:"] cd platform-tools/
    ./adb devices[/BOX]

    If ADB still doesn't see your phone please make sure you ran all of the commands successfully. You may need to change the uDev rules. There are a couple of different examples used in the links I referenced. Please read those before posting here. If you need to change the uDev rules, simply open the file as you did above and add the new rules to your file and save it.

    4) Make ADB and Fastboot work from any directory
    Doing this step will allow you to run ADB from anywhere meaning that you won't have to be in "~/android-sdk-linux$ cd platform-tools/" directory to run it and you won't need the "./" in front of the command either.

    Type (or paste) the following command in the terminal (any directory will work)
    [BOX="Command:"]sudo gedit ~/.bashrc[/BOX]

    AND paste these lines at the bottom of the file:
    [BOX="Copy and Paste:"]# Android tools
    export PATH=${PATH}:~/android-sdk-linux/tools
    export PATH=${PATH}:~/android-sdk-linux/platform-tools[/BOX]

    Now make sure your phone is not plugged into your computer and restart ADB:
    [BOX="Command:"]source ~/.bashrc
    ./adb kill-server
    ./adb start-server

    Now plug your phone in, cd to your home directory and test ADB:
    adb devices[/BOX]
    NOTE: If this doesn't work after restarting adb, try rebooting your system. It should work after that.

    If that works, congratulations! You are now set up to easily work with your phone in Linux.

    If you are still having trouble, please read the referenced links. If you need to ask a question, please post here. If the question turns into it's own topic, consider taking it to another thread and post it here so I can create a link below. That will make it easier to get help and more useful for others who may experience the same problem later on.

    Ubuntu 11.10 and ADB and fastboot
    Step by Step OEM Unlock and Root
    Download the Android SDK
    Installing the SDK
    uDev Rules for Any Device! (No more starting adb with sudo)
    More complete uDev rules in case you need it.
    [GUIDE] ADB Workshop and Guide for everyone
    Jubakuba likes this.
    01-04-2012 10:45 PM
  3. ohiomoto's Avatar
    WARNING: Please read all of the instructions carefully.
    2) How to Unlock and Root your Galaxy Nexus
    This part is easy once you can ADB into your phone. But before you do, you should make sure your phone is up to date first.

    1) Downloads
    Download the CDMA version of CWM Root and Recovery: http://download.clockworkmod.com/rec...5.0.4-toro.img
    Download the Superuser package: http://download.clockworkmod.com/test/su.zip

    2) Unlock your phone
    Be careful not to move your phone or unplug the usb cable while you do this.

    Make sure USB debugging is enabled. Plug in your phone if it isn't already and type the following two commands:
    [BOX="Command:"]adb reboot bootloader
    sudo fastboot oem unlock[/BOX]
    The first command takes you to the fastboot screen of your phone. If it didn't work, you can shut the phone down and hold the [power + volume up + volume down] buttons until the phone vibrates. This should get you to the fastboot screen. Once there you can run the fastboot command.

    The rest of these steps will be need to be done on your phone:

    1. You will get a screen asking you if you want to unlock the bootloader. READ THIS SCREEN. If you DON'T read it you WON'T know what to do! Do what it says and you should go back to the fast boot screen. At the bottom of the screen, it should say "unlocked' in red letters.
    2. Now press [volume down] until you get the "recovery mode" option and press the [power button] to enter that selection. After a few seconds, you should see a blank blank screen with an open android.
    3. Next press the [volume up + volume down + power] all at the same time to get to the next menu. (Try not to press the power button first by accident.)
    4. Once in that menu, use the volume key to select "wipe data/factory reset" and press the power button. (If you get errors related to cache, go back and wipe cache and then redo the factory reset.)
    5. Use the [volume down] button to select "Yes--delete all user data" and press [power] to enter. Wait for it to finish (about 5 or more minutes).
    6. Select "reboot system now" and press power. Now wait for it to reboot. It might take some time so be patient and don't panic!

    When your phone reboots you will see the welcome screen and you will need to sign back into your Google account. You will probably notice that you also lost any personal settings like folders, widgets and wallpaper, etc.

    3) Install CWM and ROOT
    Next we need to install Superuser (root) and clockwork recovery (restore). Keep in mind that you can skip rooting your phone here if you are going to flash a ROM that is rooted.

    Make sure USB debugging is enabled. Next, cd into the directory that you saved the su.zip and CWM toro image. We will use ADB to push the file to the sdcard directory on your phone and then Fastboot to install CWM:
    [BOX="Command:"]adb push su.zip /sdcard/su.zip
    adb reboot bootloader
    sudo fastboot flash recovery recovery-clockwork-[/BOX]

    Now do these steps from your phone:
    1. Press [volume down] to select "recovery mode" and then press [power] enter the selection.
    2. Use [volume] to select "install zip from sdcard" and press [power].
    3. Press [power] and select "choose zip from sdcard"
    4. Select the su.zip from your sdcard
    5 . Select "Yes -- Install su.zip" in the next menu.
    6. Select "reboot phone now"cd

    4) Keep CWM around (optional)
    If your phone got the 4.0.2 OTA update, you will need to do the following to keep CWM around. If you are going to flash a ROM, you can skip this step.

    Type each command in this list:
    [BOX="Command:"]adb shell
    mount -o rw, remount /system
    mv /system/etc/install-recovery.sh /system/etc/install-recovery.bak

    That's it!

    Step by Step OEM Unlock and Root
    Jubakuba likes this.
    01-04-2012 10:45 PM
  4. ohiomoto's Avatar
    3) How to return your Galaxy Nexus to Factory Sate.

    Something might go wrong or you need to return your Galaxy Nexus. This is what you need to do to restore it to STOCK 4.0.2 ICS, just like the day you got it.

    1) Downloads
    Download the Android 4.0.2 (ICL53F) Factory Image Zip File HERE

    To check the MD5, cd to the directory where you downloaded the file and run the md5sum command:
    [BOX="Command:"]cd ~/Downloads
    md5sum mysid-icl53f-factory-65895fa8.tgz[/BOX]
    MD5: bafc4d3c5faa9822f76a5313fc91f743

    2) Extract the files
    To extract the files you can use the file manager, right click and choose extract here or run this command:
    [BOX="Command:"]tar xfvz mysid-icl53f-factory-65895fa8.tgz[/BOX]
    You can move the files to another place if you want.

    3) Flash the ROM
    Now cd into the folder containing the extracted files and put the phone into fastboot mode:
    [BOX="Command:"]cd mysid-icl53f/
    adb reboot bootloader[/BOX]

    Next, flash the new bootloader, radio, CDMA radio making sure to reboot the bootloader each time.
    1. Bootloader image:
    [BOX="Command:"]sudo fastboot flash bootloader bootloader-toro-primekk15.img
    sudo fastboot reboot-bootloader[/BOX]
    2. Radio:
    [BOX="Command:"]sudo fastboot flash radio radio-toro-i515.ek02.img
    sudo fastboot reboot-bootloader[/BOX]
    3. CDMA radio(this one takes a couple minutes so don't panic):
    [BOX="Command:"]sudo fastboot flash radio-cdma radio-cdma-toro-i515.ek05.img
    sudo fastboot reboot-bootloader[/BOX]

    And then update the image (this one takes a few minutes and reboots a few times):
    [BOX="Command:"]sudo fastboot -w update image-mysid-icl53f.zip [/BOX]
    When it's done you will be at the Android Welcome screen. You will need to set up your phone now.

    You now have a fresh factory image on the phone, but it's still unlocked. If you want to look it, see the next step. If not you are finished.

    4) Lock the Bootloader (optional)
    If you want to lock the bootloader, make sure USB Debugging is still enabled on your phone (Settings/Developer Options) and run the following commands:
    [BOX="Command:"]adb reboot bootloader
    sudo fastboot oem lock[/BOX]
    When you are done press the power button and you are finished.

    Return to Factory State (Unroot and Relock)
    Jubakuba likes this.
    01-04-2012 10:46 PM
  5. ohiomoto's Avatar
    4) User Issues and Workarounds.


    If you are having an issue that is not solved with one reply, please put it in another thread and post the link here and I will post the link here so that others can use it to help you. Once you are sure your problem is solved, simply mark that thread solved. This way the discussion, progress and solutions can stay on topic in that thread and it will be easier for you and others to follow. If you end up solving the problem within this thread, please post a summary of the problem and the solution and I will put a link to that post so that others can find it.

    Doing this will make this thread more useful because other users won't have to dig through pages and pages of replies to see if someone else had the same problem as you did. Think of it as paying it forward.

    Look here to see who needs help or to find solutions to your problems:
    links go here
    Jubakuba likes this.
    01-04-2012 10:46 PM
  6. ohiomoto's Avatar
    Reserved just in case.
    01-04-2012 10:47 PM
  7. mfischer2's Avatar
    On my phone, once I get to the fastboot menu, adb can no longer see my device and running the command "fastboot oem unlock" won't work. It just hangs saying "< waiting for device >". Any ideas?
    01-16-2012 10:10 PM
  8. ohiomoto's Avatar
    Go back into your phone and make sure USB debugging is checked.
    01-16-2012 10:33 PM
  9. mfischer2's Avatar
    Yes, it is enabled. adb works fine when the phone is not in the bootloader. Once I'm in the bootloader, adb doesn't see any devices, making it and fastboot useless. (note: I'm not a total noob, I rooted my original droid a few times, this is obviously a different process).
    01-16-2012 11:08 PM
  10. mfischer2's Avatar
    Okay, I fixed it. Here's the note for your notes.

    I ran "fastboot devices" and saw I had permission issues:

    mfisch@caprica:~$ fastboot devices

    Then, I re-ran it using sudo and it worked, so I then did sudo fastboot oem unlock and that worked too. Perhaps add to your notes?
    kilaka likes this.
    01-16-2012 11:15 PM
  11. ohiomoto's Avatar
    Sounds like it could be a problem with your uDev rules. I noticed there are different setups. You may want to look at some of the references.

    Anyway, glad you got it to work. I'll add that to the information in the guide.
    01-16-2012 11:26 PM
  12. goater1220's Avatar
    Im having an issue, Yes I am a noob to linux and Im trying to get my gnexus work on ubuntu 11.04. I followed all the directions and downloaded everything that you said I needed. I get to the part where I check if adb can read my device and set up the udev rules but it wont work for me. When I try the device command it says no such file or directory. Any help is greatly appreciated
    02-27-2012 09:00 PM
  13. ohiomoto's Avatar
    Sounds like you are not in the correct directory to run the command or you didn't install the sdk.

    Make sure you are in the android-sdk-linux/platform-tools directory and then type "ls" to list the contents of the directory. (You can use the which command to find it. Mine is located in my opt directory.) You should see "adb" in the list and it should be green.

    Aspire-3820:~$ which adb
    Aspire-3820:~$cd /opt//android-sdk-linux/platform-tools/
    Aspire-3820:/opt/android-sdk-linux/platform-tools$ ls
    aapt  adb  aidl  dexdump  dx  fastboot  lib  llvm-rs-cc  NOTICE.txt  renderscript  source.properties
    If adb is there in green type the adb devices command.
    Aspire-3820:/opt/android-sdk-linux/platform-tools$ ./adb devices
    List of devices attached
    If you see the "List of devices attached" prompt, you know adb is working. If it finds your phone your good. if not, then you will need to set up udev rules.
    02-27-2012 09:34 PM
  14. goater1220's Avatar
    I'm not sure if that's it. Maybe I'm doing something wrong since I'm so new to this but when I do the ./android update sdk. It starts then I get in red letters stopping adb server failed(code-1) but then continues to download and install all the files. That takes a couple hours . When its all done I get ....
    SSL peer shut down incorrectly
    Stopping adb sever failed(code-1)
    Unable to run adb cannot run program /home/mike/android-sdk-linux/platform tools/adb:Java.io.loexception:error=2, no such file or directory
    starting adb server failed (code-1)
    All that is in red. I have no idea what I did wrong since I followed your directions and just copied and paste the commands
    02-28-2012 12:42 PM
  15. ohiomoto's Avatar
    I don't think it should take 2 hours to update the sdk. Type
    ls  /home/mike/android-sdk-linux/platform tools/
    What do you see?
    02-28-2012 01:00 PM
  16. goater1220's Avatar
    aapt aidl dx lib notice.txt source.properties
    adb dexdump fastboot llvm-rs-cc renderscript
    02-28-2012 01:05 PM
  17. ohiomoto's Avatar
    It looks like it's there. Is adb green? Have you tried rebooting the machine?
    02-28-2012 01:24 PM
  18. goater1220's Avatar
    It is there in green but no I havent restarted my machine.
    davey11 likes this.
    02-28-2012 01:27 PM
  19. ohiomoto's Avatar
    Try these running these two commands.

    cd  /home/mike/android-sdk-linux/platform tools/
    ./adb devices
    If they fail, try running this command or reboot the system and try again.
    sudo reboot now
    02-28-2012 01:28 PM
  20. goater1220's Avatar
    for some reason it worked but after I tried finishing your steps from 4 down now its not working. I did ls and it says adb_has_moved.txt and its in white
    02-28-2012 02:06 PM
  21. goater1220's Avatar
    actually now Im gettingall this.....mike@ubuntu:~$ cd
    mike@ubuntu:~$ adb devices
    List of devices attached
    0146910907013016 device

    02-28-2012 02:26 PM
  22. ohiomoto's Avatar
    Sound like you might be having some Linux noob issues, but that's ok. I think what might be happening is that you need to be in the directory you are going to run the command from. So, if you want to run adb (before step 4) you need to "cd" to the directory it's located in. Once there, you type "./" + the command to run that program. I suspect that you might not have been in the correct directory to run the command. That's pretty common when we first start using the command line terminal.

    If you followed the steps correctly from 4 down and it doesn't work, there could be a a couple things you need to do. The first is to make sure that you paste the correct location into the bashrc file. For me it was this:
    	# Android tools
    export PATH=${PATH}:~/android-sdk-linux/tools
    export PATH=${PATH}:~/android-sdk-linux/platform-tools
    You might want to try this:
    	# Android tools
    export PATH=${PATH}:/home/mike/android-sdk-linux/tools
    export PATH=${PATH}:/home/mike/android-sdk-linux/platform-tools
    02-28-2012 02:27 PM
  23. ohiomoto's Avatar
    Congratulations! I have to run, but will check in later if you need more help.
    goater1220 likes this.
    02-28-2012 02:29 PM
  24. goater1220's Avatar
    I didnt use those commands you gave me to get that... LOL I really dont know what Im doing on linux I just downloaded ubuntu 11.10 to run along side windows so I can maybe learn how to use ubuntu. If I take it right I guess adb is reading my phone? I really appreciate all the help but when you do have time would you be able to tell me or point me in the right direction on how I put files on my phone, since Im use to using windows and putting files on my device that way. Thanks again!!!!

    If you think it would be easier to talk on gtalk let me know.
    02-28-2012 02:39 PM
  25. ohiomoto's Avatar
    To see the directories on your phone:
    adb shell
    To put files on you phone you need to be in the directory of your computer where the file is stored or use the path to get to it. One trick to help find file paths is to type the first letter or two of a directory or file and then double tap the tab key. It will either finish the directory of file name or show you all the names that match what you started. Then you simply add the correct letter or letters and tab again to finish adding the path.
    adb push file.zip /sdcard/file_on_the_phone.zip
    Where "file.zip" is the file you want to put on the phone and "/sdcard/file.zip" is the location and name you will store the file as on your phone. You can name it anything you want.
    goater1220 likes this.
    02-29-2012 07:40 AM
36 12