bacongravy/macinbox

virtualbox: Mojave box does not boot on 2020 Macbook

frankosterfeld opened this issue · 6 comments

So far I've created Catalina VMs on a Catalina host, and everything works fine. Now I tried to create a Mojave box inside a Mojave VM (manually installed, VMWare Fusion). The VM creation seems to work fine, but when importing the box on the Catalina host and trying run it, it hangs at boot. The last output is

...
Start InitBootStruct

root device uuid is '396DAA8C-A9B4-4762-98A7-B334C047EACB`
EndInitBootStruct
Start LoadRAMDisk
End LoadRAMDisk
Start FinalizeBootStruct
Start RandomSeed
End RandomSeed

I've created the box as follows:

Downloaded the Mojave installer manually via the "GET" link in the app store page (that's 10.14.6 + latest security fixes). Once the download is completed, I ran

bundle exec macinbox --verbose --box-format virtualbox --no-fullscreen --memory 4096 --disk 256 --name mojave --installer "/Applications/Install macOS Mojave.app"
vagrant box repackage mojave virtualbox 10.14.6

Is this anything already seen before? I'm not sure if the host system matters, I don't have a mojave host available to test with.

The host machine is a MacBook Pro (13-inch, 2020), btw, which might be too new for Mojave, I wonder if there's any CPU/EFI flags etc. passed through by virtualbox that prevent it from booting...

Actually, the VM works on another (windows...) host! So this might be fixable by explicitly setting one or multiple of "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct", "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion", "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" and so on. I'll investigate. Would that be something to add to the macinbox scripts modifying the base box?

If I add the following line to my Vagrantfile, the VM boots on the Macbook Pro 2020:

vb.customize ["modifyvm", :id, "--cpuid-set", "00000001", "000306a9", "04100800", "7fbae3ff", "bfebfbff"]

Would this perhaps enable Mojave building on Catalina if these were set when the vm was being created?

@frankosterfeld Thanks for investigating this. Its not clear to me how to solve this generally. Presumably we would only want to call cpuid-set with these arguments for a box being run on a MacBook Pro 2020? Since macinbox doesn't know what hardware you're planning to run the box on, how could it properly configure the box? I suppose the Vagrantfile in the box itself could contain logic that determines what hardware it is running on, and passes different arguments?

@ekaiser-uptycs I don't think it would help, the installer is run on the host afaik, where it also checks for the host system.

@bacongravy the ID also makes it work on other hardware and operating systems, so it's not specific to the Macbook 2020. But I'm not sure either if it should be baked into the image, one might not want it when run on actually compatible hardware. I'm not sure what the best solution would be, it could be an option, or just a comment in the documentation about what to do in the Vagrantfile.