boxcutter / macos

Virtual machine templates for macOS written in legacy JSON
MIT License
317 stars 65 forks source link

Minimize.sh script fails OSX builds #14

Closed chocolatewheelchair closed 7 years ago

chocolatewheelchair commented 8 years ago

Host machine: OSX 10.10 Using the boxcutter templates, unadulterated.

Am consistently running into the following error for every OSX packer build:

==> vmware-iso: Provisioning with shell script: script/minimize.sh
    vmware-iso: ==> Turn off hibernation
    vmware-iso: ==> Get rid of the sleepimage
    vmware-iso: ==> Stop the page process and dropping swap files
    vmware-iso: Zeroing out free space
    vmware-iso: Started erase on disk1s2 Macintosh HD
    vmware-iso: Creating a temporary file
    vmware-iso: Securely erasing a file
    vmware-iso: Creating a secondary temporary file
    vmware-iso: Mounting disk
    vmware-iso: Finished erase on disk1s2 Macintosh HD
    vmware-iso: Please disregard any warnings about disk space for the duration of shrink process.
Progress: 99 [==========>]17 [==>        ]
==> vmware-iso: Stopping virtual machine...
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored: Retryable error: Error removing temporary script at /tmp/script_7943.sh: dial tcp 172.16.250.137:22: connect: host is down

==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Retryable error: Error removing temporary script at /tmp/script_7943.sh: dial tcp 172.16.250.137:22: connect: host is down

Builds succeed if i comment out the minimize.sh script so the issue definitely seems to come from there, but I have no idea what´s up. Pointers anyone?

Edit: when running packer in headless_mode: "false", it seems packer tries to remove the temp script after having shutdown the machine, hence why it cannot remove the script or communicate with the vm at all

berney commented 8 years ago

Try running with PACKER_LOG=1 packer -debug <args> to see exactly where it is going wrong.

annawake commented 7 years ago

I increased the timeout on shrink to compensate for older/slower machines. It appears to be related to the speed that your computer perform the shrink operation, and whether that is faster than the default packer retry timeout:

https://github.com/boxcutter/macos/commit/44d66e94e5d94c28581432ad8d5ff9514dab473c