前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >修复VBoxManage: error: The machine is already locked for a session

修复VBoxManage: error: The machine is already locked for a session

原创
作者头像
扫地工程师
修改2020-05-15 14:25:04
2.7K0
修改2020-05-15 14:25:04
举报
文章被收录于专栏:微星极光

问题背景

通过vagrant up启动虚拟机的时候, 报出错信息如下

代码语言:txt
复制
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

通过命令修复

代码语言:txt
复制
vagrant reload  keydb_default_1589095573623_76673

再跑的时候, 变成了下面这个, 以后都是这个了

代码语言:txt
复制
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.

解决方案

首先重启大法, 查进程, 并杀死

代码语言:txt
复制
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.

image.png
image.png

对虚拟机点Normal Start, 然后会提示它处于GuruMeditation, 问你要不要Power Off,

直接点PowerOff,

下一步重新vagrant up即可

参考链接

https://stackoverflow.com/a/36889390

https://stackoverflow.com/a/19899960

原文链接

https://www.wxhmf.com/posts/how-to-fix-vagrant-up-failed/

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 解决方案
  • 参考链接
  • 原文链接
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档