-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VirtualBox's post_manage modifyvm commands triggers session lock errors in non-headless mode #3744
Comments
|
It looks like something in the VirtualBox API between 5.0.x and 5.1.x has changed and broken the ability to run vboxmanage_post steps in packer. As a workaround we've rolled back to VirtualBox 5.0.26 which works fine. |
|
Concerning 5.1 and post manage, I think that it is fair to wait for the 5.1.3, because previous 5.1 had also problems with import that are annoying: https://forums.virtualbox.org/viewtopic.php?f=7&t=78840. But, it would be sad to remove the vboxmanage_post entirely. If you read the original post, it looks like a timing issue due to the GUI lagging to release the session. I don't know the VirtualBox API, but I hope they provide a way to know when the VM is ready to receive manage commands. |
Have to do this in headless mode for now on VirtualBox 5.1.x, since we run into session locking issues otherwise. hashicorp/packer#3744.
|
Just an update for Packer devs. I've reproduced the issue using only VBoxManage commands and created the following VirtualBox bug: https://www.virtualbox.org/ticket/16063. So far, I don't think its a Packer issue unless there is something wrong with the flow of commands being run. i.e. after detaching the dvd drive (or before) is one supposed to do something else before you can modify the vm? |
|
Another update. The VirtualBox 16063 bug is still open and has not been looked at. However, in Packer v0.11.0, the following change:
now allows us to add a custom delay after VM is shutdown and thus allows the modifyvm commands to work correctly. I've tested this using VirtualBox v5.1.8 and Packer v0.11.0 and it works for me. All you need to do is add the following to your vbox builder:
I don't think Oracle are going to look at the 16063 bug and so you may want to close this issue and mark it as solved since the above is a better workaround then running headless. |
|
I'm closing this as there is a workaround implemented in #3952 released in 0.11.0, see the comment above and this is actualy a VirtualBox bug, see 16063. |
* VirtualBox's post_manage modifyvm commands triggers session lock errors in non-headless mode · Issue #3744 · mitchellh/packer * hashicorp/packer#3744 * #16063 (Any immediate "VBoxManage modifyvm" commands after detaching a dvd drive fail with 'The machine 'vm_name' is already locked for a session') – Oracle VM VirtualBox * https://www.virtualbox.org/ticket/16063
also: * add post_shutdown_delay, which fixes hashicorp/packer#3744 * fix URL to openbsd_pkg.py 8 use install60.iso for faster installation
* patch ansible the patch is supposed to allow package names, such as `pkgname%branch` * use post_shutdown_delay to avoid the following error Error executing command: VBoxManage error: VBoxManage: error: The machine 'foo' is already locked for a session (or being unlocked) * replace buggy openbsd_pkg.py with the latest * use installNN.iso which is much faster than downloading sets from remote. older versions are not updated because i do not understand the intention of sticking with cdNN.iso. create a PR first and ask why. * update for OpenBSD 6.0 also: * add post_shutdown_delay, which fixes hashicorp/packer#3744 * fix URL to openbsd_pkg.py 8 use install60.iso for faster installation * install the latest packer that supports post_shutdown_delay * update URL to Debian 9.0 netinst.iso fixes travic CI * update URL to ubuntu-16.04.3-server-amd64.iso
commit 8c999bd Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Wed Aug 16 18:06:08 2017 +0900 [bugfix] add Jenkinsfile (#46) * [bugfix] add Jenkinsfile fixes #41 * ignore vendor * clean box commit 434ae7a Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Mon Aug 14 13:24:03 2017 +0900 [bugfix] add "opt" partition without `nodev` (#44) * [bugfix] in 6.0, installurl is not supported * [bugfix] add "opt" partition without `nodev` fixes #31 * restore pkg.conf in 5.9 * use install59.iso, instead of cd59.iso * add post_shutdown_delay * disklabel is shared by multiple versions commit 6dc3268 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Mon Aug 7 13:55:29 2017 +0900 [bugfix] Patch ansible to support pkgname--%branch in OpenBSD (#43) * patch ansible the patch is supposed to allow package names, such as `pkgname%branch` * use post_shutdown_delay to avoid the following error Error executing command: VBoxManage error: VBoxManage: error: The machine 'foo' is already locked for a session (or being unlocked) * replace buggy openbsd_pkg.py with the latest * use installNN.iso which is much faster than downloading sets from remote. older versions are not updated because i do not understand the intention of sticking with cdNN.iso. create a PR first and ask why. * update for OpenBSD 6.0 also: * add post_shutdown_delay, which fixes hashicorp/packer#3744 * fix URL to openbsd_pkg.py 8 use install60.iso for faster installation * install the latest packer that supports post_shutdown_delay * update URL to Debian 9.0 netinst.iso fixes travic CI * update URL to ubuntu-16.04.3-server-amd64.iso commit 42aa9c1 Merge: 324e636 a8a552a Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Fri Jul 21 16:59:15 2017 +0900 Merge pull request #40 from reallyenglish/merge_upstream Merge upstream commit a8a552a Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Fri Jul 21 16:00:28 2017 +0900 remove another hard-coded code name commit c1c2c9d Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Fri Jul 21 09:57:47 2017 +0900 finish the test implementation there are still some duplicates and the test is not very safe, but work for me. run a single test: ``` bundle exec rake "reallyenglish:spec['openbsd-6.0-amd64']" ``` run all tests: ``` bundle exec rake "reallyenglish:test" ``` commit 8960fa7 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Fri Jul 21 09:53:57 2017 +0900 minor bugfixes commit fe72d70 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Thu Jul 20 20:32:15 2017 +0900 add all platforms that we are using commit 2661360 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Thu Jul 20 20:30:31 2017 +0900 include our modifications to debian 9.0 and improve apt.sh by using $codename commit ac7169b Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Thu Jul 20 20:28:08 2017 +0900 update spec files commit 4b60e99 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Thu Jul 20 20:27:32 2017 +0900 bump version commit d7d33f9 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Thu Jul 20 20:16:38 2017 +0900 restore debian 8.7 commit 458b101 Merge: 324e636 0a04c8c Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Thu Jul 20 16:36:22 2017 +0900 Merge branch 'master' into merge_upstream commit 0a04c8c Merge: a6727e1 35a6999 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Thu Jul 20 16:21:30 2017 +0900 Merge pull request #39 from reallyenglish/upstream/master update master branch to the latest upstream commit 35a6999 Merge: b90a9e0 a6727e1 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Thu Jul 20 16:11:26 2017 +0900 Merge branch 'master' into upstream/master commit 324e636 Merge: 056a519 32f3e68 Author: mitsururike <mitsururike2@gmail.com> Date: Wed Jul 12 14:37:30 2017 +0900 Merge pull request #38 from reallyenglish/issue_36_37 fix #36 #37 commit 32f3e68 Author: Mitsuru Y <mitsuruy@reallyenglish.com> Date: Wed Jul 12 14:17:08 2017 +0900 [bugfix] use virtualbox-ose-additions-nox11 (fixes #36) commit 36f3fec Author: Mitsuru Y <mitsuruy@reallyenglish.com> Date: Wed Jul 12 14:16:04 2017 +0900 use officially announced URLs (fixes #37) commit 9cfc40a Author: Mitsuru Y <mitsuruy@reallyenglish.com> Date: Wed Jul 12 14:15:03 2017 +0900 support https in request_head commit 056a519 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Sat Jul 8 08:18:16 2017 +0900 remove epel-release (#35) fixes #34 commit 86281ab Merge: c5141c2 93970a2 Author: mitsururike <mitsururike2@gmail.com> Date: Thu Jul 6 11:14:41 2017 +0900 Merge pull request #33 from reallyenglish/issue_32 update packages to the latest(Jul 2017) (fixes #32) commit 93970a2 Author: Mitsuru Y <mitsuruy@reallyenglish.com> Date: Wed Jul 5 14:46:24 2017 +0900 merge debian-8.8-amd64.json from the upstream commit e89b616 Author: Mitsuru Y <mitsuruy@reallyenglish.com> Date: Wed Jul 5 14:45:11 2017 +0900 import archlinux-x86_64.json from the upstream commit 36ffbf3 Author: Mitsuru Y <mitsuruy@reallyenglish.com> Date: Wed Jul 5 14:27:07 2017 +0900 update packages to the latest(Jul 2017) (fixes #32) commit b90a9e0 Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Sun Jul 2 11:44:35 2017 +0000 Arch Linux: update to 2017.07.01 ISO commit 409de4c Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Sun Jul 2 11:08:43 2017 +0000 VyOS: create vagrant group and add vagrant user to it commit d2ad887 Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Sun Jul 2 10:30:00 2017 +0000 VyOS: fix the package repository URL commit 03a7d07 Merge: 3f22b16 ec4f5f5 Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Sun Jul 2 11:18:35 2017 +0000 Merge remote-tracking branch 'origin/debian-9.0-amd64' commit ec4f5f5 Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Sun Jul 2 10:17:42 2017 +0000 Debian 9.0: use open-vm-tools instead of vmware tools commit c45e80d Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Sun Jul 2 10:13:49 2017 +0000 Debian 9.0: disable predictable network interface naming commit 4b1c9d6 Author: enderqa <ender.qa@gmx.com> Date: Fri Jun 23 17:55:20 2017 -0500 Debian 9.0 json template and preseed. For building Debian 9. commit a6727e1 Author: enderqa <ender.qa@gmx.com> Date: Mon Jun 19 13:09:42 2017 -0500 Update Debian 8 mirror URL Debian 8 ISO moved to new location. Updated URL. commit 7f9d3bc Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Wed Jun 7 10:08:37 2017 +0900 drop Debian 8.7 as requested in a comment kaorimatz#18 (comment) commit 82a6371 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Sat Jun 3 08:08:22 2017 +0900 update iso_checksum commit cad7375 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Fri Jun 2 18:28:01 2017 +0900 use mirror commit 393ba5e Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Fri Jun 2 18:17:40 2017 +0900 another iso_url fix commit 295dcd1 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Fri Jun 2 18:15:04 2017 +0900 update archlinux iso_url commit 0bbf68c Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Fri Jun 2 15:04:23 2017 +0900 introduce Debian 8.8 commit 3f22b16 Merge: 99f01c3 d1ba12f Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Tue Jun 20 10:21:20 2017 +0900 Merge pull request #20 from enderqa/fix_debian8_url Update Debian 8 mirror URL commit d1ba12f Author: enderqa <ender.qa@gmx.com> Date: Mon Jun 19 13:09:42 2017 -0500 Update Debian 8 mirror URL Debian 8 ISO moved to new location. Updated URL. commit 99f01c3 Merge: d676f61 d782599 Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Sat Jun 10 16:29:26 2017 +0900 Merge pull request #18 from reallyenglish/debian_8.8 introduce Debian 8.8 commit c5141c2 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Wed Jun 7 15:13:51 2017 +0700 add examples for OpenBSD (#27) * add examples for openbsd * fix incorrect hash structure it should be in "symlink" => "file" style commit 6e69eb7 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Wed Jun 7 09:37:13 2017 +0700 Merge debian 8.8 (#25) * introduce Debian 8.8 * add local modification * use SCSI #24 (review) * do not wait in GRUB menu #24 (comment) * update archlinux iso_url * another iso_url fix * use mirror * use mirror * update iso_checksum commit d782599 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Wed Jun 7 10:08:37 2017 +0900 drop Debian 8.7 as requested in a comment kaorimatz#18 (comment) commit 8092830 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Tue Jun 6 12:40:47 2017 +0700 Add our own specs (#26) * very first implementation of our own specs * tidy up * create `clean` target and run it before `build` to ensure the test VMs are properly created * the `apt` configuration is only for 16.04 * remove unused code block commit 29f9ecd Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Sat Jun 3 08:08:22 2017 +0900 update iso_checksum commit f7c94e8 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Fri Jun 2 16:34:07 2017 +0700 Merge debian 8.8 branch (#24) * introduce Debian 8.8 * add local modification * use SCSI #24 (review) * do not wait in GRUB menu #24 (comment) * update archlinux iso_url * another iso_url fix * use mirror commit 3477120 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Fri Jun 2 18:28:01 2017 +0900 use mirror commit ef88c69 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Fri Jun 2 18:17:40 2017 +0900 another iso_url fix commit d2af7a1 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Fri Jun 2 18:15:04 2017 +0900 update archlinux iso_url commit 4ac9b59 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Fri Jun 2 15:04:23 2017 +0900 introduce Debian 8.8 commit 6d2535e Merge: d21708e a4ccabf Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Fri Jun 2 11:59:54 2017 +0700 Merge pull request #22 from reallyenglish/merge_upstream Merge upstream commit a4ccabf Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Fri Jun 2 12:48:23 2017 +0900 restore 5.9, which has been renamed in upstream commit d417953 Merge: d21708e f5a3f09 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Fri Jun 2 12:47:54 2017 +0900 Merge branch 'master' into merge_upstream commit f5a3f09 Merge: 4e1e89b d676f61 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Fri Jun 2 12:24:58 2017 +0900 Merge remote-tracking branch 'upstream/master' commit d21708e Merge: 9160011 b5e8b72 Author: mitsururike <mitsururike2@gmail.com> Date: Tue May 16 11:26:57 2017 +0900 Merge pull request #19 from reallyenglish/improve_performance_and_boot_time Improve performance and boot time commit b5e8b72 Author: Mitsuru Y <mitsuruy@reallyenglish.com> Date: Mon May 15 17:49:40 2017 +0900 [bugfix] set boot timeout (fixes #18) commit b4971fd Author: Mitsuru Y <mitsuruy@reallyenglish.com> Date: Mon May 15 13:17:55 2017 +0900 [bugfix] fix checksum mismatch; update to 14.04.5 commit 53f1ca4 Author: Mitsuru Y <mitsuruy@reallyenglish.com> Date: Fri May 12 17:39:53 2017 +0900 [bugfix] fix checksum mismatch; update to 16.04.2 commit 170d5c4 Author: Mitsuru Y <mitsuruy@reallyenglish.com> Date: Fri May 12 17:39:10 2017 +0900 [bugfix] ftp.jaist.ac.jp does not have older than 6.0 commit ab4721b Author: Mitsuru Y <mitsuruy@reallyenglish.com> Date: Fri May 12 17:37:54 2017 +0900 [bugfix] use scsi interface (fixes #17) commit d676f61 Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Sat Apr 22 09:10:18 2017 +0000 OpenBSD 6.1: always use the first line of ftplist.cgi for default answer commit 6a5b5b9 Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Sat Apr 22 09:11:51 2017 +0000 OpenBSD 5.9 has reached EOS commit ecf7ca2 Merge: 20cb9e3 a074798 Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Sat Apr 22 18:09:02 2017 +0900 Merge pull request #17 from tvlooy/openbsd-6.1-amd64-virtualbox Add OpenBSD 6.1 amd64 VirtualBox commit a074798 Author: Tom Van Looy <tom@ctors.net> Date: Wed Apr 19 21:18:57 2017 +0200 Add OpenBSD 6.1 amd64 VirtualBox commit 20cb9e3 Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Tue Apr 18 23:48:09 2017 +0000 CentOS 5 has reached EOL commit 2495fa9 Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Sat Apr 15 02:35:37 2017 +0000 Add a template for Ubuntu 17.04 (amd64) commit 5bc54b9 Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Sat Apr 15 02:27:27 2017 +0000 CentOS: update 6.8 to 6.9 commit 3af2cba Merge: 429a07b a8e10ea Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Tue Apr 18 07:51:27 2017 +0900 Merge pull request #16 from KeyboardInterrupt/master Upgrades epel repository to version 7.9 commit a8e10ea Author: Christian Stein <keyboard_github@ham5ter.de> Date: Mon Apr 17 19:17:07 2017 +0200 Upgrades epel repository to version 7.9 This Url is no longer available (404) https://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm This Url works: https://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm commit 9160011 Merge: 98daab7 9e7bb64 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Thu Apr 6 15:33:57 2017 +0900 Merge pull request #16 from reallyenglish/patch_ansible_2.2.2.0 [bugfix] patch ansible 2.2.2.0 commit 9e7bb64 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Thu Apr 6 13:53:57 2017 +0900 patch ansible 2.2.2.0 there are two issues. `pkg(8)` schema on VMs needs to be updated[1]. this can be solved by symply rebuilding the box image. otherwise, you have to workaround on every FreeBSD VMs. however, `sysutils/ansible` has been updated to broken version[2] just before regular package update in the official package repository, which means we have to wait another quarterly update, switch to a different branch, or patch the broken version. the last option was chosen due to minimum impact to the build script. [1] reallyenglish/ansible-role-jenkins-master@0bde6b3 [2] ansible/ansible#23016 commit 429a07b Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Sat Apr 1 03:28:37 2017 +0000 Ubuntu: fix tests commit 75efec3 Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Sat Apr 1 02:54:25 2017 +0000 Arch Linux: wait a bit longer for shell prompt commit ccfe746 Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Sat Apr 1 01:28:26 2017 +0000 Ubuntu 16.04: update to 16.04.2 ISO commit c10dbba Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Sat Apr 1 01:25:57 2017 +0000 Ubuntu 14.04: update to 14.04.5 ISO commit 85e6856 Author: Satoshi Matsumoto <kaorimatz@gmail.com> Date: Sat Apr 1 01:16:37 2017 +0000 Arch Linux: update to 2017.03.01 ISO commit 98daab7 Author: Ochko <ochkoo@gmail.com> Date: Thu Feb 2 14:39:20 2017 +0900 add OpenBSD 5.6 (#15) * add OpenBSD 5.6 commit 5c6c9d9 Author: Tomoyuki Sakurai <tomoyukis@reallyenglish.com> Date: Wed Feb 1 07:13:40 2017 +0700 include apt.sh (#14) fixes #13
Trying to create a VirtualBox ovf from an ISO ;
I issue modifyVM commands in post_manage section and I get errors:
Locked session does NOT happen if:
Also note this trace from the end of the VirtualBox log:
This is what leads me to try using the headless mode. Maybe Packer rely on the machine to be shutdown to send modifyvm commands, but it may not be the right signal. There might be other way to know when VirtualBox is ready to accept modifyvm commands? (pure speculation)
For reference:
The text was updated successfully, but these errors were encountered: