Skip to content

Error removing floppy controller #2401

@mealingr

Description

@mealingr

Hi all,

At the end of a packer build, just before the post-processor (vagrant) is started, packer fails to remove the floppy drive.

The exact error is:

virtualbox-iso: Error removing floppy controller: VBoxManage error: VBoxMana
ge.exe: error: The machine 'packer-virtualbox-iso-1436168056' is already locked
for a session (or being unlocked)
==> virtualbox-iso: VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_S
TATE (0x80bb0007), component Machine, interface IMachine, callee IUnknown
==> virtualbox-iso: VBoxManage.exe: error: Context: "LockMachine(a->session, Loc
kType_Write)" at line 1011 of file VBoxManageStorageController.cpp
==> virtualbox-iso: Unregistering and deleting virtual machine...
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Error removing floppy controller: VBoxManage err
or: VBoxManage.exe: error: The machine 'packer-virtualbox-iso-1436168056' is alr
eady locked for a session (or being unlocked)
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), c
omponent Machine, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at lin
e 1011 of file VBoxManageStorageController.cpp

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: Error removing floppy controller: VBoxManage error: VBoxMana
ge.exe: error: The machine 'packer-virtualbox-iso-1436168056' is already locked
for a session (or being unlocked)
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), c
omponent Machine, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at lin
e 1011 of file VBoxManageStorageController.cpp

==> Builds finished but no artifacts were created.

The strange thing is the error only happens about 50% of the time. Typically the first build will fail with this error and then the next build will succeed with nothing changed in between.

My packer json is:

{
  "builders": [
    {
      "type": "virtualbox-iso",
      "iso_url": "http://download.microsoft.com/download/6/2/A/62A76ABB-9990-4EFC-A4FE-C7D698DAEB96/9600.16384.WINBLUE_RTM.130821-1623_X64FRE_SERVER_EVAL_EN-US-IRM_SSS_X64FREE_EN-US_DV5.ISO",
      "iso_checksum_type": "md5",
      "iso_checksum": "458ff91f8abc21b75cb544744bf92e6a",
      "headless": false,
      "boot_wait": "2m",
      "ssh_username": "vagrant",
      "ssh_password": "vagrant",
      "ssh_wait_timeout": "4h",
      "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
      "guest_os_type": "Windows2012_64",
      "disk_size": 61440,
      "floppy_files": [
        "./floppy_files/Autounattend.xml",
        "./floppy_files/microsoft-updates.bat",
        "./floppy_files/win-updates.ps1",
        "./floppy_files/openssh.ps1",
        "./floppy_files/oracle-cert.cer",
        "./floppy_files/setenv.bat",
        "./floppy_files/setdnssuffix.wsf",
        "./floppy_files/hosts"
      ],
      "vboxmanage": [
        [
          "modifyvm",
          "{{.Name}}",
          "--memory",
          "2048"
        ],
        [
          "modifyvm",
          "{{.Name}}",
          "--cpus",
          "2"
        ]
      ]
    }
  ],
  "provisioners": [
    {
      "type": "shell",
      "remote_path": "/tmp/script.bat",
      "execute_command": "{{.Vars}} cmd /c C:/Windows/Temp/script.bat",
      "scripts": [
        "./packer_scripts/vm-guest-tools.bat",
        "./packer_scripts/vagrant-ssh.bat",
        "./packer_scripts/enable-rdp.bat",
        "./packer_scripts/disable-auto-logon.bat",
        "./packer_scripts/chef.bat",
        "./packer_scripts/chocolatey.bat",
        "./packer_scripts/chocopacks.bat",
        "./packer_scripts/tomcat6.bat",
        "./packer_scripts/copyHosts.bat",
        "./packer_scripts/setdnssuffix.bat",
        "./packer_scripts/setPerlPath.bat"
      ]
    },
    {
      "type": "shell",
      "inline": [
        "rm -rf /tmp/*"
      ]
    }
  ],
  "post-processors": [
    {
      "type": "vagrant",
      "keep_input_artifact": false,
      "output": "windows_2012_r2_{{.Provider}}.box",
      "vagrantfile_template": "vagrantfile-windows_2012_r2.template"
    }
  ]
}

Any idea how to fix this?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions