Every time a Vagrant
box fails to install, it leaves some mess behind in VirtualBox
. Forwarded ports that were set up in the Vagrantfile
do not get cleaned up. vagrant halt
does not work because the box is not up, and vagrant destroy
sometimes work, depending on how far the installation of a box went before hanging.
每次迷途的盒子安装失败,都会在虚拟盒子中留下一些混乱。在Vagrantfile中设置的转发端口不会被清理。流浪汉停止不工作,因为盒子没有起来,而流浪汉破坏有时工作,取决于安装一个盒子前走了多远。
So every time I test a new setup, vagrant says that the port to be forwarded is already in use. I need to change the port to forward, and then the install continues, only to hang at a later point and take the port hostage into oblivion. Now I don't have any ports that I can use (that are accessible remotely), so I just want to quit having those ports constipated.
所以每次我测试一个新设置时,vagrant说要转发的端口已经在使用中。我需要将端口更改为forward,然后继续安装,然后挂起在稍后的点上,并将端口作为人质,使其被遗忘。现在我没有任何端口可以使用(可以远程访问),所以我只想停止那些端口便秘。
I could probably fix this with a reboot, but the machine cannot be rebooted right now.
我可以用重新启动来修复这个问题,但是机器现在不能重新启动。
Issuing the "just delete the damn thing" command does not work:
发出“删除该死的东西”命令无效:
$ VBoxManage list vms
"<inaccessible>" {aaaa-aa-aa-aa-aaaa}
"<inaccessible>" {bbbb-bb-bb-bb-bbbb}
"vagrant_default_cccc_cc" {cccc-cc-cc-cc-cccc}
$ VBoxManage unregistervm aaaa-aa-aa-aa-aaaa --delete
VBoxManage: error: The object is not ready
VBoxManage: error: Details: code E_ACCESSDENIED (0x80070005), component Machine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "Delete(ComSafeArrayAsInParam(aMedia), pProgress.asOutParam())" at line 165 of file VBoxManageMisc.cpp
$ VBoxManage unregistervm bbbb-bb-bb-bb-bbbb --delete
VBoxManage: error: The object is not ready
VBoxManage: error: Details: code E_ACCESSDENIED (0x80070005), component Machine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "Delete(ComSafeArrayAsInParam(aMedia), pProgress.asOutParam())" at line 165 of file VBoxManageMisc.cpp
$ VBoxManage unregistervm cccc-cc-cc-cc-cccc --delete
VBoxManage: error: Cannot unregister the machine 'vagrant_default_cccc_cc' while it is locked VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component Machine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "Unregister(fDelete ? (CleanupMode_T)CleanupMode_DetachAllReturnHardDisksOnly : (CleanupMode_T)CleanupMode_DetachAllReturnNone, ComSafeArrayAsOutParam(aMedia))" at line 160 of file VBoxManageMisc.cpp
$$ VBoxManage list vms“< >”{aaaa-aa-aa-aa-aaaa}“< unavailable >”{bbb -bb-bbb -bbb -bbb}”vagrant_700t_cc_cc“{cc -cc-cc-cc-cccc”}错误:对象还没有准备好:错误:代码E_ACCESSDENIED (0x80070005),组件机,接口IMachine, callee nsisupport VBoxManage: error: Context:“delete (comsafearasrayasinparam)”。cpp $ vboxmanagementunregistervm cccc-cc-cc-cc- delete VBoxManage: error:无法在锁定vboxmanagementvboxmanagementvbox_vbox_e_invalid_object_state (0x80bb0007)的同时注销机器“vagrant_default_cccccc_cc”的注册(组件机,接口IMachine)在VBoxManageMisc文件的第160行中,我们将为您提供一个完整的解决方案。cpp美元
(Nope, sudo
doesn't do the trick either.)
(不,sudo也不会这么做。)
How can I totally eradicate and destroy the machines as easily as possible without having to reboot? Or, at least (or better) stop VirtualBox
from keeping port forwards to broken boxes? I probably should not remove and -rf
just everything because there are also some boxes that run fine.
我怎样才能在不需要重新启动的情况下尽可能轻松地彻底清除和销毁机器呢?或者,至少(或更好)阻止虚拟机匣将端口转发给损坏的机器?我可能不应该删除和-rf只是因为有些盒子运行良好。
The server running Vagrant and VirtualBox runs on Ubuntu 13.10
. The guest, although probably irrelevant, tries to run Ubuntu 12.10
.
在Ubuntu 13.10上运行的服务器运行着流浪汉和VirtualBox。客人,虽然可能不相关,尝试运行Ubuntu 12.10。
1 个解决方案
#1
3
$ ps axu|grep VBoxHeadless
jamie 4205 0.3 1.2 1592676 208592 ? Sl Apr10 7:08 /usr/lib/virtualbox/VBoxHeadless --comment apt-cacher_default_1396256757 --startvm a8c2157a-f86f-491d-a703-74e49b4348fb --vrde config
jamie 11390 48.7 1.4 2823080 231788 ? Sl Apr10 845:49 /usr/lib/virtualbox/VBoxHeadless --comment vandeliverytest_default_1397122355 --startvm a06a0a8c-a645-4270-89f4-992566e111f0 --vrde config
jamie 22226 0.0 0.0 13596 936 pts/3 S+ 16:31 0:00 grep --color=auto VBoxHeadless
The "startvm" ones are the processes that hang around and can't be stopped with normal vagrant commands. issue a kill -TERM
command to the processes and they should stop If that doesn't work escalate to a kill -KILL
“startvm”是指挂在周围的进程,不能用普通的流浪命令来停止。向进程发出一个kill -TERM命令,如果不能升级到kill -KILL,它们应该停止。
#1
3
$ ps axu|grep VBoxHeadless
jamie 4205 0.3 1.2 1592676 208592 ? Sl Apr10 7:08 /usr/lib/virtualbox/VBoxHeadless --comment apt-cacher_default_1396256757 --startvm a8c2157a-f86f-491d-a703-74e49b4348fb --vrde config
jamie 11390 48.7 1.4 2823080 231788 ? Sl Apr10 845:49 /usr/lib/virtualbox/VBoxHeadless --comment vandeliverytest_default_1397122355 --startvm a06a0a8c-a645-4270-89f4-992566e111f0 --vrde config
jamie 22226 0.0 0.0 13596 936 pts/3 S+ 16:31 0:00 grep --color=auto VBoxHeadless
The "startvm" ones are the processes that hang around and can't be stopped with normal vagrant commands. issue a kill -TERM
command to the processes and they should stop If that doesn't work escalate to a kill -KILL
“startvm”是指挂在周围的进程,不能用普通的流浪命令来停止。向进程发出一个kill -TERM命令,如果不能升级到kill -KILL,它们应该停止。