{"action":"created","issue":{"url":"https://api.github.com/repos/mitchellh/packer/issues/915","labels_url":"https://api.github.com/repos/mitchellh/packer/issues/915/labels{/name}","comments_url":"https://api.github.com/repos/mitchellh/packer/issues/915/comments","events_url":"https://api.github.com/repos/mitchellh/packer/issues/915/events","html_url":"https://github.com/mitchellh/packer/issues/915","id":28368605,"number":915,"title":"Packer fails to cleanup after interrupt with virtualbox","user":{"login":"jameskyle","id":8234,"avatar_url":"https://avatars.githubusercontent.com/u/8234?v=3","gravatar_id":"","url":"https://api.github.com/users/jameskyle","html_url":"https://github.com/jameskyle","followers_url":"https://api.github.com/users/jameskyle/followers","following_url":"https://api.github.com/users/jameskyle/following{/other_user}","gists_url":"https://api.github.com/users/jameskyle/gists{/gist_id}","starred_url":"https://api.github.com/users/jameskyle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jameskyle/subscriptions","organizations_url":"https://api.github.com/users/jameskyle/orgs","repos_url":"https://api.github.com/users/jameskyle/repos","events_url":"https://api.github.com/users/jameskyle/events{/privacy}","received_events_url":"https://api.github.com/users/jameskyle/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2014-02-26T20:55:09Z","updated_at":"2015-10-16T12:47:32Z","closed_at":"2014-03-01T15:21:03Z","body":"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:\r\n\r\n==> centos-6.5-x86_64: Unregistering and deleting virtual machine...\r\n==> 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\r\n==> centos-6.5-x86_64: VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component Machine, interface IMachine, callee nsISupports\r\n==> centos-6.5-x86_64: VBoxManage: error: Context: \"Unregister(CleanupMode_DetachAllReturnHardDisksOnly, ComSafeArrayAsOutParam(aMedia))\" at line 158 of file VBoxManageMisc.cpp\r\n==> centos-6.5-x86_64: Deleting output directory...\r\nBuild 'centos-6.5-x86_64' errored: Build was cancelled.\r\nCleanly cancelled builds after being interrupted.\r\n\r\njkyle at metaverse in ~/Projects/ISOs/galra (feature/virtualbox●●●)\r\n(packer)$ packer build -only=centos-6.5-x86_64  -var 'proxy=http://172.16.101.186:8000/' templates/redhat_virtualbox.json\r\ncentos-6.5-x86_64 output will be in this color.\r\n\r\n==> centos-6.5-x86_64: Downloading or copying Guest additions checksums\r\n    centos-6.5-x86_64: Downloading or copying: http://download.virtualbox.org/virtualbox/4.3.6/SHA256SUMS\r\n==> centos-6.5-x86_64: Downloading or copying Guest additions\r\n    centos-6.5-x86_64: Downloading or copying: http://download.virtualbox.org/virtualbox/4.3.6/VBoxGuestAdditions_4.3.6.iso\r\n==> centos-6.5-x86_64: Downloading or copying ISO\r\n    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\r\n==> centos-6.5-x86_64: Creating virtual machine...\r\n==> 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\r\n==> centos-6.5-x86_64: VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Machine, interface IMachine, callee nsISupports\r\n==> 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\r\n==> centos-6.5-x86_64: Deleting output directory...\r\nBuild '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\r\nVBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Machine, interface IMachine, callee nsISupports\r\nVBoxManage: error: Context: \"CreateMachine(bstrSettingsFile.raw(), bstrName.raw(), ComSafeArrayAsInParam(groups), bstrOsTypeId.raw(), createFlags.raw(), machine.asOutParam())\" at line 275 of file VBoxManageMisc.cpp\r\n"},"comment":{"url":"https://api.github.com/repos/mitchellh/packer/issues/comments/148707647","html_url":"https://github.com/mitchellh/packer/issues/915#issuecomment-148707647","issue_url":"https://api.github.com/repos/mitchellh/packer/issues/915","id":148707647,"user":{"login":"jmiller0","id":5279689,"avatar_url":"https://avatars.githubusercontent.com/u/5279689?v=3","gravatar_id":"","url":"https://api.github.com/users/jmiller0","html_url":"https://github.com/jmiller0","followers_url":"https://api.github.com/users/jmiller0/followers","following_url":"https://api.github.com/users/jmiller0/following{/other_user}","gists_url":"https://api.github.com/users/jmiller0/gists{/gist_id}","starred_url":"https://api.github.com/users/jmiller0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmiller0/subscriptions","organizations_url":"https://api.github.com/users/jmiller0/orgs","repos_url":"https://api.github.com/users/jmiller0/repos","events_url":"https://api.github.com/users/jmiller0/events{/privacy}","received_events_url":"https://api.github.com/users/jmiller0/received_events","type":"User","site_admin":false},"created_at":"2015-10-16T12:47:32Z","updated_at":"2015-10-16T12:47:32Z","body":"I see this still happening with the latest packer.  I have a CI environment where I run multiple packer jobs and I'm continually getting these errors. \r\n\r\n```\r\n[07:39:08][Step 1/1]  [1;32m==> virtualbox-iso: Downloading or copying Guest additions [0m\r\n[07:39:08][Step 1/1]  [0;32m    virtualbox-iso: Downloading or copying: file:///usr/share/virtualbox/VBoxGuestAdditions.iso [0m\r\n[07:39:08][Step 1/1]  [1;32m==> virtualbox-iso: Downloading or copying ISO [0m\r\n[07:39:08][Step 1/1]  [0;32m    virtualbox-iso: Downloading or copying: http://lab-ops-cobb01/isos/lab-ops-cobb01-centos7.iso [0m\r\n[07:39:08][Step 1/1]  [1;32m==> virtualbox-iso: Creating virtual machine... [0m\r\n[07:39:08][Step 1/1]  [1;31m==> virtualbox-iso: Error creating VM: VBoxManage error: VBoxManage: error: Machine settings file '/root/VirtualBox VMs/packer-virtualbox-iso-1444999012/packer-virtualbox-iso-1444999012.vbox' already exists\r\n[07:39:08][Step 1/1] ==> virtualbox-iso: VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component MachineWrap, interface IMachine, callee nsISupports\r\n[07:39:08][Step 1/1] ==> virtualbox-iso: VBoxManage: error: Context: \"CreateMachine(bstrSettingsFile.raw(), bstrName.raw(), ComSafeArrayAsInParam(groups), bstrOsTypeId.raw(), createFlags.raw(), machine.asOutParam())\" at line 272 of file VBoxManageMisc.cpp [0m\r\n[07:39:08][Step 1/1]  [1;32m==> virtualbox-iso: Deleting output directory... [0m\r\n[07:39:08][Step 1/1]  [1;31mBuild 'virtualbox-iso' errored: Error creating VM: VBoxManage error: VBoxManage: error: Machine settings file '/root/VirtualBox VMs/packer-virtualbox-iso-1444999012/packer-virtualbox-iso-1444999012.vbox' already exists\r\n[07:39:08][Step 1/1] VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component MachineWrap, interface IMachine, callee nsISupports\r\n[07:39:08][Step 1/1] VBoxManage: error: Context: \"CreateMachine(bstrSettingsFile.raw(), bstrName.raw(), ComSafeArrayAsInParam(groups), bstrOsTypeId.raw(), createFlags.raw(), machine.asOutParam())\" at line 272 of file VBoxManageMisc.cpp [0m\r\n[07:39:08][Step 1/1] \r\n[07:39:08][Step 1/1] ==> Some builds didn't complete successfully and had errors:\r\n[07:39:08][Step 1/1] --> virtualbox-iso: Error creating VM: VBoxManage error: VBoxManage: error: Machine settings file '/root/VirtualBox VMs/packer-virtualbox-iso-1444999012/packer-virtualbox-iso-1444999012.vbox' already exists\r\n[07:39:08][Step 1/1] VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component MachineWrap, interface IMachine, callee nsISupports\r\n[07:39:08][Step 1/1] VBoxManage: error: Context: \"CreateMachine(bstrSettingsFile.raw(), bstrName.raw(), ComSafeArrayAsInParam(groups), bstrOsTypeId.raw(), createFlags.raw(), machine.asOutParam())\" at line 272 of file VBoxManageMisc.cpp\r\n[07:39:08][Step 1/1] \r\n[07:39:08][Step 1/1] ==> Builds finished but no artifacts were created.\r\n```"}}