Thursday, April 19, 2012

Easy Galaxy Nexus Root

I recently discovered an easy way to root the Galaxy Nexus. I just got my wife a GN and needed to root it so that she'd have decent battery life. While scanning posts I had used for my previous GN rooting, I noticed a new, "simple" approach which did not require unlocking the bootloader. As noted, the major caveat is that this only works with ICS 4.0.2 or earlier. Since my wife's phone came with 4.0.4, I decided to flash it back to 4.0.2 before proceeding. See the nexus factory images page and my post on flashing to stock. I used the 4.0.2 build (ICL53F). After flashing, I re-locked the bootloader by re-entering fastboot mode (power off, then hold VOLUME UP + VOLUME DOWN while pressing POWER until you feel the phone vibrate) and issuing fastboot oem lock from my computer.

Once you are on 4.0.2, download the simple root package referenced at the bottom of the Android Forums post. Don't forget to turn on USB Debugging on your phone (under "Developer options" in Settings). Before running the root script, I checked that adb was working properly by running adb devices and observing a (16-digit hex) device id. See my original Nexus rooting post if you get nothing or lots of question marks. I found that rooting was as simple as running the root-unroot-for-linux-osx.sh script that came with the "simple" package. Kudos to scary alien for making it so easy. Leave me a comment if it doesn't work for you---I'll try to help.

Tuesday, February 7, 2012

Flashing the Galaxy Nexus to Stock

After rooting my Galaxy Nexus and removing some "system" apps, I learned that once you do that, you can no longer take system updates. Also, if you install an alternative "recovery" ROM (like ClockWorkMod), my understanding is that you cannot take updates. Yet, the phone will still prompt you for system updates, attempt to install them, and then fail upon reboot, leaving you with what seems to be a dead phone (you'll see a robot on it's back with chest open and a floating red exclamation point within a triangle). Not exactly what I'd call a great user experience.

My primary goal with rooting was to extend battery life and I believe most of my battery savings came from disabling services using the Autostarts app. IIUC, using the Autostarts app does not disable the ability to take updates. So, I decided to flash my GN back to stock so that I could once again take system updates and get rid of the annoying update reminders.

To get back to stock, I grabbed the 4.0.1 (ITL41D) yakju package from the factory images page (since I have a GSM Nexus) and unzipped it.

Note that I'm running Linux---I would not recommend trying this unless you are also running Linux and are generally familiar with the Linux command line. I would also recommend that you have adb and fastboot installed in a location that is part of your $PATH. fastboot is necessary; adb will help make sure you can access your phone.

After unpacking, I checked whether I could access my phone:

$ adb devices
* daemon not running. starting it now *
* daemon started successfully *
List of devices attached 
0146B5BB04002013        device
So far, so good. If you don't get any devices or get "???????????", see my post on rooting the GN. Next, I shut down my phone, then booted into "fastboot" mode by holding VOLUME UP and VOLUME DOWN buttons, then pressing the POWER button. Fastboot mode shows a large green robot with his chest open. It also says "Fastboot mode" in small print toward the bottom. Next, checked that I could access the phone:
$ fastboot devices
0146B5BB04002013        fastboot
Finally, I ran the flash-all.sh script from the 4.0.1 stock package. Well, actually, I copied the commands from flash-all.sh one-by-one. The first two "flash" commands went quickly. The last took a while as it had to copy and install the 181M image. I watched as my phone finished installing then went through its boot sequence a twice. Finally, I got the new user tutorial. My phone is back to 4.0.1 stock. Yeah!

Note: I previously tried using the 4.0.2 stock image, but found that I wasn't able to root my phone with that image.

Note: After rooting and turning off many services via Autostarts, I was successfully able to apply a system update (ITL41F) to my phone.

Note: I successfully used the manual method to root my phone this time.

Wednesday, January 18, 2012

CyanogenMod and Android Debug Bridge

After many tries, I finally got CyanogenMod (7.2 PlayfulGod 20110913 using ClockWorkMod 3.0.2.8) on my (old) Huawei Ascend using these instructions and the "600" CM ROM from these handy links. Note that you need to install both the CM ROM zip and the gapps zip. And you must be rooted and have ClockWorkMod installed first. It is certainly a huge improvement over stock. It's as fast as what you get by removing all the bloatware plus there are a ton of extra customization options that aren't in the regular Android release. I'm not going to go into all the details, but I will say that I found being familiar with Android Debug Bridge (adb) to be extremely helpful. Most (if not all) "mod" packages include both adb and fastboot. The adb tool can be used to put files on the phone, install applications (using the .apk file rather than from Market), and execute arbitrary commands on the phone using the shell functionality of adb. I found it educational to run the shell and poke around at the filesystem (ls and cd work).

