[GUIDE] Pixel 5 "redfin": Unlock Bootloader, Update, Root, Pass SafetyNet

Search This thread

Regys

Senior Member
Sep 10, 2012
195
10
Hi,

I have an important issue on the security of an application.

In Magisk it is possible to make an application invisible to hide it from root.

But does Magisk make him only invisible or then he unooys the application ?

In other words, is the application secured ?
 

V0latyle

Forum Moderator
Staff member
Hi,

I have an important issue on the security of an application.

In Magisk it is possible to make an application invisible to hide it from root.

But does Magisk make him only invisible or then he unooys the application ?

In other words, is the application secured ?
I am not sure what you are asking.

I don't provide support for Magisk. Magisk specific questions should be posted in this thread.
 

Zanzibar

Senior Member
Jan 1, 2010
127
577
San Diego
My Pixel 5 is rooted, and still on Android 11. I haven't updated yet, because I didn't want to use disable-verity and disable-verification and be forced to wipe data.

With the new Canary version of Magisk (23017), should I be able to finally update to Android 12 without wiping data, and still maintain (or re-patch boot.img) root?

My thought process is this. Either sideload the OTA or flash factory image removing "-w" from the update line. Install Magisk, patch the boot.img file, then fastboot flash boot boot.img.

Does that sound like it would work, and let me keep my data?

Am I missing any steps?
 

V0latyle

Forum Moderator
Staff member
My Pixel 5 is rooted, and still on Android 11. I haven't updated yet, because I didn't want to use disable-verity and disable-verification and be forced to wipe data.

With the new Canary version of Magisk (23017), should I be able to finally update to Android 12 without wiping data, and still maintain (or re-patch boot.img) root?

My thought process is this. Either sideload the OTA or flash factory image removing "-w" from the update line. Install Magisk, patch the boot.img file, then fastboot flash boot boot.img.

Does that sound like it would work, and let me keep my data?

Am I missing any steps?
Yes, you're missing the most critical step: Always read the OP. Your questions have already been answered and the necessary information provided.
 

V0latyle

Forum Moderator
Staff member
Magisk Canary 23018 is out.
Changes:
  • [Zygisk] Show warning in app UI to indicate incompatible Zygisk modules
  • [App] Allow modules to specify an update URL for in-app update + install
Update from within Magisk to prevent problems like breaking root.

If you do not already have Magisk installed, Download it here
 
Last edited:

TKruzze

Senior Member
Jul 25, 2010
1,670
23,772
Ann Arbor, MI
Note: If you have hidden the Magisk app, update from within Magisk! Multiple instances of Magisk will break root!
To state it more clearly, since this seems to be a huge problem...

If you have previously hidden the Magisk app, make certain you PERFORM ALL UPDATES FROM WITHIN THE MAGISK APP. If you don't do it this way, you'll end up with with multiple installs of the app, which will break root.
 
  • Like
Reactions: V0latyle

V0latyle

Forum Moderator
Staff member
To state it more clearly, since this seems to be a huge problem...

If you have previously hidden the Magisk app, make certain you PERFORM ALL UPDATES FROM WITHIN THE MAGISK APP. If you don't do it this way, you'll end up with with multiple installs of the app, which will break root.
Updating from within the app is the preferred method. I'll update my posts.
 
  • Like
Reactions: TKruzze

V0latyle

Forum Moderator
Staff member
Magisk Canary updated to 23019
Changes:
- [Zygisk] Skip loading modules into the Magisk app to prevent conflicts
- [MagiskBoot] Change `zopfli` to a more reasonable config so it doesn't take forever
- [General] Several `BusyBox` changes

Preferred method of update is from within Magisk app.

If installing for the first time, here is the APK Download
 

V0latyle

Forum Moderator
Staff member
Magisk Stable is now at version 24.1, so I will no longer be providing any Magisk updates.

You can use any version of Magisk now - Stable, Beta, or Canary. as long as it is 23016 or newer.

Once again, if you want to switch versions of Maagisk, it is HIGHLY RECOMMENDED that you "Complete Uninstall" within Magisk before installing the new version. Multiple instances of Magisk can break root.

If you simply want to update Magisk, the best way to do so is from within the app.


Once the February update is out, I will perform some testing with installing to inactive slot, and if it works, I will update this guide.

