VBoxManage: error: The machine 'vb-fedora-24-np' is already locked for a session (or being unlocked)

565 views
Skip to first unread message

Bruno Vernay

unread,
Jul 22, 2016, 1:24:41 PM7/22/16
to Packer
Seems to appear at random.
I put the logs maybe I should open an issue? 
It looks like similar errors already happened in the past

==> vb-fedora-24-np: Gracefully halting virtual machine...
==> vb-fedora-24-np: Executing custom VBoxManage commands...
    vb-fedora-24-np: Executing: modifyvm vb-fedora-24-np --cableconnected1 on
==> vb-fedora-24-np: Error executing command: VBoxManage error: VBoxManage: error: The machine 'vb-fedora-24-np' is already locked for a session (or being unlocked)
==> vb-fedora-24-np: VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee nsISupports
==> vb-fedora-24-np: VBoxManage: error: Context: "LockMachine(a->session, LockType_Write)" at line 506 of file VBoxManageModifyVM.cpp
==> vb-fedora-24-np: Unregistering and deleting virtual machine...
==> vb-fedora-24-np: Deleting output directory...
Build 'vb-fedora-24-np' errored: Error executing command: VBoxManage error: VBoxManage: error: The machine 'vb-fedora-24-np' is already locked for a session (or being unlocked)
VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee nsISupports
VBoxManage: error: Context: "LockMachine(a->session, LockType_Write)" at line 506 of file VBoxManageModifyVM.cpp

packer-log_2016-07-22_19h12.txt
vb-fedora-24-np.json

Bruno Vernay

unread,
Jul 22, 2016, 5:20:53 PM7/22/16
to Packer
Maybe this issue is linked to some SELinux problem ...
If I set SELinux to permissive I don't have the "lock" problem.

I can se this in the logs:
type=ANOM_PROMISCUOUS msg=audit(1469221989.297:573): dev=vboxnet0 prom=0 old_prom=256 auid=1000 uid=1000 gid=100 ses=1

Any idea?  Google does not brings much results ...
At least it should not be linked to Packer, only the cable are still disconnected ...

Bruno Vernay

unread,
Jul 22, 2016, 6:54:41 PM7/22/16
to Packer
Now if I set --nicpromisc1 allow-all 
I can run with SELinux enforced ...

But the cable is still not connected

Alvaro Miranda Aguilera

unread,
Jul 22, 2016, 7:49:57 PM7/22/16
to packe...@googlegroups.com
seems more a question for VirtualBox guys. Perhaps you can open a ticket with them?

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/e3ab46e3-6124-444c-a06f-12f566b894ea%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Bruno Vernay

unread,
Jul 23, 2016, 8:56:23 AM7/23/16
to Packer
Yes, I guess I should do that also, but it is strange.
If I issue the VBoxManage commands from the command line, after exporting the machine, it works.
But if I use the vboxmanage_post it fails as if a session was still open.
But the VM is supposed to be stopped when post commands are runs right? I should be able to change the machines settings?

Bruno Vernay

unread,
Jul 23, 2016, 9:26:15 AM7/23/16
to Packer
Funny this is that if I run "guestcontrol list sessions", it says there are no sessions
==> vb-fedora-24-np: Executing custom VBoxManage commands...
    vb-fedora-24-np: Executing: guestcontrol vb-fedora-24-np list sessions --verbose
==> vb-fedora-24-np: Error executing command: VBoxManage error: VBoxManage: error: Machine "vb-fedora-24-np" is not running (currently powered off)!

But if I run another command, it says it is locked by another session ...

At least it is interesting to run    
 "vboxmanage_post": [
      ["showvminfo", "{{.Name}}", "--details"],
and see the results in the logs, as an intermediate step.

I will post a follow up if I find something on VirtualBox forums ....
2016-07-23_13h38_packer.txt

Bruno Vernay

unread,
Jul 23, 2016, 9:51:27 AM7/23/16
to Packer
Sorry, but I am getting excited: if I run step by step with --debug ... there are no errors.
So it might be a timing issue.  If Packer could introduce a short delay or a retry or if there was some kind of synchronous call that could asset that the Machine i ready to accept commands, that would be great !!!
So should I fill a Request For Enhancement in Packer after all ???

Bruno Vernay

unread,
Jul 23, 2016, 5:12:12 PM7/23/16
to Packer
I tried on the VirtualBox forum  https://forums.virtualbox.org/viewtopic.php?f=7&t=78830
But they claim the issue is on Packer side :-)

As for me running headless solved my issue. I though about it reading the last line in VirtualBox logs:
00:05:21.112882 Changing the VM state from 'DESTROYING' to 'TERMINATED'
00:05:21.115679 Console: Machine state changed to 'PoweredOff'
00:05:21.115896 GUI: Request to close Runtime UI because VM is powered off already.
00:05:21.115907 GUI: Passing request to close Runtime UI from machine-logic to UI session.

Looks like VirtualBox closes the session after changing the state to "TERMINATED", that may confuse Packer

Bruno Vernay

unread,
Jul 23, 2016, 5:19:56 PM7/23/16
to Packer
At this point maybe I should open an issue, shouldn't I??

Alvaro Miranda Aguilera

unread,
Jul 23, 2016, 6:04:32 PM7/23/16
to packe...@googlegroups.com
Sure,

if you can add steps how to reproduce, and what you have found, that will help a lot

Thanks for looking after this.

Alvaro

On Sun, Jul 24, 2016 at 9:19 AM, Bruno Vernay <bruno...@gmail.com> wrote:
At this point maybe I should open an issue, shouldn't I??

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages