Updating and rooting an Asus Transformer tablet

A few days ago I inherited an old Asus Transformer from work. At Yorba, we had been using it to test out builds of Ubuntu Touch Gallery as we hacked on it. When I turned it on, I found it still running a jacked up early build of Ubuntu Touch that didn’t do much of anything useful. Today I set out to try and return the tablet to a usable state by reverting to the factory Android version and then rooting it.

Here’s a quick TL;DR for this process:

  • Install a recovery. This usually means already magically having root somehow.
  • Use the recovery to flash the latest Android build from Asus.
  • Fix/reinstall the recovery if necessary. You don’t need root for this now that you’re on the latest Android.
  • Use the recovery to install the Superuser app, which gives you root.
  • BAM.

Background

This is the first Transformer, model number TF101. We’re going to put the latest Android that Asus has provided for it, currently build number 9.2.1.27, which is Android 4.0.3. It’s unlikely that Asus will ever provide any later builds, since this hardware is now over two years old (ancient by tablet standards), but if they do, my rooting instructions will likely not work for the newer build. Android has a way of changing enough between releases that the methods to root it even on the same device don’t work from version to version.

Edited to add: I’m not sure if it’s just my tablet, or the Transformer’s notoriously weak GPS unit, but after going through all this work to get things updated, GPS functionality seems to be broken for me. I didn’t use it before the update to know if it’s the hardware or the software causing problems. I also haven’t taken it outside in direct view of GPS satellites. If you need working GPS in your tablet, I’d do some research and make thorough backups before trying this procedure.

Before we begin, you’ll need the adb tools on your computer. In Ubuntu, the package you want to install is android-tools-adb. If you’re still on Precise like I am, you’ll find the package doesn’t exist in the main repos, so you’ll first need to add the amazing Web Upd8 PPA:

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update

To install adb:

sudo apt-get install android-tools-adb

You may want to read up on how adb works, as we’ll be relying on it heavily.

I’ll also mention that throughout this process, your tablet should be in USB debugging mode. You can turn this on in Settings under Developer options. I had a hard time getting this option to stick, so you may have to re-enable it every time you reboot.

Quirks

One surprising oddity I learned in this process is that the Transformer’s /sdcard is not the SD card. Or the micro SD card. It’s in fact an alias for /data/media on the internal /data partition, wrapped in a fuse module to ensure filesystem permissions don’t let you do anything untoward. You don’t need an SD card for this process.

Also, at some point I made the mistake of selecting “reboot into recovery” from inside Android (or it may have been CyanogenMod, which I briefly tried). Apparently you can set a flag somewhere persistent so that when the device reboots, it’ll go straight into recovery mode without you having to futz with the volume buttons. Unfortunately, booting into recovery mode doesn’t seem to unset that flag, so you can’t boot normally again, a situation referred to as a recovery boot loop. If you find yourself in that situation, you can fix it by running, while your tablet is in recovery mode:

adb shell dd if=/dev/zero of=/dev/block/mmcblk0p3

Ignore a warning about No space left on device. This simply clears the flag. When you reboot, it should boot up normally.

Recovery

Flashing a new firmware ROM requires booting into a recovery, a piece of software that enables some advanced features when you boot your device into recovery mode. There are a couple different recoveries you can install. The big ones are Team Win Recovery Project or TWRP, and ClockworkMod Recovery. Either one works, but TWRP seems a little nicer to use.

Here’s the fun part: installing a recovery generally requires already having root on your device. As I’ll discuss later, there’s an easy way to install a recovery without root if you’re on the latest Android, but for this I assume you’re running an older version because you have no reason to flash your device if you’re already running the latest. Unfortunately, the process for rooting changes with each different Android version, so the rooting instructions below likely won’t help much. It’s not too hard to find lots of shady forum posts with instructions for any particular Android version if you do a little searching, and some of those posts may even be accurate and work.

Once you have root, you can install TWRP by installing an app called GooManager. Open it, open the dropdown menu, and select Install OpenRecoveryScript. It should then guide you through the rest of the process of installing the latest TWRP for the Transformer. See the full instructions for more information, including how to manually install it if you don’t want to install an otherwise pointless app.

If you’d rather use ClockworkMod Recovery, install the ROM Manager app and let Flash ClockworkMod Recovery guide you through the process. Again, this requires root.

Flashing

Now we need the latest Android build. You can find it from Asus’ support website. Select Android in the dropdown and then expand Firmware. There are many different builds there, each for a different country. I live in the US, so I went with the US build. I’m not sure what happens if you install a build for a region that doesn’t match where you bought the tablet, so exercise a little caution here. Extract the zip file inside the downloaded zip file. I ended up with US_epad-user-9.2.1.27.zip, so I’ll use that in my examples here.

Power off the Transformer. Boot it into recovery mode by holding the volume down key and the power button together, then when the boot logo comes up and it prompts you, release those buttons and press volume up. It should then boot into your installed recovery.

At this point, you can clear any caches and reformat any partitions you want. In TWRP, this is all under the Wipe section. I wanted to start totally fresh, so I nuked and reformatted everything it let me.

Still in recovery, put the firmware on the tablet (the trailing slash is important):

adb push US_epad-user-9.2.1.27.zip /sdcard/

Be patient — it’ll take some time to transfer the file.

Now go to Install, select the file you pushed, and flash that sucker on there. Reboot, and you should see the boot splash with a blue bar under it. That’s the Android install moving into place on the filesystem. It’ll reboot itself when it finishes, and then you’ll get the Asus logo with a spinner under it spinning for a while.

Eventually you’ll be taken to the Android welcome screen to set up your device. Knock yourself out. Once you’re up and running, you may want to launch the File Manager app and delete the file you pushed, as you won’t need it anymore and Android will notify you that it’s detected a system update file until it’s gone.

Recovery (Again)

I don’t know if it was because I reformatted everything before flashing the new ROM or if installing a new ROM always breaks the recovery, but at this point if I tried to boot into recovery mode, it just showed a toppled, broken Android. Time to reinstall recovery. If recovery still works for you, you can skip this step.

By the way, I got all this information from looking at the batch file in this “one-click” root/recovery installer.

Remember how I said you usually had to have root to install recovery? Well for this version of Android, there’s an exploit we can use to install the recovery without having root, but it requires some finagling. Again, I’ll demonstrate using TWRP, but theoretically ClockworkMod Recovery would work the same way.

Go back to TWRP’s Transformer instructions and find the manual download link. Download the latest TWRP for the Transformer, currently 2.3.2.3 (there’s also an unofficial, more modern TWRP Transformer build here, but I didn’t test this).

We need to get the device in a state that when it reboots, the recovery partition will be writable:

adb shell mv /data/local/tmp /data/local/tmp.bak
adb shell ln -s /dev/block/mmcblk0p4 /data/local/tmp

Reboot the tablet, and when it comes back, with USB debugging on, push and flash the recovery image:

adb push openrecovery-twrp-2.3.2.3-tf101.blob /sdcard/
adb shell dd if=/sdcard/openrecovery-twrp-2.3.2.3-tf101.blob of=/dev/block/mmcblk0p4

Reboot the tablet again. This time you should see a blue bar appear briefly. This is the recovery image being copied into the right place. It’ll reboot again into the normal system, at which point we should do a little clean up:

adb shell rm /data/local/tmp
adb shell mv /data/local/tmp.bak /data/local/tmp

You can also again go into the File Manager app and delete the blob file to free up space. At this point, you should have a working recovery again.

Rooting

We’ll use recovery to add the Superuser package easily, which gives you “root”. Find the latest version for ARM devices from the Superuser website, currently 3.1.3. You want the whole package, not just the su binary.

Push the package up to the tablet:

adb push Superuser-3.1.3-arm-signed.zip /sdcard/

Now reboot into recovery (it’s hold power + volume down, then press volume up when prompted, if you’ve forgotten). Go into Install, select the Superuser zip file, and flash it.

Apparently you’re also supposed to wipe the cache and Dalvik cache, so do that too. Reboot, and let Android “upgrade”, which is just it rebuilding the caches. When it’s done, you can again delete the zip file using File Manager as it’s not needed anymore.

Now you should have a working su, which means you have root. To test, I installed Android Terminal Emulator. In the terminal, run:

su

If it prompts you and then says it’s been granted Superuser privileges when you allow it, it’s working just fine.

That’s all there is to it. Easy, right?