acidanthera / bugtracker

Acidanthera Bugtracker
374 stars 42 forks source link

Launchd.command launch daemon does not save NVRAM in Sonoma #2381

Closed mikebeaton closed 4 months ago

mikebeaton commented 4 months ago

Utilities/LogoutHook/Launchd.command installed as launch daemon no longer saves NVRAM in Sonoma. This means it no longer supports unsupervised OS updates (i.e. correct selection of installer/OS partition over reboots, during unsupervised update). Everything still works correctly in Ventura and below. This is not caused by the recent minor change to the script, but rather by changes in macOS as compared to Ventura and below.

In Sonoma, if the ESP is auto-mounted (e.g. due to no ESP flag set; i.e. non-standard/dev setup only) then, with additional logging, we can see Input/output error on attempting to access mounted partitions, and anyway we see (misleading):

mkdir: /Volumes/OPENCORE/NVRAM: File exists
Tue, 13 Feb 2024 08:24:23 +0000 (Daemon) Fatal error: Failed to make directory /Volumes/OPENCORE/NVRAM

If ESP is not auto-mounted (e.g. because ESP flag is set for the partition, as it normally should be) we see:

Executing: /usr/bin/kmutil load -p /System/Library/Extensions/msdosfs.kext
Error Domain=KMErrorDomain Code=71 "Kernel request failed: (libkern/kext) not privileged (-603947004)" UserInfo={NSLocalizedDescription=Kernel request failed: (libkern/kext) not privileged (-603947004)}
Daemon is not reachable - operating in standalone mode. Only kexts contained in the boot kernel collection will be loadable.
mount_msdos: msdos filesystem is not available
mount: /Volumes/4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:boot-node failed with 71
Tue, 13 Feb 2024 08:29:22 +0000 (Daemon) Fatal error: Failed to mount!

Either way, the NVRAM can't be saved.

~./Launchd.command install logout can still be used to install the script in legacy logout hook mode, and this works to save any user NVRAM changes; but as before, and the reason launch daemon support was added, in current macOS the logout hook occurs too early to record the NVRAM changes made by macOS as part of an update.~ Spoke too soon, unfortunately I believe this doesn't work either.

mikebeaton commented 4 months ago

Fixed by https://github.com/acidanthera/OpenCorePkg/commit/5132427afc853e2db68b38237b599b8dbd0250a6