[PATCH] Working Superuser/su for newer Sense ROMs

Search This thread

rmk40

Retired Recognized Developer
Jun 13, 2010
1,361
4,360
Anyone following the RUU threads already knows about this and it's starting to get more attention now. The latest official build of Superuser does not work with newer Sense ROMs (such as Vision 1.72+, anything released recently). HTC has started utilizing a relatively new feature of sqlite; a journaling mode called WAL (write-ahead logging). It's actually smart. WAL journaling should improve sqlite throughput, which represents a large amount of Android's IO and benefits applications across the board. The downside is it broke Superuser because it's actually special in its' use of sqlite.

WAL journaling, as built with these new Sense ROMs, is using exclusive locking. Why is this important for Superuser? It's the one situation where you have an application running within Android's process space and one outside of it, both accessing the same sqlite database. When su runs, it opens the sqlite database to check whether you have allowed access for said command to run. If not, a call is made to the Android application, which fires up and prompts you for an answer. Problem is, su has the database open with an exclusive lock (i.e. nothing else can touch it), so Superuser (the Android app) fails to open the database and cannot run. It'll either force close or do nothing.

To fix this, I have modified Superuser and su. Both changes have been submitted to ChainsDD for review. You can look at his git repository's pull requests to see the changes I'm proposing. I'm basically changing the journal mode being used by su one that is non-exclusive and Superuser to close its' database when sitting idle. I couldn't change Superuser's journal mode no matter what I did; it seems to be set deeper in the stack than I can access.

Here are the links to my pull requests on Github if you want to review the code:

https://github.com/ChainsDD/android_packages_apps_Superuser/pull/14
https://github.com/ChainsDD/android_system_extras/pull/1

Anyway, the end result is I have a working Superuser. Here are the caveats:

  • This is not an official build, so it's signed with my key, not ChainsDD. He has merged my patches into his Github repository so they should be making their way into a release soon.

  • I've artificially incremented the version number to 9.9.9, to make sure if you install my version, it'll "win" over any other installed version. Also, this prevents the Market from nagging you for updates.

  • I don't recommend using this version unless you must. In other words, you are on one of the Sense ROMs which is broken. Use an official build otherwise.

  • If you ran the RUU and have trashed your custom recovery (Clockwork), this isn't going to help you root the device again. Superuser is a tool for managing root access, not obtaining it.

If you are running Virtuous, you DO NOT need this.

 
Last edited:

tbalden

Recognized Developer
I'm trying to work around the no root available for 1.72 problem with my stock HTC Z rom updated to 1.72 OTA, but with Rage method temp-root I'm stuck with a frozen terminal after the 'Force Close' step, starting the terminal the 3rd time in the process. I've replaced the gfree_temp_root package's su file with the one provided here, used the APK provided here (pre-installed the apk too before the attempt). It's unfortunately stuck with a frozen black terminal window. Probably the Rage thingy doesn't work with the new 1.72 update, or am I using these files correctly at all?

(guide http://xdaforums.com/wiki/index.php...cess_.28Permanent_Root_.2F_.22Permaroot.22.29 )
 

Dacoco

Senior Member
Dec 8, 2010
568
23
Just for a correct understanding:

I need to have root like described here to use SU right?

Or is it now possible to get the new Update via OTA and get root with this method and its a solution for rooting 1.72?

Thanks!
 

denich

Senior Member
Dec 22, 2010
106
6
I dont understand, or I miss some information. The 1,72 ROM is not patched yet (or what?).. Then. If I install 1,72 I will loose root. So in what cases I will need this patch?
 

seo

Retired Recognized Developer
Dec 15, 2005
1,508
1,050
43
Plovdiv
&partialy working for me.. still creating read-only -wal and -shm files

here is an another solution: http://saraev.ca/su/
it is modified to "chmod" own databases - have a look at README file included

don't forget to grant permissions to superuser itself ;)

EDIT: this is a dirty workaround, I hope someone can make it better...
 

rmk40

Retired Recognized Developer
Jun 13, 2010
1,361
4,360
&partialy working for me.. still creating read-only -wal and -shm files

here is an another solution: http://saraev.ca/su/
it is modified to "chmod" own databases - have a look at README file included

don't forget to grant permissions to superuser itself ;)

EDIT: this is a dirty workaround, I hope someone can make it better...

The one in your link is a dirty workaround for sure, it modifies baksmali code. Mine is working as intended. The wal and shm files are only present when you're actually sitting in the Superuser app. I'll modify the code some more to close the DB anytime it's not being read or written from. As it stands it's already rare to trigger a case where a request would fail.
 

seo

Retired Recognized Developer
Dec 15, 2005
1,508
1,050
43
Plovdiv
The one in your link is a dirty workaround for sure, it modifies baksmali code. Mine is working as intended. The wal and shm files are only present when you're actually sitting in the Superuser app. I'll modify the code some more to close the DB anytime it's not being read or written from. As it stands it's already rare to trigger a case where a request would fail.

yeah i know that.. :):)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 27
    Anyone following the RUU threads already knows about this and it's starting to get more attention now. The latest official build of Superuser does not work with newer Sense ROMs (such as Vision 1.72+, anything released recently). HTC has started utilizing a relatively new feature of sqlite; a journaling mode called WAL (write-ahead logging). It's actually smart. WAL journaling should improve sqlite throughput, which represents a large amount of Android's IO and benefits applications across the board. The downside is it broke Superuser because it's actually special in its' use of sqlite.

    WAL journaling, as built with these new Sense ROMs, is using exclusive locking. Why is this important for Superuser? It's the one situation where you have an application running within Android's process space and one outside of it, both accessing the same sqlite database. When su runs, it opens the sqlite database to check whether you have allowed access for said command to run. If not, a call is made to the Android application, which fires up and prompts you for an answer. Problem is, su has the database open with an exclusive lock (i.e. nothing else can touch it), so Superuser (the Android app) fails to open the database and cannot run. It'll either force close or do nothing.

    To fix this, I have modified Superuser and su. Both changes have been submitted to ChainsDD for review. You can look at his git repository's pull requests to see the changes I'm proposing. I'm basically changing the journal mode being used by su one that is non-exclusive and Superuser to close its' database when sitting idle. I couldn't change Superuser's journal mode no matter what I did; it seems to be set deeper in the stack than I can access.

    Here are the links to my pull requests on Github if you want to review the code:

    https://github.com/ChainsDD/android_packages_apps_Superuser/pull/14
    https://github.com/ChainsDD/android_system_extras/pull/1

    Anyway, the end result is I have a working Superuser. Here are the caveats:

    • This is not an official build, so it's signed with my key, not ChainsDD. He has merged my patches into his Github repository so they should be making their way into a release soon.

    • I've artificially incremented the version number to 9.9.9, to make sure if you install my version, it'll "win" over any other installed version. Also, this prevents the Market from nagging you for updates.

    • I don't recommend using this version unless you must. In other words, you are on one of the Sense ROMs which is broken. Use an official build otherwise.

    • If you ran the RUU and have trashed your custom recovery (Clockwork), this isn't going to help you root the device again. Superuser is a tool for managing root access, not obtaining it.

    If you are running Virtuous, you DO NOT need this.

    2
    ChainsDD merged my patches into his repositories today so they should make it into an official release soon.
    2
    Hi,

    This patch works only on Desire Z or I can install in my Desire HD?

    Regards,

    It'll work for any ROM actually.
    1
    You can check if you're S-OFF by powering off your phone and going into hboot by holding down Volume down and Power. Or connect it to your PC and use adb reboot bootloader
    1
    Ok just to update on that... I found out that I installed 1.72.405.3 version of HTC's ROM inbuilt into LeeDrOiD 1.3 custom ROM. I did have root access, h-boot Eng S-Off but not Radio S-Off. Obviously this means I've ****ed myself over without knowing it. Previously I was able to run Visionary+ with the option grant System R/W and then could enter the /system/app folder and delete whatever system apps I wanted. Now it doesn't matter what I do, even using the root access patch here and using root explorer it still will not let me mount the system folder to get R/W access. Is there any way anyone with can get full access to delete system apps after loading 1.72.405.3 with Radio S-On? Terminal Emulator grants me SU access but still not dice on letting me delete the .apk files. Anyone know if it can be done with adb commands mounting the drive in Windows? If I can't figure it out soon I will just use Root Manager <--edit.. sorry that was a mistake I mean the windows based app ROM Cleaner 0.8. Anyway I've now solved the issue so no flashing needed :)) to delete the system apps from the LeeDrOiD ROM and reflash however I will loose so much time in having to re-enter all the data and reinstall everything for the upteenth time.... I really want to avoid.

    As with others here who've loaded the 1.72.405.3 patch/ROM I've tried to load Radio S-Off after doing this and it won't give me Radio S-Off super CID. Damn! :mad:

    If I didn't say so already the this rmk40 super user patch does say super user access granted when an app calls for it however no R/W access of the system folder and no ability to Run Visionary+ properly or run Radio S-Off patch successfully which leads me to believe this is only a pseudo super user patch.