geerlingguy/macos-virtualbox-vm

High Sierra 10.13

fieryo opened this issue ยท 30 comments

It seems that macOS 10.13 has changed the installer and BaseSystem.dmg is no longer in the InstallESD.dmg. I tried to make an iso using the BaseSystem.dmg/.chunklist that is inside the installer, but when the installation starts (after the selection of the language) an error appears that OSXInstall.mpkg is broken.

Any idea how to create macOS 10.13 beta iso from the installation app?

I installed High Sierra as an update to Sierra in VirtualBox 5.1.23, following this blog.

I'm still curious how to create iso for High Sierra, though.

sh-3.2$ ls -ahln SharedSupport
total 10267088
drwxr-xr-x   8 501  20   272B  8 Jun 21:59 .
drwxr-xr-x  11 501  20   374B  1 Jun 05:33 ..
-rw-r--r--@  1 501  20   328B  8 Jun 21:59 AppleDiagnostics.chunklist
-rw-r--r--@  1 501  20   2.0M  8 Jun 21:59 AppleDiagnostics.dmg
-rw-r--r--@  1 501  20   1.9K  8 Jun 21:59 BaseSystem.chunklist
-rw-r--r--@  1 501  20   470M  8 Jun 21:59 BaseSystem.dmg
-rw-r--r--@  1 501  20   4.4G  8 Jun 21:38 InstallESD.dmg
-rw-r--r--   1 501  20   1.3K  1 Jun 01:25 InstallInfo.plist
sh-3.2$ sudo du -h SharedSupport
Password:
4.9G	SharedSupport
sh-3.2$ 

The question is how to create an iso from the High Sierra's SharedSupport files. InstallESD.dmg has different structure than Sierra's one.
Nether this nor this scripts work in VirtualBox.

My first edition of prepare-iso.sh for build 17A264c of Mac OS X 10.13 produced an installer that failed with these three lines:

macOS could not be installed on your computer

The path /System/Installation/Packages/OSinstall.mpkg appears to be missing or damaged.
Quit the installer to restart your computer and try again.

high sierra running - oracle vm virtualbox

From the mention of the second line at https://github.com/munki/createOSXinstallPkg/blob/master/README.md I understood that the problem was not necessarily with OSinstall.mpkg.

Re: #31 I decided to experiment with ditto(1) instead of cp(1). Result:

sh-3.2$ date ; uptime ; sw_vers
Sat 17 Jun 2017 09:48:50 BST
 9:48  up  4:16, 6 users, load averages: 0.79 0.71 0.90
ProductName:	Mac OS X
ProductVersion:	10.13
BuildVersion:	17A264c
sh-3.2$ hdiutil info
framework       : 476
driver          : 10.13v476
sh-3.2$ pwd
/Volumes/10.12.5/Users/Shared
sh-3.2$ ./prepare-iso.sh 

Mount the installer image
-----------------------------------------------------------
$ hdiutil attach Install macOS 10.13 Beta.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
/dev/disk4          	GUID_partition_scheme          	
/dev/disk4s1        	EFI                            	
/dev/disk4s2        	Apple_HFS                      	/Volumes/install_app

Create 10.13 blank ISO image with a Single Partition - Apple Partition Map
--------------------------------------------------------------------------
$ hdiutil create -o /tmp/10.13 -size 8g -layout SPUD -fs HFS+J -type SPARSE
created: /tmp/10.13.sparseimage

Mount the sparse bundle for package addition
--------------------------------------------------------------------------
$ hdiutil attach /tmp/10.13.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build
/dev/disk5          	Apple_partition_scheme         	
/dev/disk5s1        	Apple_partition_map            	
/dev/disk5s2        	Apple_HFS                      	/Volumes/install_build

Restore the Base System into the 10.13 ISO image
--------------------------------------------------------------------------
$ time asr restore -source Install macOS 10.13 Beta.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
	Validating target...done
	Validating source...done
	Retrieving scan information...done
	Validating sizes...done
	Restoring  ....10....20....30....40....50....60....70....80....90....100
	Remounting target volume...done

real	2m7.722s
user	0m25.071s
sys	0m7.646s

Remove Package link and replace with actual files
--------------------------------------------------------------------------
$ time ditto -V /Volumes/install_app/Packages /Volumes/OS X Base System/System/Installation/
>>> Copying /Volumes/install_app/Packages 
copying file ./Core.pkg ... 
4493565358 bytes for ./Core.pkg
copying file ./EmbeddedOSFirmware.pkg ... 
59297104 bytes for ./EmbeddedOSFirmware.pkg
copying file ./FirmwareUpdate.pkg ... 
209525983 bytes for ./FirmwareUpdate.pkg
copying file ./OSInstall.mpkg ... 
540615 bytes for ./OSInstall.mpkg

real	4m18.149s
user	0m0.119s
sys	0m9.294s

Copy macOS 10.13 installer dependencies
--------------------------------------------------------------------------
$ ditto -V Install macOS 10.13 Beta.app/Contents/SharedSupport/BaseSystem.chunklist /Volumes/OS X Base System/BaseSystem.chunklist
>>> Copying Install macOS 10.13 Beta.app/Contents/SharedSupport/BaseSystem.chunklist 
copying file ./BaseSystem.chunklist ... 
1984 bytes for ./BaseSystem.chunklist
$ time ditto -V Install macOS 10.13 Beta.app/Contents/SharedSupport/BaseSystem.dmg /Volumes/OS X Base System/BaseSystem.dmg
>>> Copying Install macOS 10.13 Beta.app/Contents/SharedSupport/BaseSystem.dmg 
copying file ./BaseSystem.dmg ... 
492710369 bytes for ./BaseSystem.dmg

real	0m26.737s
user	0m0.025s
sys	0m1.255s

Unmount the installer image
--------------------------------------------------------------------------
$ hdiutil detach /Volumes/install_app
"disk4" unmounted.
"disk4" ejected.

Unmount the sparse bundle
--------------------------------------------------------------------------
$ hdiutil detach /Volumes/OS X Base System/
"disk5" unmounted.
"disk5" ejected.

Resize the partition in the sparse bundle to remove any free space
--------------------------------------------------------------------------
$ hdiutil resize -size 14171168b /tmp/10.13.sparseimage

Convert the sparse bundle to ISO/CD master
--------------------------------------------------------------------------
$ time hdiutil convert /tmp/10.13.sparseimage -format UDTO -o /tmp/10.13
Reading Driver Descriptor Map (DDM : 0)โ€ฆ
Reading Apple (Apple_partition_map : 1)โ€ฆ
Reading disk image (Apple_HFS : 2)โ€ฆ
..................................................................................................................................................................................................... .  Elapsed Time:  9m 33.805s
Speed: 12.1Mbytes/sec
Savings: 0.0%
created: /tmp/10.13.cdr

real	9m34.493s
user	0m5.123s
sys	0m11.171s

Remove the sparse bundle
--------------------------------------------------------------------------
$ rm /tmp/10.13.sparseimage

Rename the ISO and move it to the desktop
--------------------------------------------------------------------------
$ mv /tmp/10.13.cdr /Users/bbsadmin-l/Desktop/10.13.iso
sh-3.2$

The end result is better โ€“ progress through (and long beyond) the eligibility check, population of the macOS Install Data folder, etc. โ€“ but somewhere towards the end of the installation routine, a failure occurs and the guest restarts before I can read the log. I'd like to keep that failure separate from this issue #28.


My current edition of prepare-iso.sh is too rough for a pull request. 10.13-related lines can be inferred from the Terminal output obve.

@geerlingguy work in progress https://gist.github.com/grahamperrin/d6b9e979d46708b41cdd25d79552a4cb includes some cosmetic changes. Not tested.

In particular, please note that for compatibility with 17A264c some lines were simply, lazily, commented out; so we should not expect this lazy edition to work with the installer for Sierra or earlier.

I managed to get 10.13 Beta running. Thanks to this thread!
Has anyone had success with connecting a real device (iphone, ipad) to the virtual machine. It is not working anymore since macOS Sierra 10.12.4: Although the device manager does detect the iphone, neither itunes nor xcode detects the device.

Update: I can confirm the issue is only present with virtualbox. It works fine with vmware.

Here is my script to create a ISO of online installer
https://gist.github.com/guoxiaoqiao/5b8f13ecf1853933932ec3ef0cf00c26

lony commented

@grahamperrin I made a PR #37 using your gist. I could now create the ISO and also install 10.13. Sadly after rebooting I get the following error:

uefi

I am experiencing the exact same issue @lony

Installer ISO boots and appears to finish but install is actually botched and unbootable.

Tried to accomplish this using the Resources/createinstallmedia executable to create the bootable image, same result :/

Shoutout to @SerafDosSantos for this fix.

Shell> fs1:
FS1:> cd "macOS Install Data"
FS1:\macOS Install Data> cd "Locked Files"
FS1:\macOS Install Data\Locked Files> cd "Boot Files"
FS1:\macOS Install Data\Locked Files\Boot Files> boot.efi

(via https://raimue.blog/2017/06/09/upgrading-a-vm-from-macos-10-12-sierra-to-macos-10-13-high-sierra-in-virtualbox/)

This got my iso installed on vbox.
@vbosx @daneov @lony

After the release of the supplemental update from Apple in the last days, I managed to get it running and wrote an blog article about it. So if anyone needs a step-by-step guide, there you go: http://tobiwashere.de/2017/10/virtualbox-how-to-create-a-macos-high-sierra-vm-to-run-on-a-mac-host-system/

@archesaurus steps worked great for me, thanks!

@tobiwashere @archesaurus - If someone wants to modify the directions in this repo in a PR (or base off #37 and touch it up), I'll be happy to merge (and close out this issue :) ).

Thanks for adding your notes! I've just gone to High Sierra on one of my Macs, and will soon be needing to run it in a VM too... so thanks for doing the hard work of getting it all working together and documenting it!

@geerlingguy I took a stab at adding some docs for the steps needed involving the EFI problem in #39 . Let me know if the wording makes sense. I also conformed the original PR (#37) to your format of spaces (since the original had tabs).

Strangely enough, when testing I found that I am unable to get High Sierra to boot correctly. When booting I get:
Error loading kernel cache (0x1) however when I boot to the EFI terminal I am unable to load into FS1:

screen shot 2017-10-19 at 11 32 03 pm

Might it be case-sensitive? I ran into the same issue, but following the instructions in the readme got me through this. The first step states 'fs1:', though, not 'FS1:'.

I ran into the same issue where after the initial installation, FS1 was not recognized in the VirtualBox UEFI shell. Turns out I had checked the SSD option in VirtualBox for my virtual hard drive, and the drive was formatted as APFS, which the VirtualBox EFI BIOS does not yet support. Since the VirtualBox BIOS could not read the APFS-formatted drive, it could not be selected in the EFI boot manager. When I unchecked the SSD option and reinstalled macOS (which formatted the drive in HFS+), I could then boot from FS1 in the UEFI shell.

fs1: didn't work for me either, same issue. @philipnewcomer can you elaborate on the steps you took to get it to work? I am still not sure how to correctly repro how you applied your fix.

I suppose the trick is to make sure the virtual disk is formatted with HFS+. I'm assuming that having the SSD option for the virtual disk unchecked is a prerequisite to be able to do so (since High Sierra apparently will always format SSDs as APFS).

@dotCipher first you have to turn off the Solid-state Drive option in the VM's storage settings:
screen shot 2017-10-23 at 7 24 54 pm

Then you need to boot from the macOS installer disk image, erase the drive, and reinstall macOS.

If the installer detects a solid state drive, it will automatically (re)format the drive in APFS during installation, which is why you have to erase and reinstall after changing the drive type in VirtualBox before you can boot.

@philipnewcomer Yeah I had SSD turned off originally. I ended up updating my version of VirtualBox and running the script commands one-by-one in order to get it to work. It seems like the script doesn't Unmount the sparse bundle correctly (notice the first error in the output below: hdiutil: couldn't unmount "disk3" - Resource busy)

Plus it seems like I get an xargs: illegal option -- - before the createISO function is called (during the Eject installer disk in case it was opened after download from App Store step (see hdiutil info | grep /dev/disk | grep partition | cut -f 1 | xargs --no-run-if-empty hdiutil detach -force ).

Seems like the change present in PR #36 fixes it.

Output of the script execution with errors:

โฏ ./prepare-iso.sh                                                                                                                                                  [18:15:43]
xargs: illegal option -- -
usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr]
             [-L number] [-n number [-x]] [-P maxprocs] [-s size]
             [utility [argument ...]]

Mount the installer image
-----------------------------------------------------------
$ hdiutil attach /Applications/Install macOS High Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
/dev/disk2          	GUID_partition_scheme
/dev/disk2s1        	EFI
/dev/disk2s2        	Apple_HFS                      	/Volumes/install_app

Create HighSierra blank ISO image with a Single Partition - Apple Partition Map
--------------------------------------------------------------------------
$ hdiutil create -o /tmp/HighSierra -size 8g -layout SPUD -fs HFS+J -type SPARSE
created: /tmp/HighSierra.sparseimage

Mount the sparse bundle for package addition
--------------------------------------------------------------------------
$ hdiutil attach /tmp/HighSierra.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build
/dev/disk3          	Apple_partition_scheme
/dev/disk3s1        	Apple_partition_map
/dev/disk3s2        	Apple_HFS                      	/Volumes/install_build

Restore the Base System into the HighSierra ISO image
--------------------------------------------------------------------------
$ time asr restore -source /Applications/Install macOS High Sierra.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
	Validating target...done
	Validating source...done
	Retrieving scan information...done
	Validating sizes...done
	Restoring  ....10....20....30....40....50....60....70....80....90....100
	Remounting target volume...done

real	0m53.738s
user	0m11.826s
sys	0m2.283s

Remove Package link and replace with actual files
--------------------------------------------------------------------------
$ time ditto -V /Volumes/install_app/Packages /Volumes/OS X Base System/System/Installation/
>>> Copying /Volumes/install_app/Packages
copying file ./Core.pkg ...
4408364461 bytes for ./Core.pkg
copying file ./EmbeddedOSFirmware.pkg ...
59301208 bytes for ./EmbeddedOSFirmware.pkg
copying file ./FirmwareUpdate.pkg ...
200477920 bytes for ./FirmwareUpdate.pkg
copying file ./OSInstall.mpkg ...
669993 bytes for ./OSInstall.mpkg

real	1m5.879s
user	0m0.062s
sys	0m5.407s

Copy macOS HighSierra installer dependencies
--------------------------------------------------------------------------
$ ditto -V /Applications/Install macOS High Sierra.app/Contents/SharedSupport/BaseSystem.chunklist /Volumes/OS X Base System/BaseSystem.chunklist
>>> Copying /Applications/Install macOS High Sierra.app/Contents/SharedSupport/BaseSystem.chunklist
copying file ./BaseSystem.chunklist ...
1984 bytes for ./BaseSystem.chunklist
$ time ditto -V /Applications/Install macOS High Sierra.app/Contents/SharedSupport/BaseSystem.dmg /Volumes/OS X Base System/BaseSystem.dmg
>>> Copying /Applications/Install macOS High Sierra.app/Contents/SharedSupport/BaseSystem.dmg
copying file ./BaseSystem.dmg ...
490897695 bytes for ./BaseSystem.dmg

real	0m5.859s
user	0m0.006s
sys	0m0.450s

Unmount the installer image
--------------------------------------------------------------------------
$ hdiutil detach /Volumes/install_app
"disk2" unmounted.
"disk2" ejected.

Unmount the sparse bundle
--------------------------------------------------------------------------
$ hdiutil detach /Volumes/OS X Base System/
hdiutil: couldn't unmount "disk3" - Resource busy

Resize the partition in the sparse bundle to remove any free space
--------------------------------------------------------------------------
$ hdiutil resize -size 14006056b /tmp/HighSierra.sparseimage
hdiutil: resize: failed. Resource temporarily unavailable (35)

Convert HighSierra the sparse bundle to ISO/CD master
--------------------------------------------------------------------------
$ time hdiutil convert /tmp/HighSierra.sparseimage -format UDTO -o /tmp/HighSierra
hdiutil: convert failed - Resource temporarily unavailable

real	0m0.030s
user	0m0.016s
sys	0m0.008s

Remove the sparse bundle
--------------------------------------------------------------------------
$ rm /tmp/HighSierra.sparseimage

Rename the ISO and move it to the desktop
--------------------------------------------------------------------------
$ mv /tmp/HighSierra.cdr /Users/cmoore/Desktop/HighSierra.iso
mv: cannot stat '/tmp/HighSierra.cdr': No such file or directory

See #39; I plan on merging that to get High Sierra support added (finally). Sorry about the delays... health problems kind of knocked me out for the past year or so :(

So... I'm getting the following message repeated ad infinitum when I first boot the VM with the High Sierra ISO mounted:

Attempting system restart...MACH Reboot

As it turns out, it's important to choose "Mac OS X (64-bit)" Instead of the High Sierra option for the VM; if you choose High Sierra as the version VirtualBox seems to not allow reboots to work right for some reason?

To illustrate, choose the following:

screen shot 2018-08-15 at 2 06 31 pm

So after going through installation (the installer seemed to also download the macOS combo update as well!), I get the error "An error occurred while preparing the installation. Try running this application again.", and if I look at the logs, it looks like the installer is trying to convert the HFS+-formatted drive to APFS:

screen shot 2018-08-15 at 2 16 03 pm

screen shot 2018-08-15 at 2 15 51 pm

So I formatted the disk as APFS, and now it gets to the end of the installation process, then I see a bunch of notices/warnings in the installer log, and it reboots... right back to the installer. If I unmount the ISO and reboot it brings up the UEFI boot menu and shell, and won't boot if I try selecting Mac OS X or the Hard Disk as the boot option. Hrm...

Might try using the non-interactive installer and HFS+, maybe VirtualBox disks don't support APFS well?

So I've merged support based on the three older PRs; any new issues should be added as new issues in the issue queue. Currently, my testing shows that formatting as APFS seems to get the initial installation working correctly, but on reboot it just goes back to the installer again. Debugging that now.

@philipnewcomer Yeah I had SSD turned off originally. I ended up updating my version of VirtualBox and running the script commands one-by-one in order to get it to work. It seems like the script doesn't Unmount the sparse bundle correctly (notice the first error in the output below: hdiutil: couldn't unmount "disk3" - Resource busy)

Plus it seems like I get an xargs: illegal option -- - before the createISO function is called (during the Eject installer disk in case it was opened after download from App Store step (see hdiutil info | grep /dev/disk | grep partition | cut -f 1 | xargs --no-run-if-empty hdiutil detach -force ).

Seems like the change present in PR #36 fixes it.

Output of the script execution with errors:

โฏ ./prepare-iso.sh                                                                                                                                                  [18:15:43]
xargs: illegal option -- -
usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr]
             [-L number] [-n number [-x]] [-P maxprocs] [-s size]
             [utility [argument ...]]

Mount the installer image
-----------------------------------------------------------
$ hdiutil attach /Applications/Install macOS High Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
/dev/disk2          	GUID_partition_scheme
/dev/disk2s1        	EFI
/dev/disk2s2        	Apple_HFS                      	/Volumes/install_app

Create HighSierra blank ISO image with a Single Partition - Apple Partition Map
--------------------------------------------------------------------------
$ hdiutil create -o /tmp/HighSierra -size 8g -layout SPUD -fs HFS+J -type SPARSE
created: /tmp/HighSierra.sparseimage

Mount the sparse bundle for package addition
--------------------------------------------------------------------------
$ hdiutil attach /tmp/HighSierra.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build
/dev/disk3          	Apple_partition_scheme
/dev/disk3s1        	Apple_partition_map
/dev/disk3s2        	Apple_HFS                      	/Volumes/install_build

Restore the Base System into the HighSierra ISO image
--------------------------------------------------------------------------
$ time asr restore -source /Applications/Install macOS High Sierra.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
	Validating target...done
	Validating source...done
	Retrieving scan information...done
	Validating sizes...done
	Restoring  ....10....20....30....40....50....60....70....80....90....100
	Remounting target volume...done

real	0m53.738s
user	0m11.826s
sys	0m2.283s

Remove Package link and replace with actual files
--------------------------------------------------------------------------
$ time ditto -V /Volumes/install_app/Packages /Volumes/OS X Base System/System/Installation/
>>> Copying /Volumes/install_app/Packages
copying file ./Core.pkg ...
4408364461 bytes for ./Core.pkg
copying file ./EmbeddedOSFirmware.pkg ...
59301208 bytes for ./EmbeddedOSFirmware.pkg
copying file ./FirmwareUpdate.pkg ...
200477920 bytes for ./FirmwareUpdate.pkg
copying file ./OSInstall.mpkg ...
669993 bytes for ./OSInstall.mpkg

real	1m5.879s
user	0m0.062s
sys	0m5.407s

Copy macOS HighSierra installer dependencies
--------------------------------------------------------------------------
$ ditto -V /Applications/Install macOS High Sierra.app/Contents/SharedSupport/BaseSystem.chunklist /Volumes/OS X Base System/BaseSystem.chunklist
>>> Copying /Applications/Install macOS High Sierra.app/Contents/SharedSupport/BaseSystem.chunklist
copying file ./BaseSystem.chunklist ...
1984 bytes for ./BaseSystem.chunklist
$ time ditto -V /Applications/Install macOS High Sierra.app/Contents/SharedSupport/BaseSystem.dmg /Volumes/OS X Base System/BaseSystem.dmg
>>> Copying /Applications/Install macOS High Sierra.app/Contents/SharedSupport/BaseSystem.dmg
copying file ./BaseSystem.dmg ...
490897695 bytes for ./BaseSystem.dmg

real	0m5.859s
user	0m0.006s
sys	0m0.450s

Unmount the installer image
--------------------------------------------------------------------------
$ hdiutil detach /Volumes/install_app
"disk2" unmounted.
"disk2" ejected.

Unmount the sparse bundle
--------------------------------------------------------------------------
$ hdiutil detach /Volumes/OS X Base System/
hdiutil: couldn't unmount "disk3" - Resource busy

Resize the partition in the sparse bundle to remove any free space
--------------------------------------------------------------------------
$ hdiutil resize -size 14006056b /tmp/HighSierra.sparseimage
hdiutil: resize: failed. Resource temporarily unavailable (35)

Convert HighSierra the sparse bundle to ISO/CD master
--------------------------------------------------------------------------
$ time hdiutil convert /tmp/HighSierra.sparseimage -format UDTO -o /tmp/HighSierra
hdiutil: convert failed - Resource temporarily unavailable

real	0m0.030s
user	0m0.016s
sys	0m0.008s

Remove the sparse bundle
--------------------------------------------------------------------------
$ rm /tmp/HighSierra.sparseimage

Rename the ISO and move it to the desktop
--------------------------------------------------------------------------
$ mv /tmp/HighSierra.cdr /Users/cmoore/Desktop/HighSierra.iso
mv: cannot stat '/tmp/HighSierra.cdr': No such file or directory

@dotCipher I am running into exactly the same issue with the script not being able to unmount disk3 and the subsequent errors. Would you mind sharing how you fixed it on your end? PR #36 only seems to be related to the xargs problem?

@manandak for me, the only workaround was to try once, then wait, then try again :(