{"action":"created","issue":{"url":"https://api.github.com/repos/mitchellh/packer/issues/2401","labels_url":"https://api.github.com/repos/mitchellh/packer/issues/2401/labels{/name}","comments_url":"https://api.github.com/repos/mitchellh/packer/issues/2401/comments","events_url":"https://api.github.com/repos/mitchellh/packer/issues/2401/events","html_url":"https://github.com/mitchellh/packer/issues/2401","id":93465477,"number":2401,"title":"Error removing floppy controller","user":{"login":"mealingr","id":6968527,"avatar_url":"https://avatars.githubusercontent.com/u/6968527?v=3","gravatar_id":"","url":"https://api.github.com/users/mealingr","html_url":"https://github.com/mealingr","followers_url":"https://api.github.com/users/mealingr/followers","following_url":"https://api.github.com/users/mealingr/following{/other_user}","gists_url":"https://api.github.com/users/mealingr/gists{/gist_id}","starred_url":"https://api.github.com/users/mealingr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mealingr/subscriptions","organizations_url":"https://api.github.com/users/mealingr/orgs","repos_url":"https://api.github.com/users/mealingr/repos","events_url":"https://api.github.com/users/mealingr/events{/privacy}","received_events_url":"https://api.github.com/users/mealingr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mitchellh/packer/labels/bug","name":"bug","color":"f7c6c7"},{"url":"https://api.github.com/repos/mitchellh/packer/labels/builder/virtualbox","name":"builder/virtualbox","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2015-07-07T07:56:54Z","updated_at":"2016-01-28T14:24:10Z","closed_at":null,"body":"Hi all,\r\n\r\nAt the end of a packer build, just before the post-processor (vagrant) is started, packer fails to remove the floppy drive. \r\n\r\nThe exact error is:\r\n\r\n```\r\nvirtualbox-iso: Error removing floppy controller: VBoxManage error: VBoxMana\r\nge.exe: error: The machine 'packer-virtualbox-iso-1436168056' is already locked\r\nfor a session (or being unlocked)\r\n==> virtualbox-iso: VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_S\r\nTATE (0x80bb0007), component Machine, interface IMachine, callee IUnknown\r\n==> virtualbox-iso: VBoxManage.exe: error: Context: \"LockMachine(a->session, Loc\r\nkType_Write)\" at line 1011 of file VBoxManageStorageController.cpp\r\n==> virtualbox-iso: Unregistering and deleting virtual machine...\r\n==> virtualbox-iso: Deleting output directory...\r\nBuild 'virtualbox-iso' errored: Error removing floppy controller: VBoxManage err\r\nor: VBoxManage.exe: error: The machine 'packer-virtualbox-iso-1436168056' is alr\r\neady locked for a session (or being unlocked)\r\nVBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), c\r\nomponent Machine, interface IMachine, callee IUnknown\r\nVBoxManage.exe: error: Context: \"LockMachine(a->session, LockType_Write)\" at lin\r\ne 1011 of file VBoxManageStorageController.cpp\r\n\r\n==> Some builds didn't complete successfully and had errors:\r\n--> virtualbox-iso: Error removing floppy controller: VBoxManage error: VBoxMana\r\nge.exe: error: The machine 'packer-virtualbox-iso-1436168056' is already locked\r\nfor a session (or being unlocked)\r\nVBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), c\r\nomponent Machine, interface IMachine, callee IUnknown\r\nVBoxManage.exe: error: Context: \"LockMachine(a->session, LockType_Write)\" at lin\r\ne 1011 of file VBoxManageStorageController.cpp\r\n\r\n==> Builds finished but no artifacts were created.\r\n\r\nThe 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.\r\n\r\nMy packer json is:\r\n\r\n{\r\n  \"builders\": [\r\n    {\r\n      \"type\": \"virtualbox-iso\",\r\n      \"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\",\r\n      \"iso_checksum_type\": \"md5\",\r\n      \"iso_checksum\": \"458ff91f8abc21b75cb544744bf92e6a\",\r\n      \"headless\": false,\r\n      \"boot_wait\": \"2m\",\r\n      \"ssh_username\": \"vagrant\",\r\n      \"ssh_password\": \"vagrant\",\r\n      \"ssh_wait_timeout\": \"4h\",\r\n      \"shutdown_command\": \"shutdown /s /t 10 /f /d p:4:1 /c \\\"Packer Shutdown\\\"\",\r\n      \"guest_os_type\": \"Windows2012_64\",\r\n      \"disk_size\": 61440,\r\n      \"floppy_files\": [\r\n        \"./floppy_files/Autounattend.xml\",\r\n        \"./floppy_files/microsoft-updates.bat\",\r\n        \"./floppy_files/win-updates.ps1\",\r\n        \"./floppy_files/openssh.ps1\",\r\n        \"./floppy_files/oracle-cert.cer\",\r\n\t\t\"./floppy_files/setenv.bat\",\r\n\t\t\"./floppy_files/setdnssuffix.wsf\",\r\n\t\t\"./floppy_files/hosts\"\r\n      ],\r\n      \"vboxmanage\": [\r\n        [\r\n          \"modifyvm\",\r\n          \"{{.Name}}\",\r\n          \"--memory\",\r\n          \"2048\"\r\n        ],\r\n        [\r\n          \"modifyvm\",\r\n          \"{{.Name}}\",\r\n          \"--cpus\",\r\n          \"2\"\r\n        ]\r\n      ]\r\n    }\r\n  ],\r\n  \"provisioners\": [\r\n    {\r\n      \"type\": \"shell\",\r\n      \"remote_path\": \"/tmp/script.bat\",\r\n      \"execute_command\": \"{{.Vars}} cmd /c C:/Windows/Temp/script.bat\",\r\n      \"scripts\": [\r\n        \"./packer_scripts/vm-guest-tools.bat\",\r\n        \"./packer_scripts/vagrant-ssh.bat\",\r\n        \"./packer_scripts/enable-rdp.bat\",\r\n        \"./packer_scripts/disable-auto-logon.bat\",\r\n\t\t\"./packer_scripts/chef.bat\",\r\n\t\t\"./packer_scripts/chocolatey.bat\",\r\n\t\t\"./packer_scripts/chocopacks.bat\",\r\n\t\t\"./packer_scripts/tomcat6.bat\",\r\n\t\t\"./packer_scripts/copyHosts.bat\",\r\n\t\t\"./packer_scripts/setdnssuffix.bat\",\r\n\t\t\"./packer_scripts/setPerlPath.bat\"\r\n      ]\r\n    },\r\n    {\r\n      \"type\": \"shell\",\r\n      \"inline\": [\r\n        \"rm -rf /tmp/*\"\r\n      ]\r\n    }\r\n  ],\r\n  \"post-processors\": [\r\n    {\r\n      \"type\": \"vagrant\",\r\n      \"keep_input_artifact\": false,\r\n      \"output\": \"windows_2012_r2_{{.Provider}}.box\",\r\n      \"vagrantfile_template\": \"vagrantfile-windows_2012_r2.template\"\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\nAny idea how to fix this?\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/mitchellh/packer/issues/comments/176205881","html_url":"https://github.com/mitchellh/packer/issues/2401#issuecomment-176205881","issue_url":"https://api.github.com/repos/mitchellh/packer/issues/2401","id":176205881,"user":{"login":"rickard-von-essen","id":557699,"avatar_url":"https://avatars.githubusercontent.com/u/557699?v=3","gravatar_id":"","url":"https://api.github.com/users/rickard-von-essen","html_url":"https://github.com/rickard-von-essen","followers_url":"https://api.github.com/users/rickard-von-essen/followers","following_url":"https://api.github.com/users/rickard-von-essen/following{/other_user}","gists_url":"https://api.github.com/users/rickard-von-essen/gists{/gist_id}","starred_url":"https://api.github.com/users/rickard-von-essen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rickard-von-essen/subscriptions","organizations_url":"https://api.github.com/users/rickard-von-essen/orgs","repos_url":"https://api.github.com/users/rickard-von-essen/repos","events_url":"https://api.github.com/users/rickard-von-essen/events{/privacy}","received_events_url":"https://api.github.com/users/rickard-von-essen/received_events","type":"User","site_admin":false},"created_at":"2016-01-28T14:24:10Z","updated_at":"2016-01-28T14:24:10Z","body":"@chocolatewheelchair That's a great hint. Speculating a bit but since this only happens with Windows guests it might be that Windows is really slow shutting down and don't finish within the default ```5m``` shutdown timeout. Then VirtualBox try to remove the floppy before the machine is properly shut down. \r\n\r\nIt would be awesome if someone who get this problem allot can verify that increasing ```shutdown_timeout``` to say ```1h``` resolves this?"}}