quickemu-project / quickemu

Quickly create and run optimised Windows, macOS and Linux virtual machines
MIT License
10.77k stars 472 forks source link

MacOS Sonoma - after install, boot requires user intervention #1259

Closed ant9000 closed 5 months ago

ant9000 commented 5 months ago

At boot, I'm presented with the following options:

macos-sonoma

If no input is received, after a while the bootloader starts the first partition (the one labeled EFI) and then boot stops at a black screen. This is not a problem if the VM is used interactively - but rules out a headless VM.

Inside MacOS, I have changed the startup disk to the system partition (in the screenshot above, simply named "Disk"): unfortunately, my choice is ignored by the bootloader.

Could this be an issue with regards to NVRAM emulation? Maybe just disabled write support?

Attached is my quickreport.txt log.

Thanks for any pointer - and for the brilliant job!

Antonio

ant9000 commented 5 months ago

I tested with nvram command: any variable I save into NVRAM does not persist across reboots - this explains why the startup disk selection does not stick.

ant9000 commented 5 months ago

I had to learn my way about OpenCore, but eventually found how to accomplish my goal - i.e. starting the OS with no user intervention.

In a terminal, mount the EFI partition corresponding to OpenCore:

sudo -i
efi_part=/dev/$(diskutil list | grep EFI | grep -v disk0 | awk '{ print $6 }')
diskutil mount $efi_part

Edit the OpenCore configuration file /Volumes/EFI/EFI/OC/config.plist, and change ScanPolicy value from 0 to 769, which corresponds to

OC_SCAN_FILE_SYSTEM_LOCK
OC_SCAN_ALLOW_FS_APFS
OC_SCAN_ALLOW_FS_HFS

(see here for an online calculator).

You might also want to hide non relevant partitions, setting HideAuxiliary to true (pressing will make everything visibile again).

You can now unmount the partition and reboot:

diskutil umount $efi_part
reboot
ant9000 commented 5 months ago

For the record: the above customization does not need to be done from inside MacOS - could be performed on the Linux host too. The commands for mounting the OpenCore partition are:

cd macos-sonoma
mkdir mnt
guestmount -a OpenCore.qcow2 -m /dev/sda1 mnt

then you edit the mnt/EFI/OC/config.plist as above. To unmount:

guestunmount mnt
rmdir mnt