How to Fix Vagrant Up Failed
#如何修复VBoxManage: error: The machine is already locked for a session (or being unlocked)
通过vagrant up启动虚拟机的时候, 报出错信息如下
vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> 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", "fc696414-6a00-4be9-9bdd-3c16cd6674ac", "--natpf1", "delete", "ssh", "--natpf1", "delete", "tcp15672", "--natpf1", "delete", "tcp5672"] Stderr: VBoxManage: error: The machine 'keydb_default_1589095573623_76673' 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 531 of file VBoxManageModifyVM.cpp
vagrant reload keydb_default_1589095573623_76673
再跑的时候, 变成了下面这个, 以后都是这个了
vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Clearing any previously set forwarded ports... ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat default: Adapter 2: hostonly ==> default: Forwarding ports... default: 15672 (guest) => 15672 (host) (adapter 1) default: 5672 (guest) => 5672 (host) (adapter 1) default: 22 (guest) => 2222 (host) (adapter 1) ==> default: Running 'pre-boot' VM customizations... ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key The guest machine entered an invalid state while waiting for it to boot. Valid states are 'starting, running'. The machine is in the 'gurumeditation' state. Please verify everything is configured properly and try again. If the provider you're using has a GUI that comes with it, it is often helpful to open that and watch the machine, since the GUI often has more helpful error messages than Vagrant can retrieve. For example, if you're using VirtualBox, run `vagrant up` while the VirtualBox GUI is open. The primary issue for this error is that the provider you're using is not properly configured. This is very rarely a Vagrant issue.
首先重启大法, 查进程, 并杀死
ps -ef | grep Virtual 503 98763 1 0 5:35PM ?? 15:02.07 /Applications/VirtualBox.app/Contents/MacOS/VBoxHeadless --comment keydb_default_1589095573623_76673 --startvm fc696414-6a00-4be9-9bdd-3c16cd6674ac --vrde config
然后打开UI, 发现虚拟机处于GuruMeditation state.
对虚拟机点Normal Start, 然后会提示它处于GuruMeditation, 问你要不要Power Off, 直接点PowerOff,