当我尝试销毁厨房实例时,Virtualbox被锁定

时间:2014-02-06 15:09:04

标签: virtualbox test-kitchen

我跑了一个测试厨房实例,一切都很好,但最后当我试图用它来摧毁它时:

roberto@pc:~$ kitchen destroy

Virtualbox给了我这个错误。

-----> Starting Kitchen (v1.1.1)
-----> Destroying <default-ubuntu-1204>...
       [default] Destroying VM and associated drives...
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #destroy action: [Expected process to exit with [0], but received '1'
---- Begin output of vagrant destroy -f ----
STDOUT: [default] Destroying VM and associated drives...
STDERR: There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["unregistervm", "2507bc77-3734-429b-a573-d92fadb80e95", "--delete"]

Stderr: VBoxManage: error: Cannot unregister the machine 'default-ubuntu-1204_default_1391521776' while it is locked
VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component Machine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "Unregister(CleanupMode_DetachAllReturnHardDisksOnly, ComSafeArrayAsOutParam(aMedia))" at line 158 of file VBoxManageMisc.cpp
---- End output of vagrant destroy -f ----
Ran vagrant destroy -f returned 1]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details

我运行Virtualbox并且无法删除该实例,因为它也已被锁定且关闭选项已禁用。

有这个问题的其他人吗?

2 个答案:

答案 0 :(得分:3)

  

VBoxManage:错误:无法取消注册机器&#39; X&#39;当它被锁定时。

它已被锁定,因为它已被使用,所以基本上你需要关闭它,例如。

VBoxManage controlvm VMNAME poweroff

VMNAME更改为您的计算机名称,例如default-ubuntu-1204_default_1391521776

然后您可以通过以下方式取消注册:

VBoxManage unregistervm VMNAME --delete

指定--delete将删除您的VM。如果您不想删除它,可以从~/"VirtualBox VMs/VMNAME进行备份。

答案 1 :(得分:1)

有两件事可能会导致此问题。请确保:

  1. 安装/更新VirtualBox后重启计算机
  2. 请确保在使用驱动程序之前至少手动打开一次VirtualBox
  3. 如果计算机出现在VBox GUI的虚拟机列表中,请再次尝试该命令。如果它们未在VirtualBox GUI中列出,请删除.kitchen目录,然后重试。