Skip to content
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-iso error: machine is already locked for a session (or being unlocked) #5424

Closed
gtirloni opened this issue Oct 4, 2017 · 4 comments

Comments

@gtirloni
Copy link
Contributor

gtirloni commented Oct 4, 2017

packer version: 1.1.0
VirtualBox: 5.1.28
OS: CentOS 7.4

==> virtualbox-iso: Gracefully halting virtual machine...
==> virtualbox-iso: Preparing to export machine...
    virtualbox-iso: Deleting forwarded port mapping for the communicator (SSH, WinRM, etc) (host port 3289)
==> virtualbox-iso: Error deleting port forwarding rule: VBoxManage error: VBoxManage: error: The machine 'centos7' is already locked for a session (or being unlocked)
==> virtualbox-iso: VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee nsISupports
==> virtualbox-iso: VBoxManage: error: Context: "LockMachine(a->session, LockType_Write)" at line 507 of file VBoxManageModifyVM.cpp
==> virtualbox-iso: Unregistering and deleting virtual machine...
==> virtualbox-iso: Error deleting virtual machine: VBoxManage error: VBoxManage: error: Cannot unregister the machine 'centos7' while it is locked
==> virtualbox-iso: VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee nsISupports
==> virtualbox-iso: VBoxManage: error: Context: "Unregister(CleanupMode_DetachAllReturnHardDisksOnly, ComSafeArrayAsOutParam(aMedia))" at line 156 of file VBoxManageMisc.cpp
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Error deleting port forwarding rule: VBoxManage error: VBoxManage: error: The machine 'centos7' 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 507 of file VBoxManageModifyVM.cpp

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: Error deleting port forwarding rule: VBoxManage error: VBoxManage: error: The machine 'centos7' 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 507 of file VBoxManageModifyVM.cpp

==> Builds finished but no artifacts were created.
make: *** [box/virtualbox/centos7-20171004.box] Error 1

"post_shutdown_delay": "30s" has no impact. headless/non-headless makes no difference.

