Update: On 8/28 the developer of Superuser.apk modified his package to be compatible with SPRecovery in his 2.3.5 release. As of that release my repackaging of his app is no longer necessary. Nonetheless this topic may be of interest for technical or troubleshooting value. The attachments will remain below, but unless you have trouble with it, you should use the original developer's package which can be found in the OP of his topic on XDA.
On 8/10 ChainsDD on XDA-Developers.com released a new, completely revamped version of su (Superuser) -- version 2.3. In the updated OP of his topic (which has been running since May of this year and is just updated with each subsequent version) he has a link to a zip file for Eclair/ForYo and anothe rlink for the zip for Cupcake/Donut.
Unfortunately the zip he provides (for Eclair/FroYo) will not install under SPRecovery. As I lamented in another thread, when attempting to install the zip it simply does this:
Apparently many/most of the Superuser installer zips out there won't install with SPRecovery, but will install just fine with Clockwork Recovery. There have been numerous pages of posts on the XDA-Developers topic since the new version was posted and a large number of them have been people either having trouble with FC errors after installing, failure to install, and in some cases loss of their su after installing. I don't fault the developer for that -- with so many platforms out there, making a .zip that will install cleanly on all of them would be nearly impossible. Fortunately I don't have to worry about every phone in the world, so making a reliable, working package for SPRecovery is a little easier.Code:-- Install from sdcard... Finding update package... Opening update package... Verifying update package... Installing update... Installation aborted.
In any event, at the outset of this I knew just about nothing about how SPRecovery zip files were built and certainly had never done it before. That's all changed now.
I have created a new SPRecovery compatible package using the files from the original distribution. The only thing I've done is repackage them in a way that will make SPRecovery happy (which involved rewriting the update script and then packaging and signing the package). I also employed a little art to ensure that the package does what the developer intended even if the target phone might be a little atypical. I have tested my package successfully using SPRecovery 0.99.3b and using Clockwork Recovery 220.127.116.11 (sholes). The original developer's package is also available under "Extras".
My package installs with no errors or issues on my Droid 1 running FRG22 and SPRecovery. My su has been 100% solid (no FC's, etc.). While the new features are great (see the developer's topic linked at the top) the main reason I wanted this was to fix a bug in the 2.2.x su versions that caused them to not deal well with apps that need su during boot (like SetCPU does if you use the "Set at Boot" option). This has definitely fixed that.
The reason SPRecovery can't run the developer's original package has nothing to do with a mounting issue (as I originally suspected but have now disproved). The issue is that SPRecovery appears to be written to only load packages that include an update-binary and updater-script (the way my package is built) and will not load packages that contain only update-script and no binary (the way the developer's package is built).
I'm working with the developer to see if he can modify his package the same way I have (and still have it work for all of the other phones in the world that need to run it). If that works out, then this separate build for SPRecovery wouldn't be needed any longer.
For anybody who's interested, feel free to check out the contents of the zip and compare them to the original distribution. The only files that didn't come from the original distribution are:
update-binary: This is the updater binary that you find in just about every package now (including OEM ones) and is the exact same file used in the P3Droid/ChevyNo1/etc. packages. If you want to learn more about it, Koush has the source for it here.
updater-script: This is the installer script that I wrote to replace the update-script file in the original distribution. If you look at the steps you'll see that it does the same thing, in the same order. The only additions are that it explicitly mounts /system (which the original doesn't which is why it fails) and the way the binary method implements "run_program" requires you to extract the file/script you're going to run (fixsuperm) to /tmp before running it. The one deviation I did make was in the permissions on the su file. The original developer applied 4755 to su, but my existing su was 6755 and every other su package I've looked at uses 6755, so I used 6755. He has since updated his package to do 6755 as well after I pointed this out.
A few notes to try to avoid some of the easy to anticipate questions:
- If you've not installed a 2.2.x su package from this developer on your phone previously, your su whitelist will be erased and you will have to re-authorize any apps that need su. This will happen in any of the packages that say "includes fixsuperm". This is a good idea in case there is any data there that would confuse the new Superuser.apk. Installing a package that does not have fixsuperm shouldn't reset the whitelist. If you install a package that doesn't have fixsuperm and you get FC errors trying to view the log, etc., then either load a package with fixsuperm, or clear the data for Superuser yourself via application management.
- The developer notes: "Apps may still crash if they try to get permissions on boot that have not been granted yet. Once an app is in the whitelist, it should have no trouble at all getting permissions on boot." For this reason I made sure my "Set on Boot" option in SetCPU was unchecked before installing so when the phone booted up with an empty whitelist SetCPU wouldn't try to get su permissons. After booting from the update I turned "Set on Boot" back on and now SetCPU starts up clean (it didn't with the old su).
- You can use this file to do a bare minimum root of an unrooted phone as long as your phone has a custom recovery on it (not the stock recovery). When I say "bare minimum" I mean you won't have busybox, etc., and you'd have to install that manually. But you'd have su. I've done this on my dev phone starting from unrooted and it works fine.
- I don't know what is different between the Eclair/FroYo package and the Cupcake/Donut package. I didn't even look at the Cupcake/Donut package because it is of no use to me.
- Yes, the icon is a little pirate android guy now instead of a ninja. The icon is built into the file by the original developer -- I didn't do it and I have no idea how to change it. I actually like it better than the ninja anyway.
- There are tons of new features -- most of them very useful. Check out the developer's topic on XDA-Developers for details, screen shots, etc.
- If you're running a custom ROM, chances are the ROM builder will be including this version in their next release of the ROM. If you're not having any problems with su, you might as well skip this unless: a) any of the new features are particularly appealing to you, b) you just have to have something your buddy doesn't have yet. I have tested this package on ESE81 and FRG22. I can't see a reason why the various custom ROMs would have any trouble. As long as the ROM doesn't do anything crazy with where it puts su and Superuser.apk it should be fine. The package with the latest version (18.104.22.168) is the best with regard to how well it tries to clean up prior su and Superuser.apk and put in the new and grant correct permissions. The earlier packages weren't as robust.
How to install using SPRecovery:
(same as any update.zip - but here's pretty detailed instructions in case you need 'em)
- Download the file to your computer
- Connect your phone to your computer via USB
- Do "turn on USB storage" on your phone to mount your phone's file system to the computer
- Copy the zip file to the root of your SD card
- If the file shows a name of "Superuser-22.214.171.124-ef-signed-MotoCache1" (no .zip on the end) then rename it to just "update". If the file shows a name of "Superuser-126.96.36.199-ef-signed-MotoCache1.zip" (.zip on the end) then rename it to "update.zip".
- Properly eject your phone from your computer and do "turn off USB storage" on the phone to dismount the file system from your computer
- Power down your phone
- Hold the X key (on the physical keyboard) while powering up your phone. Keep the X key held until SPRecovery (or whatever your recovery is) comes up.
- Do a Nandroid backup. Make sure you backup at least SYSTEM and DATA. A "simple Nandroid backup" will back these up, but you can also do an Advanced and specifically select them, or (best idea?) just do a full Nandroid backup to be safe. The package only replaces your su and Superuser.apk files which are in SYSTEM, but the "fix su permissions" script (which was written by the original developer and which I haven't attempted to completely digest) modifies /data/system/packages.xml and removes /data/data/com.noshufou.android.su as cleanup of possible older version information.
- After your backup finishes, get back to the beginning menu of SPRecovery and choose "install"
- Choose "Allow update.zip installation" [nothing seems to happen when you click the camera button to run this choice, but it enables you to do the next step without getting an error saying update.zip is not allowed.
- Choose "Install /sdcard/update.zip (deprecated)"
The update will be over and done with quite quickly. Then you can just go back to the beginning menu and choose "reboot system now" and you're done.
As with any change to a restricted area of the phone there is a chance for mistakes, etc. Best advice is to be sure you're starting with a well-charged battery, do your Nandroid backup first, and if you run into any trouble there are about a bazillion topics here (and helpful, experienced members) that should be able to deal with most anything you'd run into.
Sorry this was so long folks. That's just how I am.
-- Eclair/FroYo, contains fixsuperm
Prior versions in the unlikely event they are needed:
[OLD VERSIONS below - use newest version above]
-- Eclair/FroYo, does not contain fixsuperm
-- Eclair/FroYo, contains fixsuperm