8

[GUIDE] Root and keeping root options

 1 year ago
source link: https://forum.xda-developers.com/t/guide-root-and-keeping-root-options.4387977/page-13#post-87703629
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

[GUIDE] Root and keeping root options

BillGoss

Senior Member
Sep 2, 2010 5,387 4,780 Sydney OnePlus 8T
Yeah thats a fair point, I wasnt sure if backups are created if the boot is already patched... I dont know if Magisk checks for that.

However, I don't have any file created... I just flashed the stock boot.img from my current C.33, then used Direct Install. I'm rooted now, but still no backup file created

What could be causing this?!

I have no idea. You could ask in the Magisk forum: https://forum.xda-developers.com/t/magisk-general-support-discussion.3432382/

PS: since you have a copy of the stock boot image you don't actually need a backup.

I have no idea. You could ask in the Magisk forum: https://forum.xda-developers.com/t/magisk-general-support-discussion.3432382/

PS: since you have a copy of the stock boot image you don't actually need a backup.

Yeah I was looking for the Magisk forum, but while searching up on this issue I came across it here, so I asked here since it's specific to my 8T and OOS12. ..ohh yeah, the backups were there in OOS11, i forgot to mention that.

Yeah I know I dont need it if I still have the stock img... it's just a confusing one.

Would it make a difference if I just boot the stock boot image, then install OTA?? rather than flash the stock boot image?

BillGoss

Senior Member
Sep 2, 2010 5,387 4,780 Sydney OnePlus 8T
Yeah I was looking for the Magisk forum, but while searching up on this issue I came across it here, so I asked here since it's specific to my 8T and OOS12. ..ohh yeah, the backups were there in OOS11, i forgot to mention that.

Yeah I know I dont need it if I still have the stock img... it's just a confusing one.

Would it make a difference if I just boot the stock boot image, then install OTA?? rather than flash the stock boot image?

It all depends on what you're trying to do. If you boot the stock image you obviously wouldn't have root, so you can use Magisk to do a direct install (it won't have permission to write to the boot partition).
That's why there are options in the OP - not everybody wants to use the same method.

well i'd be trying to apply the OTA update, then root again.

my process is from your OP. in this case i'd be doing:

Un-root from Magisk.
Install OTA from system update.
Root again with Direct Install.
Extract boot.img from inactive slot.
Patch OTA boot.img with Magisk.
Reboot phone to apply OTA update.
Boot magisk patched boot.img.
Use magisk to Direct Install.

but in my case, I cant Un-Root with magisk because there is no backup.

now you pointed out something I didnt consider... stock boot.img does not have permission to the boot partition.

so does this mean that OTA checks the Active slot for root before installing to the Inactive slot?
removing root from active slot does not remove permissions until after a reboot??
is that how it works?

BillGoss

Senior Member
Sep 2, 2010 5,387 4,780 Sydney OnePlus 8T
well i'd be trying to apply the OTA update, then root again.

my process is from your OP. in this case i'd be doing:

Un-root from Magisk.
Install OTA from system update.
Root again with Direct Install.
Extract boot.img from inactive slot.
Patch OTA boot.img with Magisk.
Reboot phone to apply OTA update.
Boot magisk patched boot.img.
Use magisk to Direct Install.

but in my case, I cant Un-Root with magisk because there is no backup.

now you pointed out something I didnt consider... stock boot.img does not have permission to the boot partition.

so does this mean that OTA checks the Active slot for root before installing to the Inactive slot?
removing root from active slot does not remove permissions until after a reboot??
is that how it works?

Yes, that's right. An incremental OTA does check that the current (active) partitions are stock during the update process and will fail if they aren't.
And root is only lost if you boot up on an unrooted boot image. That's why you can restore the active slot boot (and recovery if you use TWRP or Orange Fox) image back to stock in order to do the update and not loose root permissions until after the reboot.

Last edited: Saturday at 1:14 AM
so what should I do in my case?
since I dont have a backup for magisk to restore.
the only way to boot a stock img is to reboot from it or flash it, which means i lose root completely.

BillGoss

Senior Member
Sep 2, 2010 5,387 4,780 Sydney OnePlus 8T
so what should I do in my case?
since I dont have a backup for magisk to restore.
the only way to boot a stock img is to reboot from it or flash it, which means i lose root completely.

If you have a copy of the current stock boot image then you have two options:
1. Use shell commands (either through a terminal app like Termux or using "adb shell") to restore the stock boot image instead of getting Magisk to restore the image. Followed by the update process (B.1 or B.2.1) Or
2. Restore the stock boot image using fastboot (you'll lose root) and then update the phone and root it from scratch. You'll also have to clear data from GMS and G Play and reboot to make your phone certified again.

I'm not very good with command line, but according to your OP, is this what I need to restore the stock boot.img that I've got?

dd if=path/to/stock-boot.img of=/dev/block/by-name/boot_a

I can run this in ADB while the phone is turned ON right?
is my syntax correct?

BillGoss

Senior Member
Sep 2, 2010 5,387 4,780 Sydney OnePlus 8T
I'm not very good with command line, but according to your OP, is this what I need to restore the stock boot.img that I've got?

dd if=path/to/stock-boot.img of=/dev/block/by-name/boot_a

I can run this in ADB while the phone is turned ON right?
is my syntax correct?

Yes, you have to have the phone running normally.
Looks good. Just check that your current (active) slot is "_a" by using getprop ro.boot.slot_suffix
And you will need to run the "dd" command as root by either starting adb as root or using /system/bin/su -c dd if=path/to/stock-boot.img of=/dev/block/by-name/boot_a.

Reactions: sketch.droid

thanks for the help mate!
I didnt realise I can run root commands inline like that... i usually do something like:
adb shell
su
<then root commands>
in windows cmd terminal.

I'll give this a try today... fingers crossed I don't have to wipe the phone again.


--UPDATE--
Everything went smoothly, restoring factory boot by command line seems to be even quicker than Magisk.

the only confusion I had was orientation...
using windows CMD terminal, I assumed my directory "path-to-factory-boot-image" was on the computer, but it has to be on the phone storage.

So if someone wants to restore factory boot.img by command line, remember that your starting orientation point is the ROOT folder of your phone, and "not" the directory location CMD terminal says.

when you do:
Code:
adb shell
you will be taken into the phone's root storage.

rookie mistake on my part.

Thanks again @BillGoss for your help.
Last edited: Monday at 11:23 PM

Reactions: BillGoss

I'm still on 11.0.13.13.KB05AA but thinking of finally moving to A12. I assume, like past versions of Android, I need to move to C.11 and not jump to the most current version?

BillGoss

Senior Member
Sep 2, 2010 5,387 4,780 Sydney OnePlus 8T
I'm still on 11.0.13.13.KB05AA but thinking of finally moving to A12. I assume, like past versions of Android, I need to move to C.11 and not jump to the most current version?

Can't tell you what to do on that as I went through every update since C.11. But I don't see any real reason for not going straight to the latest version - C.36 - if that's available to you.
My only concern would be that if you want to do a manual install then I don't know if you can use the OOS 11 process or if you need use the MyApplication2 APK.

I haven't been keeping up and have no idea what the MyApplication2 APK process is..

BillGoss

Senior Member
Sep 2, 2010 5,387 4,780 Sydney OnePlus 8T
I haven't been keeping up and have no idea what the MyApplication2 APK process is..

Read the OP


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK