When building a Windows based Packer box, uploading the virtualbox additions over WinRM frequently fails. To work around this you can either download the ISO from a network/internet location from within the VM, or you can choose the attach option. Using attach adds a second virtual optical drive in addition to the drive where the OS is being installed from, and when the packaging is complete one optical drive remains attached rather than zero. If Packer operated correctly I would expect undoing the addition of the installer ISO AND the tools ISO.
This occurs using mwrock/packer-templates and boxcutter/windows and using the attach option.
This is related to #3121 but this describes the root issue, while that describes a warning upon attempting a workaround.
Thanks for the report. I'm guessing we need to track the state for the guest_additions ISO so we can remove it during the cleanup phase (or maybe the state is there but the cleanup logic is missing).
As a workaround I have found that adding this to the template removes the drive:
"vboxmanage_post": [
[ "storageattach", "{{.Name}}", "--storagectl", "IDE Controller", "--port", "1", "--device", "0", "--medium", "none" ]
],
Has this been fixed in the latest version of Packer? Having recently been bitten by the WinRM 500 error I've switched to the attach method. However, I'm not seeing this - for me the resulting box is fine and has a single, empty optical drive.
If a fix hasn't been put in place, I was wondering if the issue is only occurring with a specific version of Virtualbox. If so, that might help to narrow down the error and find a fix.
My info:
Packer version: v0.12.1.dev
Host platform: Mac OS X 10.11.6
Virtualbox: 5.0.26
When building a Windows based Packer box, uploading the virtualbox additions over WinRM frequently fails.
My understanding is that this is due to some problems with the upstream WinRM Go library that Packer makes use of. While this issue persists it would be _really useful_ if there was a note in the Packer docs acknowledging the general WinRM reliability problems.
It would also be good to recommend use of the 'attach' mode over 'upload' for the Guest Additions. This would save wasting _a lot_ of CPU cycles installing Windows Updates, only to have the build fail at the next stage when uploading the Guest Additions ISO. Cumulatively, I figure this small change may save a polar bear or two from having their home melt beneath them. Of course, the issue will need to be worked around a different way for VMware builds since there is no attach mode...
I think we need to remove this in builder/virtualbox/common/step_remove_devices.go
. Should be straight forward, just needs to be tested
Most helpful comment
I think we need to remove this in
builder/virtualbox/common/step_remove_devices.go
. Should be straight forward, just needs to be tested