端くれプログラマの備忘録 Vagrant [Vagrant] already locked for a session エラー対処法

[Vagrant] already locked for a session エラー対処法

このところVagrantが不調で、以下のエラーが頻繁に出る。

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'puphpet/centos65-x64' is up to date...
==> default: Clearing any previously set forwarded ports...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["modifyvm", "<vm-uuid>", "--natpf1", "delete", "ssh"]

Stderr: VBoxManage: error: The machine 'xxxxx_default_1510770391814_44801' 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

とりあえずロックを解除するには以下のコマンドを実行すれば良い。

$ vboxmanage startvm <vm-uuid> --type emergencystop

参考サイト

VM in virtualbox is already locked for a session (or being unlocked) – Stack Overflow
https://stackoverflow.com/questions/35169724/vm-in-virtualbox-is-already-locked-for-a-session-or-being-unlocked