There was a fix in #3952, but it looks like people are still having issues. There've been some comments in #2401
There working theory is that were just need to wait a while for the controller to detach, and that the current delay is either not long enough or incorrectly implemented. We should either up the default timeout to sleep indefinitely/up to some really long timeout until the controller is free.
Some users have reported seeing the issue with the following config:
"post_shutdown_delay": "180s",
"shutdown_timeout": "1h",
Still need a json that will reproduce this reliably
@mwhooker just a thought in passing, I wonder if there would be some way to extend VirtualBox to have a function to check for the controller status / whether it has detached?
For some reason setting post_shutdown_delay https://github.com/StefanScherer/packer-windows/commit/751c8fe7f0a2be9f688ee42fb286bc5e06b0bfb9 helped after several errornous build. On Win7 with packer 0.12.0 and VirtualBox 5.1.12.
Maybe I just had luck.
This is definitely a VirtualBox issue, see https://www.virtualbox.org/ticket/16063
I think @rickard-von-essen was spot on with that comment. I've reproduced the scripts at that link but for a floppy and floppy controller. These allow you to simply reproduce the errors with Virtualbox directly rather than having to go through Packer. Additionally I've found a few more ways to avoid the error. See the scripts here.
Host: OS X 10.11.6
Virtualbox: 5.1.14r112924
I think introducing a simple pause here would work for the floppy/floppy controller problems in some situations. However, I think that wrapping a retry around the device removal step is ultimately the more robust option.
@StefanScherer adding the post_shutdown_delay helped me too.
Hi,
After 3 fails in a row, adding "post_shutdown_delay": "100s" gave me to two successful builds in a row.
Give that a try.
Host: Arch Linux (4.10.1-1-ARCH kernel)
Guest: CentOs 7.x
Virtualbox: 5.1.16r113841
Packer: 0.12.3
Hope it helps,
Andrea
Why was this issue closed?
It seems that the root cause was never really fixed properly in packer because today (with VirtualBox 6.0.14; and without setting "post_shutdown_delay": "2m") I've started having these errors removing the guest additions iso:
2019/10/27 09:16:08 packer.exe: 2019/10/27 09:16:08 [ERROR] Remote command exited without exit status or exit signal.
2019/10/27 09:16:08 ui error: [1;31m==> ubuntu-18.04-amd64-virtualbox: [sudo] password for vagrant:[0m
2019/10/27 09:16:08 packer.exe: 2019/10/27 09:16:08 Waiting max 5m0s for shutdown to complete
2019/10/27 09:16:09 packer.exe: 2019/10/27 09:16:09 VM shut down.
2019/10/27 09:16:09 packer.exe: 2019/10/27 09:16:09 Executing VBoxManage: []string{"storageattach", "packer-ubuntu-18.04-amd64-virtualbox-1572167140", "--storagectl", "IDE Controller", "--port", "0", "--device", "1", "--medium", "none"}
2019/10/27 09:16:09 packer.exe: 2019/10/27 09:16:09 stdout:
2019/10/27 09:16:09 packer.exe: 2019/10/27 09:16:09 stderr: VBoxManage.exe: error: Failed to get a console object from the direct session (VBOX_E_INVALID_OBJECT_STATE)
2019/10/27 09:16:09 packer.exe: VBoxManage.exe: error: Details: code VBOX_E_VM_ERROR (0x80bb0003), component MachineWrap, interface IMachine, callee IUnknown
2019/10/27 09:16:09 packer.exe: VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Shared)" at line 336 of file VBoxManageStorageController.cpp
2019/10/27 09:16:09 ui error: [1;31m==> ubuntu-18.04-amd64-virtualbox: Error detaching ISO: VBoxManage error: VBoxManage.exe: error: Failed to get a console object from the direct session (VBOX_E_INVALID_OBJECT_STATE)
==> ubuntu-18.04-amd64-virtualbox: VBoxManage.exe: error: Details: code VBOX_E_VM_ERROR (0x80bb0003), component MachineWrap, interface IMachine, callee IUnknown
==> ubuntu-18.04-amd64-virtualbox: VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Shared)" at line 336 of file VBoxManageStorageController.cpp[0m
2019/10/27 09:16:09 ui error: [1;31m==> ubuntu-18.04-amd64-virtualbox: Error detaching ISO: VBoxManage error: VBoxManage.exe: error: Failed to get a console object from the direct session (VBOX_E_INVALID_OBJECT_STATE)
==> ubuntu-18.04-amd64-virtualbox: VBoxManage.exe: error: Details: code VBOX_E_VM_ERROR (0x80bb0003), component MachineWrap, interface IMachine, callee IUnknown
==> ubuntu-18.04-amd64-virtualbox: VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Shared)" at line 336 of file VBoxManageStorageController.cpp[0m
2019/10/27 09:16:09 ui error: [1;31m==> ubuntu-18.04-amd64-virtualbox: Step "StepRemoveDevices" failed, aborting...[0m
Should this issue be re-open or a new one created?
Hi, making a new one with a link to the old one is the most helpful after this much time as passed. Thanks!!
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.