Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore images flashes an init_boot backup to the boot partition #8211

Closed
osm0sis opened this issue Jul 13, 2024 · 32 comments
Closed

Restore images flashes an init_boot backup to the boot partition #8211

osm0sis opened this issue Jul 13, 2024 · 32 comments
Assignees
Labels
app This issue is related to Magisk App regression Something works in previous versions but not in the current one

Comments

@osm0sis
Copy link
Collaborator

osm0sis commented Jul 13, 2024

Device: Pixel 8 Pro
Android version: 14 (Stock)
Magisk version name: b38ab2a
Magisk version code: 27004

Steps to reproduce:

  1. Ensure a fresh stock backup by deleting /data/magisk_backup*, manually restoring stock init_boot, Direct Install 27004 then reboot.
  2. See that there is indeed a new /data/magisk_backup* directory with boot.img.gz.
  3. Press Uninstall Magisk then Restore Images to see it fail with "Stock backup does not exist!"

Log excerpt:

07-14 00:35:33.024  9741  9741 I AppCompatDelegate: The Activity's LayoutInflater already has a Factory installed so we can not install AppCompat's
07-14 00:35:33.098  9741  9741 W TextView: onProvideContentCaptureStructure(): calling assumeLayout()
07-14 00:35:36.139  9741  9741 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=falsecallback=android.view.ViewRootImpl$$ExternalSyntheticLambda11@3f11883
07-14 00:35:36.144  9741 11748 D HWUI    : endAllActiveAnimators on 0xb4000070f4697b20 (RippleDrawable) with handle 0xb4000072646d3d80
07-14 00:35:36.183  9741  9741 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=falsecallback=android.view.ViewRootImpl$$ExternalSyntheticLambda11@1492c4d

Edit: Some progress was made with e6bd2ff but now the issue is that it shows "Restoration done!" but the image was never actually restored.

See #8211 (comment)

@osm0sis osm0sis added regression Something works in previous versions but not in the current one app This issue is related to Magisk App labels Jul 13, 2024
@osm0sis
Copy link
Collaborator Author

osm0sis commented Jul 13, 2024

The rooted init_boot partition's .backup/.magisk contains:

KEEPVERITY=true
KEEPFORCEENCRYPT=true
RECOVERYMODE=false
PREINITDEVICE=sda10
SHA1=78100e19359f3debfbe35fa4c1f403d1c90191e6

And the backup is at /data/magisk_backup_78100e19359f3debfbe35fa4c1f403d1c90191e6/boot.img.gz

So those matching correctly should hopefully narrow the location of the fault down a bit.

@pixincreate

This comment was marked as outdated.

@osm0sis
Copy link
Collaborator Author

osm0sis commented Jul 14, 2024

It was definitely working for me on 27002. I didn't test really with 27003 since it couldn't Direct Install while the app was hidden.

Edit: I quickly rolled back to 27003 unhidden to test and it restored images without issue, so this is confirmed a new regression as of 27004, at least on my devices.

@pixincreate
Copy link

Oh, I forgot to mention that I had created multiple tags between 27003 and 27004 in my version of Magisk, so might be one among them.

@Bennett-69
Copy link

It was definitely working for me on 27002. I didn't test really with 27003 since it couldn't Direct Install while the app was hidden.

Edit: I quickly rolled back to 27003 unhidden to test and it restored images without issue, so this is confirmed a new regression as of 27004, at least on my devices.

Still present in 27006, apparently. Glad I found this issue report before struggling any further, I just migrated from Kitsune-27003 to Magisk (Canary) 27006, and thought I'd screwed up the stock backup in the process. Hopefully this regression gets fixed at some point, or OTA updates are going to be a bit more of a PITA.

@OdinZhang
Copy link

OdinZhang commented Aug 14, 2024

any solution? seems doesn't affect OTA. my pixel 6 and 7 just updated to Android 15 beta 4.2 and I install magisk to another slot and it works

@Bennett-69
Copy link

any solution? seems doesn't affect OTA. my pixel 6 and 7 just updated to Android 15 beta 4.2 and I install magisk to another slot and it works

For whatever reason, my Pixel 8 Pro never even recognizes an OTA update is available for download until I (temporarily) uninstall Magisk by restoring images before checking, which is what's currently broken in 27004-27006.

@osm0sis
Copy link
Collaborator Author

osm0sis commented Aug 15, 2024

any solution? seems doesn't affect OTA. my pixel 6 and 7 just updated to Android 15 beta 4.2 and I install magisk to another slot and it works

For whatever reason, my Pixel 8 Pro never even recognizes an OTA update is available for download until I (temporarily) uninstall Magisk by restoring images before checking, which is what's currently broken in 27004-27006.

That part is expected behavior. But yeah, no way to restore images right now except manually from these app regressions, which is frustrating.

@MikeBishop

This comment was marked as off-topic.

@osm0sis

This comment was marked as off-topic.

@RuofengX

This comment was marked as off-topic.

@Bennett-69

This comment was marked as off-topic.

@osm0sis

This comment was marked as outdated.

Repository owner locked as resolved and limited conversation to collaborators Aug 27, 2024
Repository owner unlocked this conversation Aug 27, 2024
@osm0sis
Copy link
Collaborator Author

osm0sis commented Aug 27, 2024

Oh wait, nope, now it'll show "Restoration done!" but next doing a Direct Install still shows "Magisk patched boot image detected", meaning the restore didn't actually happen. 🤔

@topjohnwu

@osm0sis osm0sis reopened this Aug 27, 2024
@osm0sis osm0sis changed the title Restore images always fails with "Stock backup does not exist!" Restore images reports "Restoration done!" but doesn't actually restore Aug 27, 2024
@topjohnwu topjohnwu self-assigned this Sep 16, 2024
@topjohnwu
Copy link
Owner

@osm0sis I tested the feature on my own device and it's working properly

@osm0sis
Copy link
Collaborator Author

osm0sis commented Sep 17, 2024

I'll try again in the new Canary, but it's definitely not doing anything in 27007. It reports "Restoration done!" but doesn't actually restore.

@osm0sis
Copy link
Collaborator Author

osm0sis commented Sep 17, 2024

Managed to brick my Pixel 8 Pro doing rapid fire Restore Images and Direct Installs, not sure exactly why/how, but anyway, seemed pretty clear that it was still broken exactly as I described 3 weeks ago, even with a fresh init_boot backup from the Magisk app: #8211 (comment)

Anyway, hopefully someone else can confirm the issue is ongoing, since I'll be out of commission for a while.

@Bennett-69
Copy link

Managed to brick my Pixel 8 Pro doing rapid fire Restore Images and Direct Installs, not sure exactly why/how, but anyway, seemed pretty clear that it was still broken exactly as I described 3 weeks ago, even with a fresh init_boot backup from the Magisk app: #8211 (comment)

Anyway, hopefully someone else can confirm the issue is ongoing, since I'll be out of commission for a while.

Okay, maybe I'm not crazy (regarding this issue, anyway). My experience still exactly parallels yours: Uninstall (Restore Images) claims to work, but subsequent Direct Install detects an already-patched image. And then after updating to 27008 and rebooting, my Pixel 8 Pro was also bricked ("boot failure," etc.) until I downloaded and flashed the latest factory (not OTA) image with no wipe. Like you, even flashing my previously-patched or stock init_boot didn't help, only the full factory image.

I'm back up and running 27008, but sure don't trust messing with its alleged uninstall and direct install yet.

@osm0sis
Copy link
Collaborator Author

osm0sis commented Sep 18, 2024

Getting off topic, but even worse, I tried to fastboot set_active a while I was stuck in fastboot mode and that somehow hard bricked it to USB Serial Device (COM3) and no other signs of life. Wish I'd done what you did instead. Seems like RMA for repair is my only option now. 🤷‍♂️😢

Either way, sounds like there is in fact something still off with Restore Images, so I'll reopen this, and then perhaps also some investigation is warranted by the developers with either multiple subsequent Direct Installs, or perhaps with 27008 Direct Installed over itself, to see what's getting corrupted that would necessitate a Factory Image flash. If you wouldn't mind soft bricking yours again for science, you should try to see exactly which partition needed to be flashed to fix it, which might shed some light on the matter overall. 🤞

@osm0sis osm0sis reopened this Sep 18, 2024
@canyie
Copy link
Collaborator

canyie commented Sep 18, 2024

Just to be clear, can anyone confirm whether the bootloop happens only after restoring images? This sounds more than likely to be a new regression at magiskinit level 🤔

@osm0sis
Copy link
Collaborator Author

osm0sis commented Sep 18, 2024

I definitely had updated 27007 to 27008 and rebooted with all working to that point, before testing out Restore Images and Direct Install led me to the bigger issues. Sounds like @Bennett-69 currently has 27008 running as well.

@canyie
Copy link
Collaborator

canyie commented Sep 22, 2024

image
Ah, can confirm this issue. Restore image then dump /dev/block/by-name/boot and I can see the ramdisk is still magisk patched. After rebooting, magisk is still installed.

@canyie
Copy link
Collaborator

canyie commented Sep 22, 2024

Re-checked the image from /data/magisk_backup and it seems the image is correct... Not sure how it fails...

@M-ls
Copy link

M-ls commented Sep 27, 2024

Maybe it's the same problem. I used magisk27008 version to restore the original image. My init_boot was mistakenly flashed into the boot partition. I downloaded the original package to extract the boot and flashed it manually, and it can boot correctly. He did not modify the init_boot partition. The above problem occurred on Meizu 20 and Meizu 21Pro

@osm0sis
Copy link
Collaborator Author

osm0sis commented Sep 27, 2024

Something flashed to the wrong partition at some point was my guess for what happened to me, going to see if I can reproduce and confirm it when I get my warranty replacement Pixel 8 Pro. 🧐

@osm0sis
Copy link
Collaborator Author

osm0sis commented Sep 30, 2024

I can confirm the boot failure after a single Restore Images attempt on my replaced Pixel 8 Pro, and that immediately flashing only the stock boot.img to the boot partition gets it working again. So, must be that Restore Images is sending the init_boot .img in the backup to the boot partition by mistake, and thus leaving init_boot partition rooted as previously noted.

@osm0sis osm0sis changed the title Restore images reports "Restoration done!" but doesn't actually restore Restore images flashes an init_boot backup to the boot partition Oct 1, 2024
@canyie
Copy link
Collaborator

canyie commented Oct 1, 2024

It seems that the issue I faced on a Pixel 6a is different: Restoring image flashes nothing to the boot partition 🤔

@topjohnwu
Copy link
Owner

I might've used a device that's too old for testing. Let me try one with init_boot instead

@topjohnwu
Copy link
Owner

I believe the $SLOT variable is missing. In order to avoid any breakage down the line, let's just use the Java implementation for boot image detection

@osm0sis
Copy link
Collaborator Author

osm0sis commented Oct 8, 2024

How could $SLOT being missing result in flashing to boot instead of init_boot on an A/B init_boot device?

@topjohnwu
Copy link
Owner

Missing slot will cause find_boot_image to find an incorrect partition name, which will most likely be boot_a

@vvb2060
Copy link
Collaborator

vvb2060 commented Oct 8, 2024

1fbd053

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app This issue is related to Magisk App regression Something works in previous versions but not in the current one
Projects
None yet
Development

No branches or pull requests

10 participants