Closed aroper23 closed 5 years ago
Thanks! The EFI partition is not the one you’re supposed to install macOS on (it’s 1 MB on purpose). Instead there is a disk you’ve to partition within the installer. However, this step is also automated since yesterday. Can you test the latest version?
I tried doing make all with the new version, and now see the expected destination disk in addition to the EFI partition.
With the original script I'm able to perform the initial macOS install steps, but after restarting the VM (by pressing Enter in the shell window running the script), I end up at a UEFI screen instead of continuing the macOS install.
Since I still saw the permissions issues I mentioned above, I modified the script again to use sudo and to generate and copy the startup.nsh file to the EFI volume. After doing so, when the VM starts I end up at a shell prompt instead of the macOS install screen.
UEFI prompt after restarting with the original script:
Prompt when the VM starts with the modified script:
runMojaveVirtualbox-modified-script.log
runMojaveVirtualbox-modified.sh.txt
runMojaveVirtualbox-unmodified-script.log
Just executed make stash clean
to delete all old files and the VM and then make all
- which started the installation process and after reboot it finished the installation as expected. I will have a look at the logs...
I did make stash clean
and make all
as you suggested with an unmodified runMojaveVirtualBox.sh script, but I still end up at the UEFI interactive shell screen after pressing Enter in the terminal to restart the VM. I waited for the VM to arrive at the macOS install screen a second time in the VM before pressing Enter in the terminal to restart the VM in case the timing matters.
Ok, clearly this is the issue:
cp: cannot create regular file '/Volumes/EFI/EFI/drivers/apfs.efi': Permission denied
./runMojaveVirtualbox.sh: line 259: /Volumes/EFI/startup.nsh: Permission denied
Therefore, the EFI can't find the bootable macOS disk. Can you identify what the issue might be when executing it manually? My output:
$ DST_SPARSE=test.sparseimage
$ hdiutil create -size 1m -fs MS-DOS -volname "EFI" "$DST_SPARSE"
created: /Users/abc/runMojaveVirtualbox/test.sparseimage
$ EFI_DEVICE=$(hdiutil attach -nomount "$DST_SPARSE" 2>&1)
$ EFI_DEVICE=$(echo $EFI_DEVICE|egrep -o '/dev/disk[[:digit:]]{1}' |head -n1)
$ diskutil mount "${EFI_DEVICE}s1"
Volume EFI on /dev/disk2s1 mounted
$ mkdir -p /Volumes/EFI/EFI/drivers
$ cp /usr/standalone/i386/apfs.efi /Volumes/EFI/EFI/drivers/
$ #works
$ ls -l /Volumes/EFI/*
total 1
drwxrwxrwx 1 abc staff 512 Feb 7 10:53 drivers
$ ls -l /Volumes/EFI/drivers/*
ls: /Volumes/EFI/drivers/*: No such file or directory
$ ls -l /Volumes/EFI/EFI/drivers/*
-rwxrwxrwx 1 abc staff 600600 Feb 7 10:53 /Volumes/EFI/EFI/drivers/apfs.efi
Here's what I see when I try the same from a terminal. In case it matters, I'm using bash 4.4 instead of the bash 4.3 that comes packaged with macOS. I also have coreutils installed, but I made sure it wasn't in the path and that the standard hdiutils and cp commands were being used.
bash-4.4$ DST_SPARSE=test.sparseimage
bash-4.4$ hdiutil create -size 1m -fs MS-DOS -volname "EFI" "$DST_SPARSE"
created: /Users/aroper/VirtualBox VMs/test.sparseimage
bash-4.4$ EFI_DEVICE=$(hdiutil attach -nomount "$DST_SPARSE" 2>&1)
bash-4.4$ EFI_DEVICE=$(echo $EFI_DEVICE|egrep -o '/dev/disk[[:digit:]]{1}' |head -n1)
bash-4.4$ echo $EFI_DEVICE
/dev/disk3
bash-4.4$ diskutil mount "${EFI_DEVICE}s1"
Volume EFI on /dev/disk3s1 mounted
bash-4.4$ mkdir -p /Volumes/EFI/EFI/drivers
bash-4.4$ cp /usr/standalone/i386/apfs.efi /Volumes/EFI/EFI/drivers/
cp: /Volumes/EFI/EFI/drivers/apfs.efi: Permission denied
bash-4.4$ ls -l /Volumes/EFI/*
-rw-r--r-- 1 root wheel 612 Feb 5 08:14 /Volumes/EFI/startup.nsh
/Volumes/EFI/EFI:
total 0
drwxr-xr-x+ 3 root wheel 96 Jan 20 10:55 drivers
bash-4.4$ which bash
/bin/bash
bash-4.4$ which hdiutil
/usr/bin/hdiutil
bash-4.4$ which cp
/bin/cp
bash-4.4$ hdiutil info
framework : 480.230.2
driver : 10.13v480.230.2
images : 2
================================================
image-path : /Users/aroper/VirtualBox VMs/MacOS Mojave.sparseimage
image-alias : /Users/aroper/VirtualBox VMs/MacOS Mojave.sparseimage
shadow-path : <none>
icon-path : /System/Library/PrivateFrameworks/DiskImages.framework/Resources/CDiskImage.icns
image-type : sparse disk image
system-image : false
blockcount : 134217728
blocksize : 512
writeable : TRUE
autodiskmount : false
removable : TRUE
image-encrypted : false
mounting user : aroper
mounting mode : <unknown>
process ID : 9314
/dev/disk2 GUID_partition_scheme
/dev/disk2s1 C12A7328-F81F-11D2-BA4B-00A0C93EC93B
/dev/disk2s2 48465300-0000-11AA-AA11-00306543ECAC
================================================
image-path : /Users/aroper/VirtualBox VMs/test.sparseimage
image-alias : /Users/aroper/VirtualBox VMs/test.sparseimage
shadow-path : <none>
icon-path : /System/Library/PrivateFrameworks/DiskImages.framework/Resources/CDiskImage.icns
image-type : sparse disk image
system-image : false
blockcount : 2048
blocksize : 512
writeable : TRUE
autodiskmount : false
removable : TRUE
image-encrypted : false
mounting user : aroper
mounting mode : <unknown>
process ID : 9368
/dev/disk3 FDisk_partition_scheme
/dev/disk3s1 DOS_FAT_32 /Volumes/EFI 1
Seems there is an old folder at /Volumes/EFI
created by root.
Thanks so much for pointing me in the right direction. I was able to create a bootable VM after removing the contents in /Volumes/EFI and starting over.
Do you have any tips for porting the VM to run in VirtualBox on Windows? I copied the files over and updated the location of MacOS Mojave.vdi and MacOS Mojave.efi.vdi in the vbox file, but the VM boots to the EFI prompt, continues to the Mac boot, crashes, returns to the EFI prompt, etc.
Very well. Regarding your question: I've seen work to run this VM on Windows and another user tried it with Linux (#45). However, can't help here.
BTW: https://github.com/img2tab/macos-guest-virtualbox might help
When doing make all, in the macOS Mojave install when I arrive at the "Select the disk where you want to install macOS" step, the only disk available is EFI (1 MB total, 1 MB available). This error displays immediately on this page/screen:
Please see the attached runMojaveVirtualbox.sh and log files. I had to modify the patchEFI script a bit to overcome some permissions errors when updating the EFI volume and to prevent patchEFI from executing twice when doing make all. I added comments with my name in the script where I made changes.
runMojaveVirtualbox.sh.txt runMojaveVirtualbox.log