Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zander21510/2a6e93d3875621db26370b3044d4d818 to your computer and use it in GitHub Desktop.
Save zander21510/2a6e93d3875621db26370b3044d4d818 to your computer and use it in GitHub Desktop.
Added additional instructions and corrected/explained filename issues.

How To Fix "Stock Backup Does Not Exist" message in Magisk when using "Restore Images" to flash OTA

DISCLAIMER: I didn't come up with these steps, nor do I provide any support for these steps. I just wanted to add some additional information that helped me. Not responsible if you brick your phone/cause thermonuclear war/etc. Use at your own risk/PLEASE google/research if you are unsure of what you're doing.

STEP 1:

Connect your phone to your computer via ADB. If you don't know how to do this, please search before following these steps

STEP 2:

put stock boot.img into /sdcard/boot.img. MAKE SURE the name of the file is "boot.img", otherwise you will need to alter the following commands to use the name of the file. MAKE SURE your stock boot.img IS A VALID BOOT FILE, if it is not, Magisk will still restore the image, but the OTA will not work and your phone will not work upon reboot. You can test the boot file in Fastboot, run fastboot boot boot.img. If you get a successful boot, the image is good.

STEP 3:

get sha1. Execute the following commands on your computer with your phone connected via ADB

  adb shell
  su
  SHA1=$(cat $(magisk --path)/.magisk/config | grep SHA1 | cut -d '=' -f 2)

STEP 4:

repack boot.img.gz

  gzip -9f /sdcard/boot.img

STEP 5:

restore backup

  mkdir /data/magisk_backup_${SHA1}
  mv /sdcard/boot.img.gz /data/magisk_backup_${SHA1}/boot.img.gz
  chmod -R 755 /data/magisk_backup_${SHA1}
  chown -R root.root /data/magisk_backup_${SHA1}

You should now be able to go into Magisk and use the "Restore Images" option to install your OTA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment