hashicorp / packer-plugin-vmware

Packer plugin for VMware Builder
https://www.packer.io/docs/builders/vmware
Mozilla Public License 2.0
44 stars 42 forks source link

VMware Provisioner sometimes finishes with i/o timeout after shrinking disk #13

Closed ghost closed 1 year ago

ghost commented 3 years ago

This issue was originally opened by @mindrunner as hashicorp/packer#5077. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


I am using VMware provisioner to build a macOS Vagrant box. The last step is to call the shrink.sh script to compact the vmdk-files. This script calls 'vmware-tools-cli disk shrink' in the virtual machine. I assume, that zeros are written to the whole free disk space. Calling this manually, makes the vm unresponsive for some seconds (probably when the disk is completely filled) and drops some network connections (including the ssh connection from packer).

==> vmware-iso: Pausing 30s before the next provisioner...
==> vmware-iso: Provisioning with shell script: ../osx-vm-templates/scripts/shrink.sh
    vmware-iso: rm: /private/var/vm/swapfile0: Operation not permitted
    vmware-iso: Please disregard any warnings about disk space for the duration of shrink process.
    vmware-iso:
    vmware-iso: Progress: 100 [===========>]
==> vmware-iso: Pausing 30s before the next provisioner...
==> vmware-iso: Provisioning with shell script: ../scripts/nothing.sh
==> vmware-iso: Stopping virtual machine...
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored: Retryable error: Error uploading script: dial tcp 192.168.151.129:22: i/o timeout

==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Retryable error: Error uploading script: dial tcp 192.168.151.129:22: i/o timeout

==> Builds finished but no artifacts were created.

This does not always happen. About 1 of 10 builds finishes without error.

Packer Version: Packer v1.0.2 Host: macOS 10.12.5 Debug Log: https://gist.github.com/mindrunner/b70b5a1f30cc3d8511246886b85a784c

Example: https://gist.github.com/mindrunner/369bd841277984d5e1322c478916cb26

I cannot really provide a "minimal example" The Ansible provisioning script is huge and not (yet) open source. However, when I skip the big provisioning step and create an almost empty macOS box, I never see the i/o error problem.

tenthirtyam commented 1 year ago

https://github.com/hashicorp/packer/issues/5077#issuecomment-312496447