yashsingh1/xdaforums huggingface dataset:
[Google Pixel 6 Pro] badabing2003:
Ok I see few things that are not right.

1- SHA1 fe2023f503d1c341ee94cad0f9ac44dfb9c4785e read from the config file is wrong, it is the same value that is embedded in newly patched file.

The presence of ramdisk.cpio is elluding Magisk into thinking that you are trying to patch a patched boot.img

Loading cpio: [ramdisk.cpio]
- Magisk patched boot image detected
Loading cpio: [ramdisk.cpio]
Remove [.backup]
Remove [.backup/.magisk]
Remove [init]
Remove [overlay.d]
Remove [overlay.d/sbin]
Remove [overlay.d/sbin/magisk32.xz]
Remove [overlay.d/sbin/magisk64.xz]
Remove [.backup/.rmlist]
Dump cpio: [ramdisk.cpio]
- Patching ramdisk
Loading cpio: [ramdisk.cpio]
Add entry [init] (0750)
Create directory [overlay.d] (0750)
Create directory [overlay.d/sbin] (0750)
Add entry [overlay.d/sbin/magisk32.xz] (0644)
Add entry [overlay.d/sbin/magisk64.xz] (0644)
Patch with flag KEEPVERITY=[true] KEEPFORCEENCRYPT=[true]
Loading cpio: [ramdisk.cpio.orig]

I have to dig into Magisk's code to see which is causing which (the order of things)

But here are few things we could easily try to get more insight.

1- we rename ramdisk.cpio so that Magisk does not find it and we try to create a patch again.

This is the command to rename

db shell "su -c 'mv /data/adb/magisk/ramdisk.cpio /data/adb/magisk/ramdisk.cpio_bak'"

Even if this creates a good patch, don't flash it just yet, we want to gather enough info so that we can take preventative measures to correct this on the fly in PF.

Whether it generates a correct patch or not, please repeat the last request, ie get the files and run the commands.

I want to see the impact of the change.

If patching is successful, you might not find the magisk_patched_912e5dba.img under tmp, if that happens, you should find it under it's own directory 3cf89c92532a38cc285be46acfbbf82eb6fcde00

Based on these results, we might have to or not do the next thing which would be modifying the config file, but more on that later once we find out the results from the above.

Thanks
[Google Pixel 6 Pro] badabing2003:
@Caipi123

It would also greatly help if we get current boot_a and boot_b directly from the device.

adb shell "su -c 'dd if=/dev/block/bootdevice/by-name/boot_a of=/sdcard/Download/boot_a.img'"
adb shell "su -c 'dd if=/dev/block/bootdevice/by-name/boot_b of=/sdcard/Download/boot_b.img'"
adb pull /sdcard/Download/boot_a.img .
adb pull /sdcard/Download/boot_b.img .

You will end up having boot_a.img and boot_b.img in the current directory where you ran the adb command.

And this command will tell us the current slot (even though you can already see it in PF)

adb shell getprop ro.boot.slot_suffix

Please pass me those two boot files and tell me your current slot.

Thanks

I locally tested deleting ramdisk.cpio and the results are promising, Magisk detects stock image and create stock-boot.img
[Google Pixel 6 Pro] krystiano:
Hi , have a question,

(again im using PixelFlasher to update my pixel 6pro)

when im update i have to use : Flash to both slots option??

thank you for answer
[Google Pixel 6 Pro] Caipi123:
@badabing2003

Renaming ramdisk.cpio did the trick, now I'm able to patch boot.img. :)

raven:/data/adb/magisk # ls -l /storage/emulated/0/Download
total 176195
-rw-rw---- 1 u0_a218 media_rw 67108864 2022-10-09 12:40 boot_912e5dba.img
-rw-rw---- 1 u0_a218 media_rw 67108864 2022-10-09 12:42 magisk_patched_912e5dba.img

raven:/data/adb/magisk # cat $(magisk --path)/.magisk/config | grep SHA1 | cut -d \'=\' -f 2
fe2023f503d1c341ee94cad0f9ac44dfb9c4785e

raven:/data/adb/magisk # ls -d -1 /data/magisk_backup_*
/data/magisk_backup_1bb81a80bd3b05ea755d4abcb2904b2526c7d4ed
/data/magisk_backup_1f3a0c538da50a418db827c20a3b742fb0b61025
/data/magisk_backup_2144ad3655b2cf1eb7c97952332fc4803966f2eb
/data/magisk_backup_df8f63e60043c12ac0c80346195faa69d4484b1a
/data/magisk_backup_ead36404c2bce9dad5bffa9d31dfd6effb09250e
/data/magisk_backup_fe2023f503d1c341ee94cad0f9ac44dfb9c4785e

raven:/data/adb/magisk # ls -l /data/adb/magisk/
total 121087
-rwxr-xr-x 1 root root 3530 2022-08-16 00:57 addon.d.sh
-rwxr-xr-x 1 root root 5987 2022-08-16 00:57 boot_patch.sh
-rwxr-xr-x 1 root root 2107848 2022-08-16 00:57 busybox
drwxr-xr-x 2 root root 3452 2022-08-16 00:57 chromeos
-rwxr-xr-x 1 root root 51444224 2022-10-09 12:42 kernel
-rwxr-xr-x 1 root root 154452 2022-08-16 00:57 magisk32
-rwxr-xr-x 1 root root 247168 2022-08-16 00:57 magisk64
-rwxr-xr-x 1 root root 631848 2022-08-16 00:57 magiskboot
-rwxr-xr-x 1 root root 479592 2022-08-16 00:57 magiskinit
-rwxr-xr-x 1 root root 328240 2022-08-16 00:57 magiskpolicy
-rw-rw-rw- 1 root root 653956 2022-10-09 12:42 ramdisk.cpio
-rwxr-xr-x 1 root root 653956 2022-10-09 00:32 ramdisk.cpio.bak
-rw-r--r-- 1 root root 67108864 2022-10-09 12:42 stock_boot.img
-rwxr-xr-x 1 root root 23888 2022-08-16 00:57 util_functions.sh

edit: just noticed magisk(?) created new ramdisk.cpio automatically after renaming it. And now I'm able to patch boot.img with the newly generated ramdisk.cpio. Maybe the file was outdated?

% ./adb shell getprop ro.boot.slot_suffix
_a
[Google Pixel 6 Pro] badabing2003:
@Caipi123

Great.

Can you give me the newly patched file? I want to do a binary diff and see if it is only the SHA1 info different or we got a totally different patched file.

That will determine if it is a minor bug in Magisk, ie creates a valid patch but embeds the wrong sha1 or if it is a major one where it creates a patch from the wrong file.

After that, please start Magisk manager and the quit, few things should happen.

1- Magisk should make a backup of

-rw-r--r-- 1 root root 67108864 2022-10-09 12:42 stock_boot.img

2 And you should see

/data/magisk_backup_f08337616573c8499d8bc0581247eadd6267ef15

when you check the backups.

3- The stock_boot.img file will be deleted by Magisk

I'm very curious to know what will be in the config file after you do..

Thank you
[Google Pixel 6 Pro] badabing2003:
@Caipi123

Sorry I just realized you already have given me the newly patched file.

I'm saddened to state that it turns out to be the major bug, the patches are different.

It's a good thing PF aborted when it detected the case.

I'll wait for your response on the other points from the previous thread.

Thanks for all the troubleshooting assistance.
[Google Pixel 6 Pro] badabing2003:
Hi Krystiano,

I believe this should answer your question.
[Google Pixel 6 Pro] krystiano:
Perfect answer. Thank you
[Google Pixel 6 Pro] Caipi123:
Just to be sure, I patched the boot.img again (see the attachment).

After that I had a look at /data/adb/magisk and now there's no stock_boot.img:

raven:/ # ls -l /data/adb/magisk/
total 54843
-rwxr-xr-x 1 root root 3530 2022-08-16 00:57 addon.d.sh
-rwxr-xr-x 1 root root 5987 2022-08-16 00:57 boot_patch.sh
-rwxr-xr-x 1 root root 2107848 2022-08-16 00:57 busybox
drwxr-xr-x 2 root root 3452 2022-08-16 00:57 chromeos
-rwxr-xr-x 1 root root 51444224 2022-10-09 21:15 kernel
-rwxr-xr-x 1 root root 154452 2022-08-16 00:57 magisk32
-rwxr-xr-x 1 root root 247168 2022-08-16 00:57 magisk64
-rwxr-xr-x 1 root root 631848 2022-08-16 00:57 magiskboot
-rwxr-xr-x 1 root root 479592 2022-08-16 00:57 magiskinit
-rwxr-xr-x 1 root root 328240 2022-08-16 00:57 magiskpolicy
-rwxr-xr-x 1 root root 653956 2022-10-09 21:15 ramdisk.cpio
-rwxr-xr-x 1 root root 23888 2022-08-16 00:57 util_functions.sh

The stated backup is also not there.

raven:/ # ls -d -1 /data/magisk_backup_*
/data/magisk_backup_1bb81a80bd3b05ea755d4abcb2904b2526c7d4ed
/data/magisk_backup_1f3a0c538da50a418db827c20a3b742fb0b61025
/data/magisk_backup_2144ad3655b2cf1eb7c97952332fc4803966f2eb
/data/magisk_backup_912e5dba0da65a4404ee50899ef4d5192102275d
/data/magisk_backup_df8f63e60043c12ac0c80346195faa69d4484b1a
/data/magisk_backup_ead36404c2bce9dad5bffa9d31dfd6effb09250e
/data/magisk_backup_fe2023f503d1c341ee94cad0f9ac44dfb9c4785e

So what does that mean? Is it safe to patch boot.img and flash the latest A13 update for my device?
[Google Pixel 6 Pro] mko000:
If you still need it:
[Google Pixel 6 Pro] Caipi123:
For me, it now shows exactly the same SHA1-values. I'd assume flashing went fine with these files?
[Google Pixel 6 Pro] mko000:
Yeah, everything went great.
[Google Pixel 6 Pro] badabing2003:
I wish you'd have done what I asked here

https://xdaforums.com/t/pixelflasher-for-google-pixel-6-pro-support-thread.4419561/post-87547769

I don't know if you started and quit Magisk manager

and I don't know what was the effect of that on SHA1 in the config.
[Google Pixel 6 Pro] badabing2003:
Thank you, that matches with Caipi123's latest pacthing, which went fine, that much we know, but I was also trying to pinpoint exactly what was going wrong and what was the effect of the actions we took, so that we could avoid all this in the future.

For now, we still don't have a backup, and the stock-boot.img which was supposed to be backed up is gone.

@Caipi123 if you started and quit Magisk, please start it, that plays a role with the stock-boot.img

if you didn't, let me know also so that we can manually place stock-boot.img and then you start quit Magisk.

Starting / quitting Magisk triggers backup process, but that only can happen if there is a stock-boot.img file.

And more importantly we want to see the role of SHA1 in the config file.

1- Does that get updated after the backup?

2- Or does the backup check for that value and only backs up if it does not have one already for that value.
[Google Pixel 6 Pro] Caipi123:
Sorry, didn't mention it in my last post, but yes - I started / quit Magisk beforehand. stock-boot.img was already gone before starting Magisk.

I already did that aswell during the first troubleshooting steps, because I wanted to add an app to the deny list - didn't know it would have an impact regarding the troubleshooting :/
[Google Pixel 6 Pro] badabing2003:
OK thanks

I see that the correct backup is done,

/data/magisk_backup_912e5dba0da65a4404ee50899ef4d5192102275d

Probably because of starting / quitting Magisk, or Magisk doing its job periodically to run the migration script.

Can you please check the SHA1 from the config file, I expect / hope that it is updated to this value

912e5dba0da65a4404ee50899ef4d5192102275d

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

If it is, I'd say we're set, we know what is going on, you can proceed to flash your phone

If it is not set, then we still have one more puzzle to figure out, as to why it is not getting updated, but I'm really hoping that it is updated :)

Thanks for all your tests, this helps everyone.
[Google Pixel 6 Pro] Caipi123:
Glad I can help and thanks for yours :)

Sadly SHA1 is different :(

raven:/ # cat $(magisk --path)/.magisk/config | grep SHA1 | cut -d \'=\' -f 2
fe2023f503d1c341ee94cad0f9ac44dfb9c4785e
[Google Pixel 6 Pro] badabing2003:
Thanks for all your testing,

Yeah, I was hoping that it would be updated, which means that the next patch creation without deleting the ramdisk.cpio will have the same problem

I have code added to PF to update the config with the correct SHA1,

I'll report this in the github for Magisk and see what the devs say.

Thanks again.
[Google Pixel 6 Pro] Caipi123:
Thanks for taking care, hope it will be fixed soon.

Until then, flashing is nevertheless safe?
[Google Pixel 6 Pro] badabing2003:
Yes, you're safe, the generated patch file after deleting the ramdisk is good.

Can I ask one last things from you?

For me to be able to create a Magisk ticket, I need to provide a magisk.log file

Would you be kind enough to grab that from your device?

It is in /cache, you need to be root to access it.

The easiest way is to use a root file manager and copy it to /sdcard/Download

and then you can get it from there.

If you prefer doing it from command line

adb shell
su
cp /cache/magisk.log /storage/emulated/0/Download/
exit
exit

Then

adb pull /storage/emulated/0/Download/magisk.log

Thanks

UPDATE:

Kindly I would also need ramdisk.cpio.bak , the original one that was causing issues which we backed it up.

Thanks
[Google Pixel 6 Pro] Caipi123:
I'm sorry, I already had deleted the ramdisk file. But I attached the current one. If your theory is correct, the next update will cause issues again with this ramdisk file. Logs are included as well.
[Google Pixel 6 Pro] badabing2003:
Thanks

I fear the issue is with that specific ramdisk.cpio, the problem is not consistent, it is sporadic, and that file could have helped in reproducing the issue or shedding more light.

In any case many thanks, and if you encounter the issue again, please keep a copy, although with the next version of PF you will not encounter the issue.

Thanks
[Google Pixel 6 Pro] Caipi123:
Would habe been a good starting point for troubleshooting... if it happens again I'll keep a copy and let you know. Anyway, just flashed the latest update and everything went fine. Thank you very much for your tool, it made the whole process much easier :)
[Google Pixel 6 Pro] wgrant:
Are you upgrading to the 7 series? In either scenario, what do you think the likelihood is that this will work once a device is in hand?
[Google Pixel 6 Pro] badabing2003:
If the manual rooting process of Pixel 7 series is the same as Pixel 6, then PixelFlasher will work without needing any modification.

However if Google has broken rooting then we need to first be able to manually root, and then PF can easily adapt to those changes.

I suspect nothing will change and it would work out of box.

I'm saying this without having made any research of rooting Pixel 7, so take it with a grain of salt.
[Google Pixel 6 Pro] badabing2003:
Pre-Release:

Oct 13, 2022 v4.2.0 pre-release

Support for Pixel 7, 7p (init_boot extraction and patching / flashing).

Added Pixel 7 / 7p partitions flashing options to custom flash.

Improved patching process using boot_patch, add more patch file validations.

Check for Magisk backup and trigger Magisk to backup if missing.

Add more logging messages for troubleshooting.

Code optimization / improvements.

Bug Fix #28 Error when opening download link without a device selected.

Added set_version script to easily set the product version.

Print path of the selected boot to console, for easy copy / paste.
[Google Pixel 6 Pro] wgrant:
Fantastic! Appreciate the work.
[Google Pixel 6 Pro] badabing2003:
New Release:

Oct 15, 2022 v4.3.0 release

New: You can now download and install alpha and delta Magisk versions in addition to the official stable, beta, canary and debug versions.

Bug fix: Generating support.zip file was modifying the main db file unnecessarily.

Bug fix: When patching with Magisk Manager the version of Magisk Manager was not being displayed in the boot images table.

Bug fix: MacOS downloaded Magisk had space in the file path, which was causing failed installation.
[Google Pixel 6 Pro] badabing2003:
Oct 16, 2022 v4.3.0.1 release

Bug fix: #30 Error during firmware processing file extraction phase.

PixelFlasher-Linux is now labeled PixelFlasher-Ubuntu (It is built on Ubuntu which is not compatible with all Linux flavors. Even though PixelFlasher-Kali is more compatible, it is still not a one size fits all solution.)
[Google Pixel 6 Pro] rhetorician:
Received a replacement P6P in the mail today and updated Pixel Flasher on my Mac (been a few months): A few issues I experienced I thought I'd pass along:

after unlocking the bootloader and rebooting, Pixel Flasher quit responding and I had to force close.

PF did an awesome job installing Magisk and processing the boot image; however, it failed to flash the factory image.

It must have sat there for 15 minutes, unable to get past flashing the second partition

It wouldn't flash even the boot in a subsequent run. I just flashed it manually in fastboot

I neglected to pull a log before cleaning the app files in an attempt to reinstall. I apologize. I'm not asking for help, though, only wanted to pass along the info so you're aware in case of future reports.
[Google Pixel 6 Pro] badabing2003:
Sorry to hear about your troubles, and am happy to hear that you managed to fix things manually.

Good job.

In the future support.zip file would help greatly towards figuring out what might have went wrong.

Which help make the product better if I spot any issues in it.
[Google Pixel 6 Pro] Alekos:
Is this MacOS on an M1? If so, there's a known issue with platform-tools not working when manually flashing with cli image (which is what PF is doing). Lots of reports such as timeouts, errors etc. Sometimes it takes a few tries to flash the image.
[Google Pixel 6 Pro] badabing2003:
Thanks for the info,

Any workarounds?
[Google Pixel 6 Pro] Alekos:
So far it seems that it's a timeout issue. Multiple tries will eventually flash.

CalyxOS has a flasher to Flash their ROMs (it's just a script wrapped in an exe to make unlocking and flashing easier), and it's been an issue for the last few years.

I don't have an M1 to test it with unfortunately.
[Google Pixel 6 Pro] rhetorician:
I wonder if google's Flash Tool is open. If it is, that'd be the place to learn how they navigate these machines so well.
[Google Pixel 6 Pro] badabing2003:
When you say you just flashed it manually, can you please elaborate?

you opened a terminal and ran fastboot commads?

Or did you run the flash_all script?

Or perhaps flash-phone.sh script?

Can you also confirm if your Mac is M1 or not?
[Google Pixel 6 Pro] badabing2003:
New Release:

Oct 27, 2022 v4.3.1.0 release

Bug Fix: Magisk modules not listed on MacOS / Linux
[Google Pixel 6 Pro] badabing2003:
Yeah, you're good,

This message

ERROR: Something is wrong Magisk config has the wrong SHA1

Has to do with Magisk not updating the SHA1 in the config file, I put out the extra logging to detect these cases.

The patched image is good.
[Google Pixel 6 Pro] DRatJr:
Okay just wanted to check, thank you!
[Google Pixel 6 Pro] DRatJr:
All right and now that the image is patched, I select the patched image in the "select patched boot image" section, select keep user data, and then click flash correct?

And if I'm understanding correctly, once it boots up and stuff I will just need to re-enable any modules I disabled, but everything else will be the same (besides updates). Is that right?
[Google Pixel 6 Pro] Thebear j koss:
Yes. I don't even disable modules and haven't ran into any issues. If moving from android 12 to 13 be sure to flash to slot a and slot b to avoid bricking your phone.
[Google Pixel 6 Pro] banshee28:
So getting ready to flash my P6P to latest factory image to trade-in and send back in to Google. When using PF and click on the lock bootloader I get the typical warning. So does this get set after flashing and before booting? Meaning it will not start until after I setup the image to flash, options, etc and once it starts its just the very last step maybe?
[Google Pixel 6 Pro] badabing2003:
No it is not like that,

It will lock when you click ok.

Notice it is part of device buttons, meaning it applies to the device when you click it, just like the reboot button.

It is not part of flash options.

Just do all the flashing and at the end when done, lock the bootloader.
[Google Pixel 6 Pro] DRatJr:
Forgot to update after I did it. Everything went great thank you everyone!

I was curious if there's a way to use PF with OTAs or even beta fw to retain data and root?
[Google Pixel 6 Pro] badabing2003:
Thanks for the update.

You can download OTA and flash in custom mode using the sideload option if you really want to, it's supported.

But I don't see the advantage.

This option will just flash the OTA, it will not patch boot or flash patched boot.

As for beta, the process is the same when it comes rooting / keeping root.

Keeping data is a function of what Google expects with the beta.
[Google Pixel 6 Pro] banshee28:
That worked great! Thanks again. Its locked again and sitting at the Welcome to your Pixel Screen, just like I wanted! Getting ready to send back to G now!
[Google Pixel 6 Pro] Thebear j koss:
Updated perfectly again on November update with all magisk and substratum enabled and in tact. I have seen some issues with some users that have a lockscreen mod like easy pin unlock, that needed to disable that to unlock their phone.
[Google Pixel 6 Pro] badabing2003:
Thanks for the heads up, hopefully those mod users are seeing your post.
[Google Pixel 6 Pro] Thebear j koss:
I posted in the telegram group for the mod as well. I don't use it but figured better to tell people to disable it before updating where possible.
[Google Pixel 6 Pro] iwearthebelt:
Just wanted to send a quick Thank You for creating the Pixel Flasher program. It bailed me out after attempting to follow someone else's guide to install the November update on my Pixel 6 Pro. They caused me to lose root among other things and Pixel Flasher saved the day! I'll be using Pixel Flasher from here on in for ALL of my update and rooting needs. I can imagine just how much work it takes to write a program like that. Have you ever considered putting together a "PF Custom Recovery" seeing the developers over at Twrp haven't gotten around to our device? Just a thought, but I'm sure a lot of people would be grateful if you could pull it off.
[Google Pixel 6 Pro] badabing2003:
Thanks for the confidence.

Re: twrp @V0latyle summed it up best here.

Other than nandroid backup, I don't miss twrp.

Besides with all the smart people banging at it, I wouldn't stand a chance cracking it.
[Google Pixel 6 Pro] iwearthebelt:
You're welcome and he's more than likely correct about Twrp. I just started using a rooted device again for the first time in a while, since my Nexus 6p. The main reason I want a custom recovery is for creating a nandroid. Can you point me in the right direction as far as the best way to backup/restore a nandroid these days? Things have changed quite a bit in the last few years. Thanks again!
[Google Pixel 6 Pro] badabing2003:
I think most people these days are using Swift backup, I still use Titanium Backup Pro and MyBackup Pro

I've got to try Swift, I hear it is good.

People say the ones I use are old and have issues on newer OS-es, I haven't run into any issues (yet), then again I did not follow rule 101 of backup.

Test your backup and see if restore works and is complete.
[Google Pixel 6 Pro] iwearthebelt:
Yeah I have Swift Backup, the app isn't capable of creating a full nandroid. It's more like an updated version of Titanium Backup. It works great for what it is designed to do, definitely recommend it, but I'm looking for something like Twrp or CWM where I can create a full nandroid to restore in case I make an error and soft brick my device so I can just flash a backup and return to where I was at. If you ever hear of something like that, please let me know. Thanks.
[Google Pixel 6 Pro] Thebear j koss:
Are you using a pixel? Newer devices have a/b partitions negating androids. You should be backed up to Google and you can boot into working slot and install backup from google. The a/b partioning makes it nearly impossible for custom recovery and restoring nandroids and backups.
[Google Pixel 6 Pro] V0latyle:
I believe it is possible to dump partitions via ADB with root.
[Google Pixel 6 Pro] Thebear j koss:
Probably. But you should always have 1 working partition if you boot loop or mess up. Plus we can boot into safe mode disabling all mods.