When I ran packer in debug mode, it finished fine. It seems there is a timing issue and in debug mode things slow down enough that VirtualBox has enough time to remove the locks (or whatever it's trying to do).

@mwhooker
Copy link
Contributor

mwhooker commented Oct 4, 2017

I wonder if you need to increase the post_shutdown_delay to something like 2 minutes, which is generally around when these types of issues seem to go away. Otherwise, I think adding a retry as with #4432 would work.

Can you reproduce this reliably?

@mwhooker
Copy link
Contributor

mwhooker commented Oct 4, 2017

If it doesn't work on headless mode, then this is different from #1193

@gtirloni
Copy link
Contributor Author

gtirloni commented Oct 4, 2017

@mwhooker increasing it to 2min fixed the issue. Thank you!

@gtirloni gtirloni closed this as completed Oct 4, 2017
grv87 added a commit to FIDATA/infrastructure that referenced this issue Apr 4, 2018
Error:

```
Error deleting port forwarding rule: VBoxManage error: VBoxManage.exe: error: The machine 'kernel-UbuntuServer-16.04.4-0.1.0_amd64' is already locked for a session (or being unlocked)
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at line 525 of file VBoxManageModifyVM.cpp
```

Fixed as stated in hashicorp/packer#5424
grv87 added a commit to FIDATA/infrastructure that referenced this issue Apr 4, 2018
Error:

```
Error deleting port forwarding rule: VBoxManage error: VBoxManage.exe: error: The machine 'kernel-UbuntuServer-16.04.4-0.1.0_amd64' is already locked for a session (or being unlocked)
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at line 525 of file VBoxManageModifyVM.cpp
```

Fixed as stated in hashicorp/packer#5424
grv87 added a commit to FIDATA/infrastructure that referenced this issue Apr 5, 2018
Error:

```
Error deleting port forwarding rule: VBoxManage error: VBoxManage.exe: error: The machine 'kernel-UbuntuServer-16.04.4-0.1.0_amd64' is already locked for a session (or being unlocked)
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at line 525 of file VBoxManageModifyVM.cpp
```

Fixed as stated in hashicorp/packer#5424
grv87 added a commit to FIDATA/infrastructure that referenced this issue Apr 17, 2018
Error:

```
Error deleting port forwarding rule: VBoxManage error: VBoxManage.exe: error: The machine 'kernel-UbuntuServer-16.04.4-0.1.0_amd64' is already locked for a session (or being unlocked)
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at line 525 of file VBoxManageModifyVM.cpp
```

Fixed as stated in hashicorp/packer#5424
grv87 added a commit to FIDATA/infrastructure that referenced this issue Apr 19, 2018
Error:

```
Error deleting port forwarding rule: VBoxManage error: VBoxManage.exe: error: The machine 'kernel-UbuntuServer-16.04.4-0.1.0_amd64' is already locked for a session (or being unlocked)
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at line 525 of file VBoxManageModifyVM.cpp
```

Fixed as stated in hashicorp/packer#5424
grv87 added a commit to FIDATA/infrastructure that referenced this issue Apr 20, 2018
Error:

```
Error deleting port forwarding rule: VBoxManage error: VBoxManage.exe: error: The machine 'kernel-UbuntuServer-16.04.4-0.1.0_amd64' is already locked for a session (or being unlocked)
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at line 525 of file VBoxManageModifyVM.cpp
```

Fixed as stated in hashicorp/packer#5424
grv87 added a commit to FIDATA/infrastructure that referenced this issue Apr 20, 2018
Error:

```
Error deleting port forwarding rule: VBoxManage error: VBoxManage.exe: error: The machine 'kernel-UbuntuServer-16.04.4-0.1.0_amd64' is already locked for a session (or being unlocked)
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at line 525 of file VBoxManageModifyVM.cpp
```

Fixed as stated in hashicorp/packer#5424
grv87 added a commit to FIDATA/infrastructure that referenced this issue Apr 22, 2018
Error:

```
Error deleting port forwarding rule: VBoxManage error: VBoxManage.exe: error: The machine 'kernel-UbuntuServer-16.04.4-0.1.0_amd64' is already locked for a session (or being unlocked)
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at line 525 of file VBoxManageModifyVM.cpp
```

Fixed as stated in hashicorp/packer#5424
grv87 added a commit to FIDATA/infrastructure that referenced this issue Apr 22, 2018
Error:

```
Error deleting port forwarding rule: VBoxManage error: VBoxManage.exe: error: The machine 'kernel-UbuntuServer-16.04.4-0.1.0_amd64' is already locked for a session (or being unlocked)
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at line 525 of file VBoxManageModifyVM.cpp
```

Fixed as stated in hashicorp/packer#5424
grv87 added a commit to FIDATA/infrastructure that referenced this issue Apr 22, 2018
Error:

```
Error deleting port forwarding rule: VBoxManage error: VBoxManage.exe: error: The machine 'kernel-UbuntuServer-16.04.4-0.1.0_amd64' is already locked for a session (or being unlocked)
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at line 525 of file VBoxManageModifyVM.cpp
```

Fixed as stated in hashicorp/packer#5424
grv87 added a commit to FIDATA/infrastructure that referenced this issue Apr 22, 2018
Error:

```
Error deleting port forwarding rule: VBoxManage error: VBoxManage.exe: error: The machine 'kernel-UbuntuServer-16.04.4-0.1.0_amd64' is already locked for a session (or being unlocked)
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at line 525 of file VBoxManageModifyVM.cpp
```

Fixed as stated in hashicorp/packer#5424
grv87 added a commit to FIDATA/infrastructure that referenced this issue Apr 22, 2018
Error:

```
Error deleting port forwarding rule: VBoxManage error: VBoxManage.exe: error: The machine 'kernel-UbuntuServer-16.04.4-0.1.0_amd64' is already locked for a session (or being unlocked)
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at line 525 of file VBoxManageModifyVM.cpp
```

Fixed as stated in hashicorp/packer#5424
grv87 added a commit to FIDATA/infrastructure that referenced this issue Apr 23, 2018
Error:

```
Error deleting port forwarding rule: VBoxManage error: VBoxManage.exe: error: The machine 'kernel-UbuntuServer-16.04.4-0.1.0_amd64' is already locked for a session (or being unlocked)
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at line 525 of file VBoxManageModifyVM.cpp
```

Fixed as stated in hashicorp/packer#5424
omgbebebe pushed a commit to altlinuxteam/alt-packer that referenced this issue Sep 28, 2018
@ghost
Copy link

ghost commented Apr 3, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants