dakanji / RefindPlus

A Boot Manager for Mac and PC
GNU General Public License v3.0
320 stars 68 forks source link

Soft Blessing is unreliable when re-applying to same ESP #128

Closed MaplesThroughWindows closed 1 year ago

MaplesThroughWindows commented 1 year ago

RefindPlus Version

v0.13.3.AB Release

Device Type

Apple Mac

Problem Description

Applying a Soft Bless to an ESP is unreliable after the first time the ESP is Soft Blessed and used for a successful boot to RefindPlus.

Environment

Reproducing

1) Prepare destination boot USB flash drive by erasing as GUID scheme, HFS+ filesystem. 2) Run ConfigFactory and build your config. 3) Run DeployConfig and point it at your destination boot USB flash drive. 4) Run BootBlesser through DeployConfig and choose to Soft Bless the ESP of the destination boot USB flash drive. 5) Reboot.

At this stage, RefindPlus should boot successfully.

22v19r4932 - Success.log

6) Choose the bootable macOS installation from RefindPlus. 7) After booting, run BootBlesser and choose to Soft Bless your destination USB flash drive once again. 8) Reboot.

At this stage, RefindPlus will not boot, and the cMP will boot directly to the login window of the bootable macOS installation, contrary to expectations.

No log was produced for this event because RefindPlus did not boot.

9) Repeat steps 7) and 8)

At this stage, RefindPlus should boot successfully.

22v19r5642 - Success.log

10) Repeat steps 6)-8)

At this stage, RefindPlus will not boot, and the cMP will boot directly to the login window of the bootable macOS installation, contrary to expectations.

11) Repeat steps 7) and 8)

At this stage, RefindPlus will boot successfully; BUT:

12) Choose the bootable macOS installation from RefindPlus

The Apple Logo will appear, but the progress bar will not appear and the boot does not proceed any further.

22v19s0105 - Hang at Apple Logo.log

13) Force a shutdown 14) Boot the cMP

At this stage, RefindPlus will not boot, and the cMP will boot directly to the login window of the bootable macOS installation. This is as expected.

Repeat steps 7) and 8)

At this stage, RefindPlus will boot successfully; BUT:

15) Choose the bootable macOS installation from RefindPlus

The Apple Logo will appear, but the progress bar will not appear and the boot does not proceed any further.

22v19s0602 - Hang at Apple Logo.log

At this point I consider the RefindPlus installation on the ESP of my bootable flash drive to be corrupted beyond use. If I return to step 1) the progression repeats itself through the remaining steps.

Other Information

My only thought is that somehow RefindPlus is corrupting itself over time. I notice that RefindPlus remembered my last selected option on occasions when it booted successfully, so clearly it is modifying itself to some degree by design. Perhaps it is also doing something that it was not designed to do?

Problem Point

RefindPlus fails to load

Affected Items

All OS Loaders (First Row Items)

Debug Log

These are duplicates of the in-line logs:

22v19r4932 - Success.log 22v19r5642 - Success.log 22v19s0105 - Hang at Apple Logo.log 22v19s0602 - Hang at Apple Logo.log

Additional Context

No response

dakanji commented 1 year ago

Try with focus_nvram_fix activated

dakanji commented 1 year ago

On this:

My only thought is that somehow RefindPlus is corrupting itself over time.

RefindPlus is a compiled binary and cannot change itself at runtime. What is likely changed is the environment it is running in. That is, the repeated soft bless cycles might have put the Mac in a certain state. The Mac probably needs some sort of reset between such. Lets see what focus_nvram_fix does first and I will look into adding a boot disk reset to MyBootMgr afterwards.

The previous boot item preselection is a configuration option. See transient_boot in the config file.

MaplesThroughWindows commented 1 year ago

RefindPlus is a compiled binary and cannot change itself at runtime.

I didn't mean literally changing itself, but perhaps some of the associated files it relies on such as the config.conf.

the repeated soft bless cycles might have put the Mac in a certain state.

In your guide on MacRumors, under Part 3 - Complete Setup you write:

Try a few reboots after soft blessing each time to make sure all is working as expected.

Can I assume that the steps I took and detailed in the Reproducing section above are essentially what you had in mind here?

Try with focus_nvram_fix activated

I think this has fixed the problem. I tried this with a freshly prepared flash drive and the same ConfigFactory settings as before. I have now applied Soft Bless three times in a row on the same ESP with focus_nvram_fix uncommented and the RefindPlus boot picker has been displayed each time. On each occasion I successfully booted through to the login window from RefindPlus. On the third occasion I had also uncommented the 'transient_boot' item.

I will keep using Soft Bless with these settings for the moment and will report any further problems if they arise.

dakanji commented 1 year ago

I think this has fixed the problem.

Can you confirm that this not only apparently fixed the hang and that RefindPlus also shows up after successively soft blessing?

Can you also revert focus_nvram_fix to how it was and try with the REL build? Use SwtichRunMode for this. Basically want to see whether the issue only affects the DBG file as seems to be possible. You can leave transient_boot however you prefer.

Thanks

github-actions[bot] commented 1 year ago

This item has been flagged for closure due to a lack of response.

MaplesThroughWindows commented 1 year ago

I did the testing in stages.

First I switched the run mode to REL mode as you asked. I left focus_nvram_fix enabled (uncommented) and then rebooted. This boot was successful: RefindPlus was displayed and I booted into macOS High Sierra from there. This was all from the same USB flash drive as before, continually Soft Blessed, so this makes the fifth successive successful boot, with no failed boots so far.

(I think the boot to RefindPlus was actually a little faster on this occasion, which I imagine makes sense if debugging is disabled.)

Then I disabled (commented out) focus_nvram_fix, bestowed a Soft Bless on the ESP and rebooted.

RefindPlus was displayed, but ONE of my macOS volumes was not offered. A little background is probably helpful here:

I cloned the contents of the macOS Mojave install on the NVMe SSD to a new volume on the same SSD as macOS High Sierra. The aim was to move the Mojave installation away from the drive that contains the strange Basic Data Partition. This plan was actually successful, and RefindPlus has been presenting this macOS Mojave install for booting (though still, as expected, not the one on the NVMe SSD).

So, specifically the successful DEBUG reboots all presented both the macOS High Sierra install and the new Mojave clone, and the REL-based reboot with focus_nvram_fix enabled (uncommented) presented them both as well.

However, on this last occasion the macOS Mojave install was not offered by RefindPlus, only the High Sierra install was. Refreshing the boot picker did not resolve this. The macOS High Sierra install booted successfully from the boot picker. I Soft Blessed the ESP again without making any other changes and rebooted, and this time the Mac booted straight to the macOS High Sierra login window - RefindPlus wasn't loaded at all. To clarify, this is REL enabled, focus_nvram_fix disabled (commented out).

I re-enabled focus_nvram_fix, soft-blessed the ESP and rebooted. RefindPlus was displayed, and both macOS installs were displayed. I booted into macOS High Sierra successfully from there.

I'll be sticking with the REL build and focus_nvram_fix enabled for the moment because it seems to be working well. If you need me to do any more troubleshooting that shouldn't be an issue.

dakanji commented 1 year ago

Thanks.

Please run diskutil list in Terminal and share the output.

MaplesThroughWindows commented 1 year ago
/dev/disk0 (external):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         500.1 GB   disk0
   1:         Microsoft Reserved                         16.8 MB    disk0s1
   2:       Microsoft Basic Data WD NVMe                 500.1 GB   disk0s2

/dev/disk1 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *500.1 GB   disk1
   1:               Windows_NTFS System Reserved         52.4 MB    disk1s1
   2:               Windows_NTFS BOOTCAMP                119.4 GB   disk1s2
   3:                       0x27                         537.9 MB   disk1s3

/dev/disk2 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *250.1 GB   disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:                 Apple_APFS Container disk4         124.9 GB   disk2s2
   3:                 Apple_APFS Container disk5         124.9 GB   disk2s3

/dev/disk3 (external):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         512.1 GB   disk3
   1:                        EFI EFI                     209.7 MB   disk3s1
   2:                 Apple_APFS Container disk6         511.9 GB   disk3s2

/dev/disk4 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +124.9 GB   disk4
                                 Physical Store disk2s2
   1:                APFS Volume cMP macOS HS SSD        11.3 GB    disk4s1
   2:                APFS Volume Preboot                 22.6 MB    disk4s2
   3:                APFS Volume Recovery                516.2 MB   disk4s3
   4:                APFS Volume VM                      20.5 KB    disk4s4

/dev/disk5 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +124.9 GB   disk5
                                 Physical Store disk2s3
   1:                APFS Volume cMP macOS Mojave SSD    37.9 GB    disk5s1
   2:                APFS Volume Preboot                 24.2 MB    disk5s2
   3:                APFS Volume Recovery                513.5 MB   disk5s3
   4:                APFS Volume VM                      20.5 KB    disk5s4

/dev/disk6 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +511.9 GB   disk6
                                 Physical Store disk3s2
   1:                APFS Volume cMP macOS Mojave NVMe   37.5 GB    disk6s1
   2:                APFS Volume Preboot                 24.2 MB    disk6s2
   3:                APFS Volume Recovery                507.4 MB   disk6s3
   4:                APFS Volume VM                      1.1 GB     disk6s4

/dev/disk7 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *30.8 GB    disk7
   1:                        EFI EFI                     209.7 MB   disk7s1
   2:                  Apple_HFS CoreOpen                30.4 GB    disk7s2

/dev/disk5s1 and /dev/disk4s1 are the macOS installs that are presented in the RefindPlus boot picker. /dev/disk5s1 is the macOS install that I'm referring to as not being presented, in the fifth paragraph in my previous post. /dev/disk6s1 is the macOS install that has never been presented.

Quick question: if I wanted to use disk0 as the permanent home for RefindPlus, would it just be a case of manually creating an ESP on that device?

dakanji commented 1 year ago

Thanks.

Let's leave things there. Will change focus_nvram_fix to be an Opt-Out option (enabled by default) in the next version and tweak one or two other things.

As for where you want to host things, you should be able to do so wherever you prefer. If there is an actual ESP present, the MyBootMgr apps will detect such. You can create an equivalent in Windows and manually handle stuff if that's what you prefer.

github-actions[bot] commented 1 year ago

This thread is being locked. Please use the Discussions feature for further related discussion or raise a new issue if appropriate.