Skip to content

Packer fails to cleanup after interrupt with virtualbox #915

Closed
@jameskyle

Description

If you Ctrl-C during a vbox build, packer is unable to clean up. Until it is manually cleaned up, it is also unable to create that build target:

==> centos-6.5-x86_64: Unregistering and deleting virtual machine...
==> centos-6.5-x86_64: Error deleting virtual machine: VBoxManage error: VBoxManage: error: Cannot unregister the machine 'centos-6.5-x86_64' while it is locked
==> centos-6.5-x86_64: VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component Machine, interface IMachine, callee nsISupports
==> centos-6.5-x86_64: VBoxManage: error: Context: "Unregister(CleanupMode_DetachAllReturnHardDisksOnly, ComSafeArrayAsOutParam(aMedia))" at line 158 of file VBoxManageMisc.cpp
==> centos-6.5-x86_64: Deleting output directory...
Build 'centos-6.5-x86_64' errored: Build was cancelled.
Cleanly cancelled builds after being interrupted.

jkyle at metaverse in ~/Projects/ISOs/galra (feature/virtualbox●●●)
(packer)$ packer build -only=centos-6.5-x86_64 -var 'proxy=http://172.16.101.186:8000/' templates/redhat_virtualbox.json
centos-6.5-x86_64 output will be in this color.

==> centos-6.5-x86_64: Downloading or copying Guest additions checksums
centos-6.5-x86_64: Downloading or copying: http://download.virtualbox.org/virtualbox/4.3.6/SHA256SUMS
==> centos-6.5-x86_64: Downloading or copying Guest additions
centos-6.5-x86_64: Downloading or copying: http://download.virtualbox.org/virtualbox/4.3.6/VBoxGuestAdditions_4.3.6.iso
==> centos-6.5-x86_64: Downloading or copying ISO
centos-6.5-x86_64: Downloading or copying: http://mirror.stanford.edu/yum/pub/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-minimal.iso
==> centos-6.5-x86_64: Creating virtual machine...
==> centos-6.5-x86_64: Error creating VM: VBoxManage error: VBoxManage: error: Machine settings file '/Users/jkyle/VirtualBox VMs/centos-6.5-x86_64/centos-6.5-x86_64.vbox' already exists
==> centos-6.5-x86_64: VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Machine, interface IMachine, callee nsISupports
==> centos-6.5-x86_64: VBoxManage: error: Context: "CreateMachine(bstrSettingsFile.raw(), bstrName.raw(), ComSafeArrayAsInParam(groups), bstrOsTypeId.raw(), createFlags.raw(), machine.asOutParam())" at line 275 of file VBoxManageMisc.cpp
==> centos-6.5-x86_64: Deleting output directory...
Build 'centos-6.5-x86_64' errored: Error creating VM: VBoxManage error: VBoxManage: error: Machine settings file '/Users/jkyle/VirtualBox VMs/centos-6.5-x86_64/centos-6.5-x86_64.vbox' already exists
VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Machine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "CreateMachine(bstrSettingsFile.raw(), bstrName.raw(), ComSafeArrayAsInParam(groups), bstrOsTypeId.raw(), createFlags.raw(), machine.asOutParam())" at line 275 of file VBoxManageMisc.cpp

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions