Packer: Floppy disk doesn't removed after Packer interrupted

Created on 12 Mar 2019  ยท  13Comments  ยท  Source: hashicorp/packer

Info:

Floppy disk (not controller) doesn't removed after Packer interrupted with Ctrl+C. See the tail of the mentioned above log.

Reproduction:

$ packer build template.json
// Let it boot.
// Ctrl+C
$ vboxmanage list floppies
buildevirtualbox wontfix

All 13 comments

Hi @nick-korsakov, thanks for opening, could you please update your debug output by running packer with PACKER_LOG=1 set in your env first please ? It worked for me locally ( mac os ).

$ PACKER_LOG=1 packer build -force file.json
2019-03-13T15:59:16+01:00: ==> virtualbox-iso: Deregistering and deleting VM...
2019/03/13 15:59:16 checkpoint: 2019/03/13 15:59:16 Executing VBoxManage: []string{"unregistervm", "packer-virtualbox-iso-1552489135", "--delete"}
2019/03/13 15:59:16 checkpoint: 2019/03/13 15:59:16 stdout:
2019/03/13 15:59:16 checkpoint: 2019/03/13 15:59:16 stderr: VBoxManage: error: Cannot unregister the machine 'packer-virtualbox-iso-1552489135' while it is locked
2019/03/13 15:59:16 checkpoint: VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee nsISupports
2019/03/13 15:59:16 checkpoint: VBoxManage: error: Context: "Unregister(CleanupMode_DetachAllReturnHardDisksOnly, ComSafeArrayAsOutParam(aMedia))" at line 157 of file VBoxManageMisc.cpp
2019/03/13 15:59:17 checkpoint: 2019/03/13 15:59:17 Executing VBoxManage: []string{"unregistervm", "packer-virtualbox-iso-1552489135", "--delete"}
2019/03/13 15:59:17 checkpoint: 2019/03/13 15:59:17 stdout:
2019/03/13 15:59:17 checkpoint: 2019/03/13 15:59:17 stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
2019/03/13 15:59:17 checkpoint: 2019/03/13 15:59:17 Deleting floppy disk: /var/folders/3k/2gb5ct4s7cncr52_jh2kz6cw0000gq/T/packer462444275
2019-03-13T15:59:17+01:00: ==> virtualbox-iso: Deleting output directory...
$ vboxmanage list floppies     

$

...could you please update your debug output by running packer with PACKER_LOG=1 set in your env first please ?...

Hi @azr! Done.

P.S.: Debug output was missed due to WSL inability to pass environment variable PACKER_LOG=1 from Linux to Windows when I ran it as $ PACKER_LOG=1 packer.exe build template.json.

Howdy, thanks for the update, the os.Remove probably failed but the error was not being displayed by the code.

Could you please run it again from this pr #7405 ?

Here's a windows binary in case: packer_windows_amd64.zip

Could you please run it again from this pr #7405 ?

Ctrl+C doesn't work on this build and I can't interrupt Packer to reproduce the error.

Hello @nick-korsakov, ah sorry a recent unrelated change broke this, I am glad we saw this, now it should be better :

windows_amd64.zip

Hello @azr! The output updated.

Okay, thanks for sharing, after some debugging it seems like the code will try to remove the physical location of the floppy disk and on windows, this doesn't count as an unmount. I'm still on it.

Hey @nick-korsakov, could you please tell me what's a command to detach the floppy disk that worked for you?

Currently, packer tries to run

vboxmanage "storageattach" $vmName "--storagectl" "Floppy Controller" "--port" "0" "--device" "0" "--medium" "none"

Hey @azr, this command helped me to detach floppy disk from vm but I need it to be deleted.

C:\Users\user>vboxmanage storageattach packer-virtualbox-iso-1553184662 --storagectl "Floppy Controller" --port 0 --devi
ce 0 --medium none

C:\Users\user>vboxmanage list floppies
UUID:           e8b6b4b4-32fd-4d2d-80d1-30a32b251e21
State:          inaccessible
Type:           writethrough
Location:       C:\Users\user\AppData\Local\Temp\virtualbox782300642\floppy.vfd
Storage format: RAW
Capacity:       0 MBytes
Encryption:     disabled

And, is the file still present at C:\Users\user\AppData\Local\Temp\virtualbox782300642\floppy.vfd ?

And, is the file still present at C:\Users\user\AppData\Local\Temp\virtualbox782300642\floppy.vfd ?

@azr, No. Even "C:UsersuserAppDataLocalTempvirtualbox782300642" folder doesn't exists. But floppy still registered (see vboxmanage list floppies output above).

Could you reproduce this bug on Windows 10 if you have a opportunity?

Hey @nick-korsakov, so I could repro on windows but I think packer can't do anything about this.
The floppy is detached from the vm and the file is removed but the vboxmanage list floppies will still list that floppy until windows is restarted. This tells me the issue _probably_ has something to do with caching on vbox'es side. I'm going to close that issue for now but please feel free to open a PR if you can think of a better solution. Thanks for your time !

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

craigsimon picture craigsimon  ยท  3Comments

wduncanfraser picture wduncanfraser  ยท  3Comments

shashanksinha89 picture shashanksinha89  ยท  3Comments

shantanugadgil picture shantanugadgil  ยท  3Comments

sourav82 picture sourav82  ยท  3Comments