How To Guide Method to upgrade every month, without wiping data and retaining root

Search This thread

elknetld2kil

Member
Nov 26, 2012
28
15
Yeah, sounds like a mod(s) caused a bootloop since you booted fine after going into safe mode. Your mods will be disabled after rebooting from safe mode.
That is exactly what happened, they were all disabled but root was retained. Good thing I got to safe mode in the first place, I still have no idea what I pressed on to get there. Thanks again, I will be using this method from now on.
 

eracet

Senior Member
Nov 27, 2010
225
32
I upgraded (from Android 12), retaining root & data, following usual steps:

- unzip download, cd into directory, unzip included zip
- adb push boot.img /sdcard/
- patch boot.img with Magisk
- adb pull /sdcard/Download/magish_patched_XXX.img
- uninstall Magisk from within app
- reboot
- adb reboot bootloader
- modify flash-all.sh (remove -w flag)
- run the flash-all.sh script and let it finish (!!! this takes time)
- reboot normally, start phone (takes some time), let it settle, go beyond lock screen (it will install some more stuff)
- adb reboot bootloader
- fastboot boot magisk_patched_XYZ.img
- Magisk app should be auto-installed, it will ask to reboot
- adb reboot bootloader
- (again) fastboot boot magisk_patched_XYZ.img
- open Magisk app again and do a direct install
- reboot, you have root now
- reinstall Magisk modules, hide Magisk ... whatever you want to do
This method worked , in combination with my own method.
Had to redo safety net fix and systemless hosts.
Disabled this before updating, but did not uninstall Magisk
 
  • Like
Reactions: jcp2

OzBoy1

Senior Member
Dec 24, 2008
529
216
Ok want to update from 12 to 13, read, reread and reread again, now just confused...my usual state of mind!

So it seems I can follow the original post or use foobar66's instructions to update, however I am confused about the dual slots. Should I flash to both slots? If so how do I do this?

Sorry I should have this sorted by now and think I read way too much as things have changed since Nov last year and not sure if the original post is still good or not and then the dual slots that comes with 13 has done me in.

Thanks for all your help, apreciate it.
 

roirraW "edor" ehT

Forum Moderator
Staff member
Ok want to update from 12 to 13, read, reread and reread again, now just confused...my usual state of mind!

So it seems I can follow the original post or use foobar66's instructions to update, however I am confused about the dual slots. Should I flash to both slots? If so how do I do this?

Sorry I should have this sorted by now and think I read way too much as things have changed since Nov last year and not sure if the original post is still good or not and then the dual slots that comes with 13 has done me in.

Thanks for all your help, apreciate it.
You should at least flash the Android 13 bootloader to both slots. Command for use with the Pixel 6 Pro Android 13 bootloader from the factory image.

From running Android:
Code:
adb reboot bootloader

Once the phone is in bootloader:
Code:
fastboot --slot all flash bootloader bootloader.img

Then do the full Android 13 update using the factory image zip, removing the "-w" from the flash-all.bat.
 

jumpet

Member
Jul 10, 2010
35
4
suances
I have a question, i had root in a12 and suddenly mi pixel 6p received an update before a13, I have lost root but I maintain the modified kernel, how can I get a safe update to a13 even throw if I lose root?
 

jumpet

Member
Jul 10, 2010
35
4
suances
You should at least flash the Android 13 bootloader to both slots. Command for use with the Pixel 6 Pro Android 13 bootloader from the factory image.

From running Android:
Code:
adb reboot bootloader

Once the phone is in bootloader:
Code:
fastboot --slot all flash bootloader bootloader.img

Then do the full Android 13 update using the factory image zip, removing the "-w" from the flash-all.bat.
followed this and i get this error:
1661559260714.png
 

roirraW "edor" ehT

Forum Moderator
Staff member
followed this and i get this error:
View attachment 5697325
Looks to me like maybe you don't have the "image-raven-tp1a.220624.021.zip" file in the folder. You extracted the entire contents of the original "raven-tp1a.220624.021-factory-d8ddfdca.zip" to the same folder where you have the most recent (33.0.3, or 33.0.2) Platform Tools?

Also, while your phone is in bootloader mode, you have the latest Google USB Driver installed?

Lastly, you could always try the Official Google Android Flash Tool (OEM Unlocking needs to be toggled on - you may not have to manually unlock the bootloader - the "site" will do that on its own). It's possible you could also take advantage of it's new option to flash only the 13 bootloader to both slots, and then will update the current slot to 13 completely.
FYI: Even though Android Flash Tool does not flash the whole image to both slots, they have added an option to flash the A13 bootloader to the inactive slot. This may be the easiest option to use when updating to A13 from A12.

Just to be clear, when updating to A13 from A12 a prompt will show up asking whether you want to also flash the bootloader to the inactive slot as well. It doesn't show up in the regular tick boxes.

4183113-70fb3fbf9e6f9bd93697901cc4b05e20.jpg
 

jumpet

Member
Jul 10, 2010
35
4
suances
Looks to me like maybe you don't have the "image-raven-tp1a.220624.021.zip" file in the folder. You extracted the entire contents of the original "raven-tp1a.220624.021-factory-d8ddfdca.zip" to the same folder where you have the most recent (33.0.3, or 33.0.2) Platform Tools?

Also, while your phone is in bootloader mode, you have the latest Google USB Driver installed?

Lastly, you could always try the Official Google Android Flash Tool (OEM Unlocking needs to be toggled on - you may not have to manually unlock the bootloader - the "site" will do that on its own). It's possible you could also take advantage of it's new option to flash only the 13 bootloader to both slots, and then will update the current slot to 13 completely.
Hi thank for your help;
1, no i did it in a different location from the platform tools, I runned the flash all bat from the unzipped folder; C:\Downloads\raven-tp1a.220624.021-factory-d8ddfdca\raven-tp1a.220624.021

2, yes

3, i have OEM unlocked, update to a13 went ok but when the phone boots it said: cannot load android system your data may be corrupt....
 
  • Like
Reactions: roirraW "edor" ehT

roirraW "edor" ehT

Forum Moderator
Staff member
Hi thank for your help;
1, no i did it in a different location from the platform tools, I runned the flash all bat from the unzipped folder; C:\Downloads\raven-tp1a.220624.021-factory-d8ddfdca\raven-tp1a.220624.021

2, yes

3, i have OEM unlocked, update to a13 went ok but when the phone boots it said: cannot load android system your data may be corrupt....
When you say the update to Android 13 went okay, do you mean that you got farther/completely through the process than you showed in the screenshot?

It's possible your folder path is too long. When I flash images, I try to keep the path name shorter (and also in folder names that don't have spaces, but yours already don't have spaces). Sometimes when a folder path is too long, commands in the command prompt have trouble finding a file because it's past a basic folder length limit - that might be what happened if it flashed only so much and then stopped.

Another idea is, as I suggested before, to try the Official Google Android Flash Tool. It has fixed weird issues for many users, including myself. If you don't want to lose your user data, then you can try that online flash tool with these three options disabled:
  • Wipe (disabled)
  • Force flash all partitions (disabled)
  • Re-lock bootloader (disabled)
If that doesn't help, then I'd recommend that you do the same thing again but with a wipe and with force-flashing all partitions (which wipes, too).
 

2B_4G10

Member
Nov 22, 2013
34
8
HTC One (m7)
Huawei Nexus 6P
Q: I already upgraded successfully from 12 to 13, but now i see the September OTA out there, is it normal Magisk procedure? e.g. 1. Uninstall, remove modules. 2. Download. 3.Boot into inactive slot from Magisk (After OTA).
Is that OK or will it be a storm?
 
  • Like
Reactions: roirraW "edor" ehT

roirraW "edor" ehT

Forum Moderator
Staff member
Q: I already upgraded successfully from 12 to 13, but now i see the September OTA out there, is it normal Magisk procedure? e.g. 1. Uninstall, remove modules. 2. Download. 3.Boot into inactive slot from Magisk (After OTA).
Is that OK or will it be a storm?
Since I don't use the OTA method, I use the (full) factory image, I can't say first-hand, but I know at least one of the two OTA methods doesn't work going to Android 13, and I believe the one that has a problem is the one you're describing.
 

shoey63

Recognized Contributor
Q: I already upgraded successfully from 12 to 13, but now i see the September OTA out there, is it normal Magisk procedure? e.g. 1. Uninstall, remove modules. 2. Download. 3.Boot into inactive slot from Magisk (After OTA).
Is that OK or will it be a storm?
Don't do it.
You will get a "device corrupt" message followed by hanging on the Google splash screen. (Happened last 3 updates on latest Magisk canary for me).
It seems Magisk no longer supports this method for 6/6 Pro.
Just take the update OTA (after restoring images) or flash factory images, then patch the new boot image with Magisk and use it to regain root.
 

proac

Member
Dec 26, 2015
22
9
Google Pixel 4a 5G
Caution: I originally wrote this guide when it was necessary to disable verity and verification before flashing patched boot.img. Now Magisk has overcome this requirement and some users have reportedly flashed updates without disabling verification and verity and did not have to wipe their phones, but request everyone, who have verification and verity disabled and using this guide, make sure you backup all the data and post your results here (I suggest backing up data anyway for everyone).

Following is a guide to update Pixel 6 Pro (perhaps all Pixel devices) every month, without wiping and retaining root. I tested it on my Pixel 6 Pro from 12.0.0 (SD1A.210817.015.A4, Oct 2021) to 12.0.0 (SD1A.210817.036, Nov 2021). There is no reason that it should not work on subsequent monthly patches, but just take the backups to be sure.

1) Download the latest factory image for your device and platform-tools from the official Google site and extract them in one folder.

2) Extract the boot.img from image-raven-xxxxxxx.zip which was extracted from the image in the above step and patch it in Magisk Manager (latest canary build from https://github.com/topjohnwu/Magisk) on your phone and copy it back to the folder where you extracted the factory image and platform-tools. Rename the copied file to magisk_patched.img

3) Open flash-all.bat in notepad, add --skip-reboot and remove -w from the fastboot update line. Also add the following lines after the fastboot update line to flash the Magisk patched boot.img automatically:

fastboot reboot-bootloader
ping -n 5 127.0.0.1 >nul
fastboot flash boot magisk_patched.img
fastboot reboot

After editing, the edited part of your flash-all.bat should look something like this:

Code:
fastboot --skip-reboot update [****image_name****]
fastboot reboot-bootloader
ping -n 5 127.0.0.1 >nul
fastboot flash boot magisk_patched.img
fastboot reboot

echo Press any key to exit...

Note: [****image_name****] is just a placeholder and needs to be the name of zip file which was originally there in flash-all.bat, do not change that. Be careful to rename the Magisk patched boot.img to magisk_patched.img or in the alternative make appropriate modifications in the flash-all.bat

4) Open command prompt and go the folder where you extracted factory image and platform-tools. Type the following commands:

adb reboot bootloader
flash-all.bat

Your device should be upgraded to the latest factory image, while retaining root, without wiping data.

Update 1: I updated from 12.0.0 (SD1A.210817.036, Nov 2021) to 12.0.0 (SD1A.210817.037, Nov 2021) successfully using my method, without loosing data and root.

Update 2: I updated from 12.0.0 (SD1A.210817.037, Nov 2021) to 12.0.0 (SQ1D.211205.016.A1, Dec 2021) successfully using my method, without loosing data and root.

Update 3: I updated from 12.0.0 (SQ1D.211205.016.A1, Dec 2021) to 12.0.0 (SQ1D.220105.007, Jan 2022) successfully using my method, without loosing data and root.

Update 4: I updated from 12.0.0 (SQ1D.220105.007, Jan 2022) to 12.0.0 (SQ1D.220205.003, Feb 2022) successfully using my method, without loosing data and root.

Update 5: I updated from 12.0.0 (SQ1D.220205.003, Feb 2022) to Android 12L DP 3 successfully using my method, without loosing data and root.

Update 6: I updated from Android 12L DP 3 to Android 13 DP successfully using my method, without loosing data and root.
This method can only be upgraded in the current slot (if it is slot A), and the other slot (slot B) will not be updated for a long time.

My solution is to add three lines to the beginning of the fastboot command:



fastboot set_active other

fastboot reboot bootloader

ping -n 5 127.0.0.1 >nul



In this way, upgrade every can be upgraded in another slot in turn, just like the effect of ota, skip slot upgrade.

I used this method to flash the August update and September update of three mobile phones (all 4A5G).

No problems were found. (Sorry for bad English, translated with Google)



Finally, the full edited script as pictured:

Green indicates edited sections

Blue indicates the filename that should be replaced
 

Attachments

  • d7152d1b6a5a025f81433f3cb07fac0.png
    d7152d1b6a5a025f81433f3cb07fac0.png
    59.5 KB · Views: 35

proac

Member
Dec 26, 2015
22
9
Google Pixel 4a 5G
This method can only be upgraded in the current slot (if it is slot A), and the other slot (slot B) will not be updated for a long time.

My solution is to add three lines to the beginning of the fastboot command:



fastboot set_active other

fastboot reboot bootloader

ping -n 5 127.0.0.1 >nul



In this way, upgrade every can be upgraded in another slot in turn, just like the effect of ota, skip slot upgrade.

I used this method to flash the August update and September update of three mobile phones (all 4A5G).

No problems were found. (Sorry for bad English, translated with Google)



Finally, the full edited script as pictured:

Green indicates edited sections

Blue indicates the filename that should be replaced
The two slots are updated and upgraded alternately every month.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    The two slots are updated and upgraded alternately every month.
    If you take the actual Over The Air update, then this is true. If you manually update your phone, then it depends on which method you use to manually flash your phone, and one of the two OTA methods - the one that flashes the other slot, is very hit and mostly miss for working with Magisk. Magisk has removed support for it yet again because it's a buggy method.

    Flash-All.Bat doesn't switch slots.

    Sideload full OTA does switch slots.

    Edit: See further posts on this page regarding suggestions to get Magisk working with the OTA other slot method.
    3
    Has anyone ever gotten an OTA to work as described here?

    Some people have, but it's been mostly a miss for most it seems.
    3
    One thing I noticed, and want to make others aware is when I upgrade monthly I have to re-root (this isn't the new part), but after re-rooting it causes the following hiccup: The Magisk Module "Audio Compatibility Patch" has to be reapplied every time you update the OS to re-apply the patches.
    3
    Q: I already upgraded successfully from 12 to 13, but now i see the September OTA out there, is it normal Magisk procedure? e.g. 1. Uninstall, remove modules. 2. Download. 3.Boot into inactive slot from Magisk (After OTA).
    Is that OK or will it be a storm?
    Don't do it.
    You will get a "device corrupt" message followed by hanging on the Google splash screen. (Happened last 3 updates on latest Magisk canary for me).
    It seems Magisk no longer supports this method for 6/6 Pro.
    Just take the update OTA (after restoring images) or flash factory images, then patch the new boot image with Magisk and use it to regain root.
    2
    Some people have, but it's been mostly a miss for most it seems.
    Definitely a miss for me!
  • 69
    Caution: I originally wrote this guide when it was necessary to disable verity and verification before flashing patched boot.img. Now Magisk has overcome this requirement and some users have reportedly flashed updates without disabling verification and verity and did not have to wipe their phones, but request everyone, who have verification and verity disabled and using this guide, make sure you backup all the data and post your results here (I suggest backing up data anyway for everyone).

    Following is a guide to update Pixel 6 Pro (perhaps all Pixel devices) every month, without wiping and retaining root. I tested it on my Pixel 6 Pro from 12.0.0 (SD1A.210817.015.A4, Oct 2021) to 12.0.0 (SD1A.210817.036, Nov 2021). There is no reason that it should not work on subsequent monthly patches, but just take the backups to be sure.

    1) Download the latest factory image for your device and platform-tools from the official Google site and extract them in one folder.

    2) Extract the boot.img from image-raven-xxxxxxx.zip which was extracted from the image in the above step and patch it in Magisk Manager (latest canary build from https://github.com/topjohnwu/Magisk) on your phone and copy it back to the folder where you extracted the factory image and platform-tools. Rename the copied file to magisk_patched.img

    3) Open flash-all.bat in notepad, add --skip-reboot and remove -w from the fastboot update line. Also add the following lines after the fastboot update line to flash the Magisk patched boot.img automatically:

    fastboot reboot-bootloader
    ping -n 5 127.0.0.1 >nul
    fastboot flash boot magisk_patched.img
    fastboot reboot

    After editing, the edited part of your flash-all.bat should look something like this:

    Code:
    fastboot --skip-reboot update [****image_name****]
    fastboot reboot-bootloader
    ping -n 5 127.0.0.1 >nul
    fastboot flash boot magisk_patched.img
    fastboot reboot
    
    echo Press any key to exit...

    Note: [****image_name****] is just a placeholder and needs to be the name of zip file which was originally there in flash-all.bat, do not change that. Be careful to rename the Magisk patched boot.img to magisk_patched.img or in the alternative make appropriate modifications in the flash-all.bat

    4) Open command prompt and go the folder where you extracted factory image and platform-tools. Type the following commands:

    adb reboot bootloader
    flash-all.bat

    Your device should be upgraded to the latest factory image, while retaining root, without wiping data.

    Update 1: I updated from 12.0.0 (SD1A.210817.036, Nov 2021) to 12.0.0 (SD1A.210817.037, Nov 2021) successfully using my method, without loosing data and root.

    Update 2: I updated from 12.0.0 (SD1A.210817.037, Nov 2021) to 12.0.0 (SQ1D.211205.016.A1, Dec 2021) successfully using my method, without loosing data and root.

    Update 3: I updated from 12.0.0 (SQ1D.211205.016.A1, Dec 2021) to 12.0.0 (SQ1D.220105.007, Jan 2022) successfully using my method, without loosing data and root.

    Update 4: I updated from 12.0.0 (SQ1D.220105.007, Jan 2022) to 12.0.0 (SQ1D.220205.003, Feb 2022) successfully using my method, without loosing data and root.

    Update 5: I updated from 12.0.0 (SQ1D.220205.003, Feb 2022) to Android 12L DP 3 successfully using my method, without loosing data and root.

    Update 6: I updated from Android 12L DP 3 to Android 13 DP successfully using my method, without loosing data and root.
    9
    Just tried this on my P6Pro. Managed to update from .015 to .036 and retained root.
    Also still passing SafetyNet with USNF 2.2 beta
    8
    I don't know why folks continue to have issues updating when a new Android update is released. Despite Magisk having the option to install to an inactive slot for easy OTA updating, I simply avoid it and go the old-school route of updating via sideload to prevent any issues.

    In hopes of putting to rest issues some of you face, here is what I do:

    • Make a backup of all my important files in case something goes wrong
    • Disable any Magisk modules if it makes you feel any safer
    • Download the OTA image online and NOT from the system update!
    • Reboot to recovery and sideload the OTA by using:
    Code:
    adb reboot sideload
    • Then, in recovery I load up the file by using:
    Code:
    adb sideload "insert OTA file name here.zip"
    • Once it finishes, you will be in recovery mode. Select "Reboot to system now".
    • Once the system reboots, I unlock the device and let it finish completing the update before anything else.
    I then proceed to root the device as I normally would, by:
    • Getting the NEW boot.img file from the full factory image
    • Copy it to my mobile device
    • Open up Magisk and patch the boot.img file
    • Copy the patched file to my PC
    • Reboot into bootloader using:
    Code:
    adb reboot bootloader

    Then, patch the new boot.img using:

    Code:
    fastboot flash boot "patched_boot.img"

    Reboot / Done.

    I have not had it fail once using this process on stable Magisk and NO "disable" tags. The only reason I can see for anyone to use Canary versions of Magisk or "disable" tags, is if its absolutely required for some modules, ROMs, or kernels you are using. If it's not needed, just leave it alone.

    You could technically just dirty flash the entire full factory image using the Android Flash Tool or flash-all.bat script on your PC, but the script file is where I find most folks mess up because they copy and pasted instructions improperly, or there's a line of code they forgot to add or remove without proofreading before running the script. I'd rather take matters into my own hands, even if it means completing more steps to make sure things go smoothly.

    Anyway, I hope this helps someone!
    7
    So I notice there are some people, like me, that are a bit confused on how to exactly do this process. I like to be nice every once in a while, so this is my time. I will try to do a step by step process with exactly how I did after reading, and re-reading all the comments on how to do it (with pictures cuz I need pictures to learn haha).

    These are the exact steps I took when I updated from .36 to .37

    I downloaded the .37 zip, the one for your phone, mine is an unlocked version.
    LaL2hSk_0qyLp5oaPEuURPDf5vItZ4YnlNFR2UPtQMRGIvceVoBc8nGvxpmu90RonBslivQblX8-YrygqYIrtbz1B7AvAPk8lKQ4z5jctSVh97hWwkzuO2kK2Os7doqxiUK-HJrx


    Slapped the .37 zip file into a folder by itself so I can extract it inside that same folder. It should look like this once its extracted inside the same folder.

    1637794601085.png


    Then I opened another folder/window with the Platform-tools so I can easily navigate between the 2 folders.

    Then I opened the flash-all.bat from the zipped folder, to see what it contains, noticed that it flashes 3 files/images.
    “bootloader-raven-slider”
    “radio-raven”
    “Image-raven-sd1a”
    b-Lrwcu7O5sU1Yges_LPc33ynTBNbVMki5KPtndnhgTLKp05njPQO_uoik6Tw11_tDyM7jCAlm0SjBbzK6b7MOkoKSOku9uhclnTclBZPDDfHumwjqLNrtHKRJ2yUoRf1B_y8EPW

    Then close the file as we dont need it right now.

    So with this I know that I will need to add those 3 files to the platform-tools folder when I go to actually run the command.

    I actually took the .37 boot.img and copied it into my pixel with version .36 still running.
    The boot.img is inside the zipped folder and when you extracted it, it will now be viewable along with other files and the zipped folder still there.
    1637794847696.png


    copy this boot into the main folder of the pixel
    1637795054884.png


    On your Pixel, open Magisk and click install then select patch file, navigate to the boot.img file in your internal storage.
    Patch it with Magisk and then take the patched boot.img (which that file will actually be in your downloads folder in your Pixel) and copied it back to my computer.

    So as of now, it seems we are able to patch boot.img with current build without having to update then patch then flash. We can just patch on the current build then copy the patch to the computer and run the rest of the steps.

    Now that I have the patched boot.img on my computer, I will take all the highlighted files in the picture, plus the patched boot.img over to the Platforms-tools folder and just copy them in that folder.
    Here, I’m not sure how everyone else has their folder since I rarely use those tools, so I just add the files and then delete them after I’m done flashing. See picture of all copied in files. (dont forget your patched boot.img)

    -Q2fqEHQmA5DPStoBV4ht9FVinUy7MD2GF4bi38EhGlItokhERTlrJAknwjGtSGXeMTVPnQn-6FZwXFqLJljCjYmrh3rYl4XPrDdLoyBO4QSOaaact8E2FvXwxjCZRfudWUgt_3m


    Now I will open the flash-all.bat that's inside the Platform-tools using Notepad ++ (personal preference).
    Edit this file exactly like in the picture. Add the lines exactly how it shows in the picture.
    **NOTE** that you need to type the exact patched boot file in there. So, like in this picture, but with YOUR patched "magisk_patched" file as this will have your own ID after 23014.
    1637734768289.png

    once you made the edits on this file, dont forget to save it before you run the commands!

    Now plug in your phone to the computer.
    Make sure you have USB debugging turned on.
    Press shift and right click inside the Platform-tools folder and open Command Prompt.
    run these 2 commands:
    adb reboot bootloader
    flash-all.bat

    When it's all done, your phone will boot up and you will be on the new .37
    Nothing else to add here as it will literally run through everything for you and boot up and you're done.

    Hope this helps someone, as I am a visual learner myself.
    7
    couldnt we just add step 5 into the flash-all file? for example:
    fastboot reboot-bootloader
    fastboot flash boot magisk_patched-xxxxx.img
    fastboot reboot

    like in the picture? or would it not actually run that way?
    View attachment 5465521
    holy poop that worked!! i was scared to try it myself but since i have a backup phone with all my data on it, it wouldnt be so bad to wipe the pixel if i messed it up doing it this way! But hey, it actually worked!!
    here is the modified flash-all and yes you will need the "ping" line after the update line.
    1637619349812.png


    so with this, no need to type extra stuff, just add it all in the flash-all file and run the first 2 commands:
    adb reboot bootloader
    flash-all.bat

    and thats it, the only time consuming part is patching the boot, putting it in the folder with the platform-tools.