topjohnwu / Magisk

The Magic Mask for Android
GNU General Public License v3.0
48.51k stars 12.4k forks source link

Android 12 failed to load/verify boot images #4343

Closed jihoy79 closed 2 years ago

jihoy79 commented 3 years ago

When I try to flash magisk patched img on my pixel 4a 5g device with the code below,

"fastboot flash boot magisk_patched.img && fastboot reboot"

device shows an error "failed to load/verify boot images" and unable to boot

Device: Google Pixel 4a 5g Android version: 12 (developer beta 3) Magisk version name: 6b34ec3 Magisk version code: 22105

osm0sis commented 3 years ago

You probably have to disable verify via fastboot, that should be added to the Magisk install directions probably...

pndwal commented 3 years ago

You probably have to disable verify via fastboot, that should be added to the Magisk install directions probably...

Please could you state proper command? πŸ‘

Edit: Sorry, knew this isn't a help Forum. I shoulda known better...

osm0sis commented 3 years ago

No offense, but, Google it? That's what I'd have to do.

jihoy79 commented 3 years ago

I already tried

"fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img"

But it didn't work

osm0sis commented 3 years ago

I already tried

"fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img"

But it didn't work

You tried flashing a dump of your current Android 12 vbmeta back to the device with that command?

jihoy79 commented 3 years ago

Yeah, I tried to flash dump vbmeta image

osm0sis commented 3 years ago

Ah damn well that was my only idea. Luckily you're on a Pixel so I'm sure it's something @topjohnwu will look into. πŸ‘

Didgeridoohan commented 3 years ago

@jihoy79 Are you using the latest platform tools?

jihoy79 commented 3 years ago

@jihoy79 Are you using the latest platform tools?

Yeah, I used

platform-tools_r31.0.1-windows -> downloaded from "https://developer.android.com/studio/releases/platform-tools"

I guess it's the latest version

Didgeridoohan commented 3 years ago

r31.0.2 is the latest...

jihoy79 commented 3 years ago

r31.0.2 is the latest...

Oh! Will try with the r31.0.2 version!

jihoy79 commented 3 years ago

r31.0.2 is the latest...

tried with r31.0.2 version... still doesn't work

Didgeridoohan commented 3 years ago

Worth a shot... With the developer previews it's not unheard of that you need to be on the absolutely latest platform tools.

Nemisor commented 3 years ago

Can confirm, still an issue on Pixel 5 as well, have tested every canary update since DP1.

jerry5168 commented 3 years ago

GET /accounts/12345 HTTP/1.1 Host: bank.example.com Accept: application/vnd.acme.account+json

Mspy1 commented 3 years ago

Ah damn well that was my only idea. Luckily you're on a Pixel so I'm sure it's something @topjohnwu will look into. πŸ‘

This aged well.

osm0sis commented 3 years ago

Yes, it has, check your sources.

Nemisor commented 3 years ago

As of PB1, if you use the flash tool method through a browser and disable verity during that process, you can successfully root Pixel 5 with the current canary build.

I'm unaware of what else this might break, and installing modules risks failure to boot, but root apps are working fine.

jihoy79 commented 3 years ago

As of PB1, if you use the flash tool method through a browser and disable verity during that process, you can successfully root Pixel 5 with the current canary build.

I'm unaware of what else this might break, and installing modules risks failure to boot, but root apps are working fine.

Yeah.. This method worked for me as well.

However, that method requires factory reset everytime when you update the device.

Nemisor commented 3 years ago

As of PB1, if you use the flash tool method through a browser and disable verity during that process, you can successfully root Pixel 5 with the current canary build. I'm unaware of what else this might break, and installing modules risks failure to boot, but root apps are working fine.

Yeah.. This method worked for me as well.

However, that method requires factory reset everytime when you update the device.

Knew there would be some trade off, that's definitely unacceptable in the long run.

bczsalba commented 3 years ago

As of PB1, if you use the flash tool method through a browser and disable verity during that process, you can successfully root Pixel 5 with the current canary build.

I'm unaware of what else this might break, and installing modules risks failure to boot, but root apps are working fine.

Which browser flash tool does it work with? Google's own doesn't support custom images, and kdrag0n's fastboot.js doesn't see my device.

kafisc1 commented 3 years ago

You can use a factory image and SDK Platform Tools. Image Android 12 Beta 1: https://developer.android.com/about/versions/12/download Platform Tools: https://developer.android.com/studio/releases/platform-tools

Just edit 2 lines in the flash-all.bat to match this and you are good to go. Here's an example for a Pixel 5 image. This will wipe your device:

fastboot -w update image-redfin-spb1.210331.013.zip --skip-reboot fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img Note: You may will be asked to wipe the device again.

bczsalba commented 3 years ago

@kafisc1 Does flashing vbmeta wipe the phone? I already have the version in the first command, and my bootloader is unlocked.

bczsalba commented 3 years ago

You can use a factory image and SDK Platform Tools. Image Android 12 Beta 1: https://developer.android.com/about/versions/12/download Platform Tools: https://developer.android.com/studio/releases/platform-tools

Just edit 2 lines in the flash-all.bat to match this and you are good to go. Here's an example for a Pixel 5 image. This will wipe your device:

fastboot -w update image-redfin-spb1.210331.013.zip --skip-reboot fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img Note: You may will be asked to wipe the device again.

Well, trying to flash vbmeta without wiping first gives FAILED (remote: No such file or directory), so that's out of the game.

Nemisor commented 3 years ago

As of PB1, if you use the flash tool method through a browser and disable verity during that process, you can successfully root Pixel 5 with the current canary build. I'm unaware of what else this might break, and installing modules risks failure to boot, but root apps are working fine.

Which browser flash tool does it work with? Google's own doesn't support custom images, and kdrag0n's fastboot.js doesn't see my device.

I don't use custom images, so the google one worked fine. Unrelated question though: what happens if you disable only verity instead of verification? Or do we need to do both? I'm unfamiliar with the difference between the two.

bczsalba commented 3 years ago

As of PB1, if you use the flash tool method through a browser and disable verity during that process, you can successfully root Pixel 5 with the current canary build. I'm unaware of what else this might break, and installing modules risks failure to boot, but root apps are working fine.

Which browser flash tool does it work with? Google's own doesn't support custom images, and kdrag0n's fastboot.js doesn't see my device.

I don't use custom images, so the google one worked fine. Unrelated question though: what happens if you disable only verity instead of verification? Or do we need to do both? I'm unfamiliar with the difference between the two.

Does flashing from there and disabling verity and verification wipe the phone?

About your question, I've only seen the two mentioned together, so not quite sure either.

Nemisor commented 3 years ago

You can uncheck wipe, but it will insist on it if you attempt to force flash all partitions, I'm not sure about just disabling verity/verification though. I had to wipe after the initial attempt when it boot-looped.

AmyTheBuildBot commented 3 years ago

Same here (Pixel 4a 5G) with the Android 12 Beta.

Nemisor commented 3 years ago

Good news! Not only is the public beta 2 compatible with magisk on a pixel 5, but using the flash tool with verity and verification disabled does not require a subsequent wipe.

HZY040122 commented 3 years ago

Good news! Not only is the public beta 2 compatible with magisk on a pixel 5, but using the flash tool with verity and verification disabled does not require a subsequent wipe.

My pixel 4a 5g still not working.When i enter "fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img" after flash magisk_patched boot, it will restart again again again and ask me to wipe.So I can only enter "fastboot boot" to enable magisk temporary.It will fail if I restart.

bczsalba commented 3 years ago

Good news! Not only is the public beta 2 compatible with magisk on a pixel 5, but using the flash tool with verity and verification disabled does not require a subsequent wipe.

My pixel 4a 5g still not working.When i enter "fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img" after flash magisk_patched boot, it will restart again again again and ask me to wipe.So I can only enter "fastboot boot" to enable magisk temporary.It will fail if I restart.

Disabling verity & verification through the fastboot CLI fails for me, stating No such file or directory on the remote end. Trying the flash tool now.

Edit: Cannot load android system. Your data may be corrupt. :) Edit2: Re-flashing with the same tool & all boxes unchecked brought the system back with no data loss.

Good news! Not only is the public beta 2 compatible with magisk on a pixel 5, but using the flash tool with verity and verification disabled does not require a subsequent wipe.

What did you do exactly to make it work? It's failing in multiple ways on my P5.

aliantonio commented 3 years ago

Good news! Not only is the public beta 2 compatible with magisk on a pixel 5, but using the flash tool with verity and verification disabled does not require a subsequent wipe.

Hi. How did you flash patched boot when the factory images haven't been posted yet? Is there another method to do this?

ruvaldak commented 3 years ago

Good news! Not only is the public beta 2 compatible with magisk on a pixel 5, but using the flash tool with verity and verification disabled does not require a subsequent wipe.

Hi. How did you flash patched boot when the factory images haven't been posted yet? Is there another method to do this?

Factory image can be downloaded from Google as soon as the update is released. Just unpack the zip, the boot img is inside that.

aliantonio commented 3 years ago

Good news! Not only is the public beta 2 compatible with magisk on a pixel 5, but using the flash tool with verity and verification disabled does not require a subsequent wipe.

Hi. How did you flash patched boot when the factory images haven't been posted yet? Is there another method to do this?

Factory image can be downloaded from Google as soon as the update is released. Just unpack the zip, the boot img is inside that.

Hi, thanks for the reply! I know that much, however the beta 2 factory images have not been posted yet (as of June 11), so I was just wondering how OP was able to achieve root without the beta 2 boot image.

bczsalba commented 3 years ago

Good news! Not only is the public beta 2 compatible with magisk on a pixel 5, but using the flash tool with verity and verification disabled does not require a subsequent wipe.

Hi. How did you flash patched boot when the factory images haven't been posted yet? Is there another method to do this?

Factory image can be downloaded from Google as soon as the update is released. Just unpack the zip, the boot img is inside that.

Hi, thanks for the reply! I know that much, however the beta 2 factory images have not been posted yet (as of June 11), so I was just wondering how OP was able to achieve root without the beta 2 boot image.

They are available here.

aliantonio commented 3 years ago

Good news! Not only is the public beta 2 compatible with magisk on a pixel 5, but using the flash tool with verity and verification disabled does not require a subsequent wipe.

Hi. How did you flash patched boot when the factory images haven't been posted yet? Is there another method to do this?

Factory image can be downloaded from Google as soon as the update is released. Just unpack the zip, the boot img is inside that.

Hi, thanks for the reply! I know that much, however the beta 2 factory images have not been posted yet (as of June 11), so I was just wondering how OP was able to achieve root without the beta 2 boot image.

They are available here.

I've been checking there but I saw the file name was "210513" so I assumed they were last month's factory images (beta 1). That's my mistake if I assumed incorrectly. Thanks!

itismo commented 3 years ago

Good news! Not only is the public beta 2 compatible with magisk on a pixel 5, but using the flash tool with verity and verification disabled does not require a subsequent wipe.

Hi Nemisor, When you say does not require a subsequent wipe, that still means that a wipe is needed initially when disabling verification for the first time right? So there is still no way to flash Android 12 on a pixel without wipe, correct?

AIMATO commented 3 years ago

so...still need to wipe?

itismo commented 3 years ago

so...still need to wipe?

Think so, I am wondering if this carries over to final version? Will it still require boot image verification or it's just for beta?

Nemisor commented 3 years ago

Sorry, haven't been getting notifications for replies to this... I mean that after the initial wipe (and yes, to initially disable verification/verity it does require a wipe) it does not require subsequent wipes while flashing a new build. So as long as you are leaving verification/verity settings alone, you can update to the newer build without wiping again. And yes, you can only get the boot images using the zips found under the "get andriod 12" page, not from the nexus factory image page. Also, be very careful to launch the flash tool from the links on that get android 12 page, or you may end up flashing something incompatible.

pndwal commented 3 years ago

Just a thought here:

Since Android 9 introduced boot image header version fields and required version 1, Android 10 required version 2, and 11 generally uses version 3. https://source.android.com/devices/bootloader/boot-image-header

It seems to me that it would follow Android 11 would introduce version 4 at some point, even if version 3 images are usable in some cases, and I don't know what boot image header versions are used for Android 12 developer betas.

However it seems John never implemented proper version 4 support in his builds, which may be a problem.

More recently, @vvb2060 has implemented these fixes:

And other commits merged in his Alpha Magisk build may help. Could be worth trying Alpha: Post in thread 'Magisk General Support / Discussion' https://forum.xda-developers.com/t/magisk-general-support-discussion.3432382/post-85226785

Hope it helps. PW

pndwal commented 3 years ago

I already unpacked it in AIK and showed it's a hdr_v2 image, so it's clearly not "encrypted" or anything, and hdr_v4 has nothing to do with it. πŸ˜‰πŸ™‚

Thanks for insight Chris. Just thought it may help some.

Not sure where the comment went... PW

osm0sis commented 3 years ago

I already unpacked it in AIK and showed it's a hdr_v2 image, so it's clearly not "encrypted" or anything, and hdr_v4 has nothing to do with it. πŸ˜‰πŸ™‚

Thanks for insight Chris. Just thought it may help some.

Not sure where the comment went... PW