For reference:

  • VOLUME UP + SEND/CALL + POWER: boots the Ascend into "recovery" mode
  • VOLUME DOWN + HANG UP + POWER: boots the Ascend into "fastboot" mode (only "Huawei" screen will display---remove battery to turn phone off)

Sunday, January 8, 2012

How I Rooted my Samsung Galaxy Nexus

After seeing my battery in the "red" barely more than 24 hours after a full charge, I decided it was time to take action. I had previously rooted two phones and managed to significantly extend the battery life from 1-2 days to 5+ days. So, last night I sat down to root my Galaxy Nexus. Rooting the Nexus is a bit different from other phones I had rooted. Instead of running a special app (like Gingerbreak), the idea is to unlock the bootloader, then boot to a special image that gives you read/write access to /system, and install the su binary and Superuser app.

I used scary alien's HowTo as my guide. The first thing I did was to see whether I could run the adb utility. I downloaded the sdk-tools.zip package, and made the linux versions of the tools executable. But, when I ran ./adb devices, I got "???????? no permissions". I found that I could make it work with "sudo", but searched for and found a better way---give myself USB permissions to the device. Information can be found under "Configuring USB Access" in the Initializing a Build Environment document. (After editing "<username>",) I copied the two "Galaxy Nexus" lines to /etc/udev/rules.d/51-android.rules (new file), disconnected and reconnected my phone, and was then able to detect my device with ./adb devices.

The next step for me was to unlock the bootloader. This was as easy as described by the HowTo guide. I booted my phone into "fastboot" mode by powering down my phone, then holding down the VOLUME UP, VOLUME DOWN, and POWER buttons. Once I was in "fastboot", I confirmed that the fastboot utility could "see" my device, then issued the ./fastboot oem unlock command from my computer. At the bottom of the phone's screen I could see that the bootloader had been unlocked. From there I had a decision to make---what method to use? After realizing that the essential file for the "manual" method was missing, I decided on the ClockworkMod method.

I downloaded the su.zip and recovery-clockwork-5.5.0.2-maguro.img, then soft-booted into the ClockworkMod: ./fastboot boot recovery-clockwork-5.5.0.2-maguro.img. I followed the instructions to ensure that /sdcard was mounted, but kept getting the error message: "E:can't mount /sdcard/". I read that restarting might fix the problem, so I opted to reboot ClockworkMod (under "advanced" menu). Bad idea. I ended-up with my phone in a frozen state---a green robot on its back with its chest open with a red triangle with exclamation point floating above. I had to remove the battery and leave it out for appx. 60 seconds (until the screen went blank) before I could then restart the phone.

The restart took a while. As the HowTo describes, it goes through the startup sequence, then restarts and goes through the startup sequence again. When it was done, it led me through the new phone tutorial I got when I first turned-on the device. All my settings had been reset (as expected). After going through the tutorial, I tried the ClockworkMod method again. This time I did not get the /sdcard errors and the su.zip install appeared successful. But, when I restarted back into "normal" mode, I couldn't get root privileges.

My phone otherwise seemed to be fine, so I moved on to the Superboot method. After downloading the superboot package and unzipping it, I booted my phone into "fastboot" mode, checked that the fastboot utility recognized my phone, and ran install-superboot-linux.sh (from my computer). My phone restarted and I checked that I had root privileges by trying to change settings via the Autostarts app. Yes! It worked!

I used Autostarts to turn off a ton of automatic startups, being careful to avoid things like "Contacts", "Phone", "Android System", "Calendar Storage", "Download Manager", "Media Storage", "SIM Toolkit", "System UI", "Google One Time Init" and "Google Services Framework". However, I may have turned-off too many services since I later lost my ability to get root (the error message was something like "Superuser has stopped running"). But, a fix wasn't difficult. From "Settings", I went to the "Apps" menu, selected the Superuser app, cleared its data, "Force Close"d, then restarted Superuser. After that, I was able to get root privileges via the Superuser app as usual.

P.S. In addition to modifying auto-start settings, I also removed a few apps using Titanium Backup: Music, MusicFX, Videos, YouTube, and Voice Search.

Sunday, December 11, 2011

Rooting the LG Optimus M

I convinced my wife to let me root her LG Optimus M (stock Android 2.2.1). After the struggle I had to go through to root my 2.2.2 Ascend, rooting the Optimus was a breeze! Here's what I did:

  • Turn on the following phone settings under "Applications": Unknown sources, USB debugging (under Development).
  • From your computer, search for Gingerbreak and download APK v1.2; here's a Gingerbreak link that currently works.
  • Connect your phone to your computer; on your phone, pull down the top menu, touch the "USB storage" message and turn on USB storage.
  • You should see notification on your computer that your phone's SD card has been mounted. Copy the Gingerbread APK to somewhere on your phone (e.g. the "downloads" directory).
  • On your phone, install the ES File Explorer (or your favorite file explorer/browser) app via Market
  • Open the file explorer, find the Gingerbreak APK and install it (make sure "USB debugging" and "Unknown sources" settings are turned on)
  • Run Gingerbreak, touch the option to root your phone. Your phone should reboot by itself in a few minutes. If it doesn't reboot by itself, Gingerbreak probably didn't work. After the phone reboots, you should see a "Superuser" app in your list of apps.
  • Install Titanium Backup (free version is fine) from Market.
  • In Titanium Backup, touch "Backup/Restore", select an app you want to remove, then select "Un-install". Be very careful about which apps you remove! Removing the wrong one can brick your phone. Here is a list of "safe" apps to remove for LG Optimus M.

Here are the apps I removed. I'd recommend that you stop Boingo WiFi before trying to remove it---I kept getting error messages after removing it and had to reboot the phone before I could continue. Also note that some of these apps provide basic functionality; if you ever think you'll use that functionality or aren't sure, don't remove that app.

  • Boingo wifi (had to reboot after removing)
  • Gameloft free games
  • Loopt
  • Mail@metro
  • Metro backup
  • Metro 411
  • Metro navigator
  • Metropcs easy wifi
  • Mocospace
  • Myextras
  • Pocket express
  • Uno
  • Virtual card
  • Music
  • Sns
  • RSS reader
  • Voice dialer
  • Voice search
  • Weather

Friday, December 9, 2011

Rooting the Huawei Ascend and Upgrading to Android 2.2.2 (Froyo)

Upgrading was the easy part. MetroPCS has a page of instructions on how to upgrade. I took the "Self Upgrade" option. Note that the actual download is from the Huawei Devices site. One thing I was a little confused about is that after you connect your phone to your computer, you must mount the SD card via your phone. I kept trying to run "mount" commands from my computer...

The hard part was obtaining root. First I tried z4root, the app that rooted Android 2.1 for me. No luck. After some searching, I learned about Gingerbreak. I tried v1.2, then v1.3, then v1.1. None of them worked. Argh! And now my battery is draining like crazy! I'm I relegated to a life of recharging my phone every day?!?! Lots of Google searching just turned up more and more references to z4root/gingerbreak. And, I couldn't seem to find anyone with my problem; until...

...I found this post. tokill88 was stuck in a similar situation... had recently upgraded to 2.2.2 and Gingerbreak wouldn't work for him. The thread was dead---3 months old. I registered and added my sad situation. I looked back a few minutes later and there was a reply from "Senior member" ShinySide suggesting SuperOneClick. Seriously? Could that be it? I had a little trouble downloading it and figuring out how it worked, but this video helped a lot. Note that I couldn't run SuperOneClick on XP, but it worked on Vista (yes, it requires Windows).

After rooting via SuperOneClick, I wasn't sure whether I actually had root. I tried Titanium Backup, which is how I removed bloatware from Android 2.1. It couldn't get root. Huh? I found threads talking about this problem and how to fix, but TB didn't even have the same interface. Somewhat randomly, I tried setting TB to "Force System BusyBox". I then restarted via Menu->More->Reload Application. Viola! But, that wasn't all. TB couldn't find the applications I really wanted to remove, like MetroPCS Easy Wifi. This problem was easier to solve (but more expensive). Install Root Explorer via Market and delete everything in /cust/metropcs/us/app. Done!

Was the pain worth it? Yes. I feel like I have a new & improved phone. Everything is faster. Settings->Applications->Manage Applications is useful; it shows me all running applications, not just the ones I started and lets me "force stop" ones I don't want to be running. I still use Advanced Task Killer, but the "Manage Applications" gives me more control and "force stop" really works.

The one thing I don't like about Android 2.2.2 is that I can't control end button behavior. I used to be able to hit the "end call" button to put my phone to sleep. Now I have to hit the power button. Annoying, but I'll live.

P.S. In case you brick your phone, I bet this post would be useful.

P.P.S. This seems to be a good article on task killers. As noted, CPU is more precious than memory; killing and restarting an app uses precious CPU. So, if an app you don't use restarts itself every time you kill it, what you really need to do is root your phone and remove that rogue app.

Mapping Android Version Names to Numbers

I get confused about what Android release names map to what Android release versions. So, I created this post. I got the list of names from this post. I got some of the numbers from Google search; the last two are the obvious guesses. As you might expect, you can also find this information on Wikipedia

  • 1.5: Cupcake
  • 1.6: Donut
  • 2.0/2.1: Eclair
  • 2.2: FroYo
  • 2.3: Gingerbread
  • 3.x: Honeycomb
  • 4.x: Ice Cream Sandwich
  • 5.x: Jelly Bean (?)
  • 6.x: Key Lime Pie (?)