I'm trying to build a VirtualBox image for macOS High Sierra suitable for Vagrant, that has a vagrant user and launches sshd on boot. I can inject a custom .PKG into the macOS installer via minstallconfig.xml and OSInstall.collection, but unfortunately when I try to do this, instead of booting into a sensible environment with port 22 open, I see get a blank gray screen in the VirtualBox preview, and packer is never able to connect to the SSH server.
My work in progress packer configuration is in a "macos" branch at https://github.com/mcandre/packer-templates
I looked at a bunch of similar configurations for packing Vagrant boxes for macOS, and I don't see anything obviously wrong with my configuration compared to the others. Maybe someone could offer a second pair of eyes to identify the problem?
A few notes:
- Packer never reports any authentication errors or other network connection errors with SSH. I can try configuring the
PACKER_LOG=1
environment variable in order to dig deeper. - When macOS initially boots up in VirtualBox during packing, launchd reports a few errors, mostly about apparently missing files and folders. ColorSync Default profile is missing. For some reason, /Library/LaunchDaemons and /Library/LaunchAgents are missing. These are probably easy enough to fix by inserting appropriate files during the ISO generation step, though I'm not sure how significant these messages are. In any case, when minstallconfig.xml is left out of the ISO, macOS is still able to boot into SetupAssistant, even with these launchd messages.
A few theories:
- The blank gray screen is natural, when a custom .PKG skips the SetupAssistant by placing a
.AppleSetupDone
in the right path. sshd is never launched because it is configured for the final target volume, whereas the VM is stuck in the installer volume during packing. If this is somewhat correct, then there is hopefully a way to force a clean reboot once all the packages are installed, in order to boot into the final volume and begin launching sshd. - File permissions, disk permissions, NVRAM, and/or PRAM are corrupt. If so, need to somehow manipulate the final target volume in an automated, text driven way, so that the things get repaired during packing.
- Some piece of the custom package is introducing an error. Hopefully this can be fixed by starting with a fresh clone of some of the preexisting packer projects for macOS, and then gradually tweaking them to look more like my configuration, until I spot a difference that causes the blank gray screen.
- macOS 10.13 High Sierra could be introducing a problem that previous packer configurations have not addressed.
- The ISO I'm generating from the High Sierra installer application resources is somehow corrupt.
So I have a few running theories for why this is screwing up on my machine, hopefully someone can chime in with a fix for this on their machine :)
[link] [comments]
Post a Comment