Wrong thread. 😜

That said, older devices don't get retrofitted to the new boot img headers, even from Google, so existing Pixels are on hdr_v3 and will stay that way. Pixel 6 on the other hand.. πŸ™‚

pndwal commented 3 years ago

Wrong thread. 😜

Haha, just guessed it might have been!

That said, older devices don't get retrofitted to the new boot img headers, even from Google, so existing Pixels are on hdr_v3 and will stay that way.

Ah, thanks... Still Alpha may be worth a shot for the mavericks, but it might stall the diagnosis... 😢

Pixel 6 on the other hand..

What, where? πŸ˜›

itismo commented 3 years ago

Just a thought here:

Since Android 9 introduced boot image header version fields and required version 1, Android 10 required version 2, and 11 generally uses version 3. https://source.android.com/devices/bootloader/boot-image-header

It seems to me that it would follow Android 11 would introduce version 4 at some point, even if version 3 images are usable in some cases, and I don't know what boot image header versions are used for Android 12 developer betas.

However it seems John never implemented proper version 4 support in his builds, which may be a problem.

More recently, @vvb2060 has implemented these fixes:

And other commits merged in his Alpha Magisk build may help. Could be worth trying Alpha: Post in thread 'Magisk General Support / Discussion' https://forum.xda-developers.com/t/magisk-general-support-discussion.3432382/post-85226785

Hope it helps. PW

How do I install that? Do i put a custom URL in magisk?

EDIT : please disregard my previous question, Pixel 5 here, I got it from the telegram channel and tried to patch boot.img from the 12 Beta 2.1 and still failed to load/verify boot image :(

pndwal commented 3 years ago

Pixel 5 here, I got it from the telegram channel and tried to patch boot.img from the 12 Beta 2.1 and still failed to load/verify boot image :(

Well that's out then... Sorry, but thanks! πŸ˜• PW

AIMATO commented 3 years ago

[bad English] good news for me or not just me, I have I have successfully root my pixel 5

platform tool not work for me, it cause error FAILED (remote: No such file or directory)

use [Android Flash Tool] flash no Verity, no Verification factory img (if failed, you may need to change a normal cable, because my Type-C to Type-C unable to flash my device)

Then flash boot Magisk

reference https://forum.xda-developers.com/t/guide-flash-magisk-on-android-12.4242959/

image

edit:you dont need to full wipe after update because root only change boot img not the systemπŸ˜…

jihoy79 commented 3 years ago

[bad English] good news for me or not just me, I have I have successfully root my pixel 5

platform tool not work for me, it cause error FAILED (remote: No such file or directory)

use [Android Flash Tool] flash no Verity, no Verification factory img (if failed, you may need to change a normal cable, because my Type-C to Type-C unable to flash my device)

Then flash boot Magisk

reference https://forum.xda-developers.com/t/guide-flash-magisk-on-android-12.4242959/

image

This method works.

However, that method requires factory reset (full wipe) everytime when you update the device.

AmyTheBuildBot commented 3 years ago

We already know this...

On Mon, 5 Jul 2021, 12:48 jihoy79, @.***> wrote:

[bad English] good news for me or not just me, I have I have successfully root my pixel 5

platform tool not work for me, it cause error FAILED (remote: No such file or directory)

use [Android Flash Tool] flash no Verity, no Verification factory img (if failed, you may need to change a normal cable, because my Type-C to Type-C unable to flash my device)

Then flash boot Magisk

reference

https://forum.xda-developers.com/t/guide-flash-magisk-on-android-12.4242959/

[image: image] https://user-images.githubusercontent.com/51057953/124458071-2558ca00-ddbf-11eb-8f1f-e60cfbee7a42.png

This method works.

However, that method requires factory reset everytime when you update the device.

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/topjohnwu/Magisk/issues/4343#issuecomment-874013059, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATGC6O6K37D2FYQM6DBTOMLTWGEWXANCNFSM44VW5SHA .

leifalbor commented 3 years ago

Well my dumb ass just fastboot flashed PB3 over PB2 and completely forgot about the verify boot images change and got "failed to load/verify boot images" after I flashed my magisk patched boot image.

Being the genius that I am, I tried "fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img" method, using vbmeta.img from the PB3 image zip and am now getting Android Recovery telling my system is corrupt.

Things I've tried since then:

Still won't boot.

Any one have any other ideas on how to get this thing booting again without data loss?


EDIT: Got it booting through a repairing/wiping cache partitions in TWRP. Still looking for a method to re-root without data loss though