昨天下班关vagrant的时候遇到了无法关闭问题,执行vagrant halt之后,控制台命令一直没有执行完,在virtualBox中打开查看到homestead状态为正在关闭,如下图:
这个时候,执行vagrant up命令启动时,发现报了以下错误:
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["modifyvm", "bb235e59-7f9e-4335-9a82-4191d3c048f3", "--natpf1", "delete", "ssh", "--natpf1", "delete", "tcp27017", "--natpf1", "delete", "tcp33060", "--natpf1", "delete", "tcp4040", "--natpf1", "delete", "tcp44300", "--natpf1", "delete", "tcp54320", "--natpf1", "delete", "tcp8000", "--natpf1", "delete", "tcp8025", "--natpf1", "delete", "tcp8888"]
Stderr: VBoxManage.exe: error: The machine 'homestead-7' 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 527 of file VBoxManageModifyVM.cpp
老实说,这种问题我第一次遇到。首先想到查看vagrant相关进程,发现有几个进程还在跑,把这几个进程kill掉,然后在执行vagrant up 命令就可以启动了