Given the low activity on this thread, I will probably close it if everything goes well with the next update.

Thank you all for your testing and contributions.
 

a4abbas

Senior Member
Jan 29, 2013
69
2
@V0latyle
I am currently rooted with your Update and Root OTA Sideload method. I forgot to use phone transfer tool before setting up the phone. AFAIK now to do that I need to factory reset my phone. What steps do I have to follow to get rooted again? . Please advice.
 

V0latyle

Forum Moderator
Staff member
@V0latyle
I am currently rooted with your Update and Root OTA Sideload method. I forgot to use phone transfer tool before setting up the phone. AFAIK now to do that I need to factory reset my phone. What steps do I have to follow to get rooted again? . Please advice.
That sucks, I was trying to find a way for you to transfer data without having to factory reset. I believe you might be able to do that using Swift Backup as long as you have root on both devices.

If you are currently rooted and perform a factory reset, it only wipes /data. It doesn't restore the factory boot image, so your existing boot image will still be patched; the only thing you should have to do to regain root is install Magisk. It shouldn't matter what version of Magisk you install, either, because a data wipe removes all the signatures and other "links" between the Magisk app and the boot image patch.
 

a4abbas

Senior Member
Jan 29, 2013
69
2
That sucks, I was trying to find a way for you to transfer data without having to factory reset. I believe you might be able to do that using Swift Backup as long as you have root on both devices.

If you are currently rooted and perform a factory reset, it only wipes /data. It doesn't restore the factory boot image, so your existing boot image will still be patched; the only thing you should have to do to regain root is install Magisk. It shouldn't matter what version of Magisk you install, either, because a data wipe removes all the signatures and other "links" between the Magisk app and the boot image patch.

Someone suggested me to try this method below. Is it safe to do so considering that I am rooted:

Run this adb command from your computer:

adb shell am start -a android.intent.action.MAIN -n com.google.android.setupwizard/.SetupWizardTestActivity
 

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    I updated to June the way I always have:
    • Patched new boot image in Magisk
    • Reboot to bootloader
    • Flash bootloader and radio
    • Reboot to bootloader
    • Dirty flash factory image (--skip-reboot --slot=all)
    • Flash patched boot image to both slots
    • Reboot; update complete.
    1
    No, still on the Android 12 beta which I had to install to get out of a mess that you helped me with back in January (see post #128).
    Oh, okay. You should be able to update to the latest release using the method of your choice. I would personally recommend dirty flashing the factory image.
  • 15
    If you are looking for my guide on a different Pixel, find it here:
    Update 6-20-22: Magisk 25.1 is recommended as this includes fixes for OTA updates.
    Discussion thread for migration to 24.0+.

    DO NOT use any version of Magisk lower than Canary 23016 as it does not yet incorporate the necessary fixes for Android 12 and your device.


    WARNING: YOU AND YOU ALONE ARE RESPONSIBLE FOR ANYTHING THAT HAPPENS TO YOUR DEVICE. THIS GUIDE IS WRITTEN WITH THE EXPRESS ASSUMPTION THAT YOU ARE FAMILIAR WITH ADB, MAGISK, ANDROID, AND ROOT. IT IS YOUR RESPONSIBILITY TO ENSURE YOU KNOW WHAT YOU ARE DOING.

    Prerequisites:


    Android Source - Setting up a device for development


    1. Follow these instructions to enable Developer Options and USB Debugging.
    2. Enable OEM Unlocking. If this option is grayed out, unlocking the bootloader is not possible.
    3. Connect your device to your PC, and open a command window in your Platform Tools folder.
    4. Ensure ADB sees your device:
      Code:
      adb devices
      If you don't see a device, make sure USB Debugging is enabled, reconnect the USB cable, or try a different USB cable.
      If you see "unauthorized", you need to authorize the connection on your device.
      If you see the device without "unauthorized", you're good to go.
    5. Reboot to bootloader:
      Code:
      adb reboot bootloader
    6. Unlock bootloader: THIS WILL WIPE YOUR DEVICE!
      Code:
      fastboot flashing unlock
      Select Continue on the device screen.

    1. Install Magisk on your device.
    2. Download the factory zip for your build.
    3. Inside the factory zip is the update zip: "device-image-buildnumber.zip". Open this, and extract boot.img
    4. Copy boot.img to your device.
    5. Patch boot.img with Magisk: "Install" > "Select and Patch a File"
    6. Copy the patched image back to your PC. It will be named "magisk_patched-23xxx_xxxxx.img". Rename this to "master root.img" and retain it for future updates.
    7. Reboot your device to bootloader.
    8. Flash the patched image:
      Code:
      fastboot flash boot <drag and drop master root.img here>
    9. Reboot to Android. Open Magisk to confirm root - under Magisk at the top, you should see "Installed: <Magisk build number>

    1. Before you download the OTA, open Magisk, tap Uninstall, then Restore Images. If you have any Magisk modules that modify system, uninstall them now.
    2. Take the OTA update when prompted. To check for updates manually, go to Settings > System > System Update > Check for Update
    3. Allow the update to download and install. DO NOT REBOOT WHEN PROMPTED. Open Magisk, tap Install at the top, then Install to inactive slot. Magisk will then reboot your device.
    4. You should now be updated with root.

    1. Download the OTA.
    2. Reboot to recovery and sideload the OTA:
      Code:
      adb reboot sideload
      Once in recovery:
      Code:
      adb sideload ota.zip
    3. When the OTA completes, you will be in recovery mode. Select "Reboot to system now".
    4. Allow system to boot and wait for the update to complete. You must let the system do this before proceeding.
    5. Reboot to bootloader.
    6. Boot the master root image (See note 1):
      Code:
      fastboot boot <drag and drop master root.img here>
      Note: If you prefer, you can download the factory zip and manually patch the new boot image, then flash it after the update. Do not flash an older boot image after updating.
    7. Your device should boot with root. Open Magisk, tap Install, and select Direct Install.
    8. Reboot your device. You should now be updated with root.
    Note: You can use Payload Dumper to extract the contents of the OTA if you want to manually patch the new boot image. However, I will not cover that in this guide.

    Please note that the factory update process expects an updated bootloader and radio. If these are not up to date, the update will fail.
    1. Download the factory zip and extract the contents.
    2. Reboot to bootloader.
    3. Compare bootloader versions between phone screen and bootloader.img build number
      Code:
      fastboot flash bootloader <drag and drop new bootloader.img here>
      If bootloader is updated, reboot to bootloader.
    4. Compare baseband versions between phone screen and radio.img build number
      Code:
      fastboot flash radio <drag and drop radio.img here>
      If radio is updated, reboot to bootloader.
    5. Apply update:
      Code:
      fastboot update --skip-reboot image-codename-buildnumber.zip
      When the update completes, the device will be in fastbootd. Reboot to bootloader.
    6. Boot the master root image (See note 1):
      Code:
      fastboot boot <drag and drop master root.img here>
      Note: If you prefer, you can manually patch the new boot image, then flash it after the update. Do not flash an older boot image after updating.
    7. Your device should boot with root. Open Magisk, tap Install, and select Direct Install.
    8. Reboot your device. You should now be updated with root.
    Note: If you prefer, you can update using the flash-all script included in the factory zip. You will have to copy the script, bootloader image, radio image, and update zip into the Platform Tools folder; you will then have to edit the script to remove the -w option so it doesn't wipe your device.
    The scripted commands should look like this:
    Code:
    fastboot flash bootloader <bootloader image name>
    fastboot reboot bootloader
    ping -n 5 127.0.0.1 > nul
    fastboot flash radio <radio image name>
    fastboot reboot bootloader
    ping -n 5 127.0.0.1 > nul
    fastboot update  --skip-reboot --slot=all <image-device-buildnumber.zip>
    Once this completes, you can reboot to bootloader and either boot your master patched image, or if you patched the new image, flash it at this time.

    1. Follow the instructions on the Android Flash Tool to update your device. Make sure Lock Bootloader and Wipe Device are UNCHECKED.
    2. When the update completes, the device will be in fastbootd. Reboot to bootloader.
    3. Boot the master root image (See note 1):
      Code:
      fastboot boot <drag and drop master root.img here>
      Note: If you prefer, you can download the factory zip and manually patch the new boot image, then flash it after the update. Do not flash an older boot image after updating.
    4. Your device should boot with root. Open Magisk, tap Install, and select Direct Install.
    5. Reboot your device. You should now be updated with root.

    This is my configuration that is passing Safety Net. I will not provide instructions on how to accomplish this. Attempt at your own risk.

    Zygisk + DenyList enabled
    All subcomponents of these apps hidden under DenyList:
    • Google Play Store
    • GPay
    • Any banking/financial apps
    • Any DRM media apps
    Modules:
    To check SafetyNet status:
    I do not provide support for Magisk or modules. If you need help with Magisk, here is the Magisk General Support thread. For support specifically with Magisk v24+, see this thread.

    Points of note:
    • The boot image is NOT the bootloader image. Do not confuse the two - YOU are expected to know the difference. Flashing the wrong image to bootloader could brick your device.
    • While the Magisk app is used for patching the boot image, the app and the patch are separate. This is what you should see in Magisk for functioning root:
      screenshot_20211218-194517-png.5486339
    • "Installed" shows the version of patch in the boot image. If this says N/A, you do not have root access - the boot image is not patched, or you have a problem with Magisk.
    • "App" simply shows the version of the app itself.
    • If you do not have a patched master boot image, you will need to download the factory zip if you haven't already, extract the system update inside it, then patch boot.img.
    • If you prefer updating with the factory image, you can also extract and manually patch the boot image if desired.
    • Some Magisk modules, especially those that modify read only partitions like /system, may cause a boot loop after updating. As a general rule, disable these modules before updating. You are responsible for knowing what you have installed, and what modules to disable.


    Credits:
    Thanks to @ipdev , @kdrag0n , @Didgeridoohan , and last but not least, @topjohnwu for all their hard work!
    6
    Magisk Canary was updated to 23016 last night. This includes a fix for the vbmeta header issue, meaning that disabling verity/verification should no longer be required, and we should be able to root as we did before. This needs testing, make sure you back up your data and photos before you try this!

    Q: "If verity/verification are disabled, do I need to enable them now?"
    A: No. The only thing you have to do is update to Magisk 23016.
    Q: "Will enabling verity/verification wipe my data?"
    A: No.

    I will be updating the OP to reflect this.
    4
    For those who are wondering, this is how I updated my Pixel 5 (and my wife's 5a):
    1. Download and extract the factory image
    2. Extract boot.img from the factory update image
    3. Copied boot.img to device, patched in Magisk, copied patched boot image back to update folder
    4. Reboot device to bootloader
    5. Apply update:
      Code:
      fastboot update device-image-buildnumber.zip
    6. Let device boot and finish update; reboot to bootloader
    7. Boot patched image:
      Code:
      fastboot boot magisk_patched-23016_xxxxx.img
    8. Open Magisk, tap Install, Direct Install, then reboot.
    9. Done.
    You can potentially save a couple steps by using --skip-reboot when applying the update, then simply rebooting to bootloader and flashing the patched boot image.

    Note: I manually patched the boot image because I didn't have a 23016 boot image handy.
    4
    For those who are wondering, this is how I updated my Pixel 5 (and my wife's 5a):
    1. Download and extract the factory image
    2. Extract boot.img from the factory update image
    3. Copied boot.img to device, patched in Magisk, copied patched boot image back to update folder
    4. Reboot device to bootloader
    5. Apply update:
      Code:
      fastboot update device-image-buildnumber.zip
    6. Let device boot and finish update; reboot to bootloader
    7. Boot patched image:
      Code:
      fastboot boot magisk_patched-23016_xxxxx.img
    8. Open Magisk, tap Install, Direct Install, then reboot.
    9. Done.
    You can potentially save a couple steps by using --skip-reboot when applying the update, then simply rebooting to bootloader and flashing the patched boot image.

    Note: I manually patched the boot image because I didn't have a 23016 boot image handy.
    Confirmed working

    Just applied January update like how I have always been doing on Android 11. This wouldn't be possible without Magisk version 23016
    4
    @TKruzze @V0latyle If you're using USNF it doesn't matter if you add the necessary gms components to the Deny listh. The module will always remove them since keeping them on the list will actually keep USNF from doing it's thing.

    For simple SafetyNet pass Universal SafetyNet Fix is all you need (and possibly MagiskHide Props Config if you need to spoof a device fingerprint).