laravel Vagrant 不能使用请求的机器,因为它被锁定了
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36667648/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Vagrant can't use the requested machine because it is locked
提问by Marco
I have tried to access my projects sites that I have set up on homestead, they were working all fine before, and I haven't been working on them for few weeks, but today when I have tried to access them I couldn't open the sites. I have tried to run vagrant ssh but I get this error:
我曾尝试访问我在 homestead 上设置的项目站点,它们之前运行良好,而且我已经几周没有使用它们了,但是今天当我尝试访问它们时却无法打开网站。我曾尝试运行 vagrant ssh,但出现此错误:
VM must be running to open SSH connection. Run `vagrant up`
to start the virtual machine.
And when I try to do vagrant up, I get:
当我尝试做 vagrant up 时,我得到:
Vagrant can't use the requested machine because it is locked! This
means that another Vagrant process is currently reading or modifying
the machine. Please wait for that Vagrant process to end and try
again. Details about the machine are shown below:
Name: default
Provider: virtualbox
When I do:
当我做:
vagrant status 'idOfTheMachine'
I get:
我得到:
vagrant status 'idOfTheMachine'
/Users/myName/Homestead/Vagrantfile:4: warning: already initialized constant VAGRANTFILE_API_VERSION
/Users/myName/Homestead/Vagrantfile:4: warning: previous definition of VAGRANTFILE_API_VERSION was here
Current machine states:
default poweroff (virtualbox)
The VM is powered off. To restart the VM, simply run `vagrant up`
When I have opened virtualbox, and tried to see the shared folders, I could see the shared folders in the terminal but not the projects inside of them. I have googled around about this issue, but can't find any solution to it. Should I destroy the homestead machine on the virtual box and make a new one, and if so, how to make that properly, so that I have the same projects on the new machine?
当我打开 virtualbox 并尝试查看共享文件夹时,我可以在终端中看到共享文件夹,但看不到其中的项目。我已经搜索过这个问题,但找不到任何解决方案。我应该销毁虚拟机上的宅基地机器并制作一个新的,如果是这样,如何正确制作,以便我在新机器上有相同的项目?
回答by Tyler H
I have this problem as well, and while I don't understand how/why it happens, I did find that running
我也有这个问题,虽然我不明白它是如何/为什么发生的,但我确实发现运行
vagrant reload {boxid}
will usually bring up the box and allow me to connect to it.
通常会调出盒子并让我连接到它。
You're probably like me and 'vagrant halt' your box when you're done coding to free up resources and expect to just be able to turn it back on effortlessly with 'vagrant up', but it would seem that's not the case. Hopefully this gets you back on your feet and someone else who knows whats happening can explain why this happens.
当您完成编码以释放资源并期望能够通过“vagrant up”轻松地将其重新打开时,您可能像我一样“vagrant 停止”您的盒子,但事实似乎并非如此。希望这能让你重新站起来,其他知道发生了什么的人可以解释为什么会发生这种情况。
回答by Paul Pullen
Just lost an hour to this problem. My final solution:
刚刚在这个问题上浪费了一个小时。我的最终解决方案:
- Delete the machine from Virtualbox
- Delete the
.vagrant
folder (if present) in the directory containing your Vagrantfile - If you still get the error (as I did), run
vagrant global-status
to check for any still-recognized machines - If the machine is still listed, run
vagrant global-status --prune
to remove it vagrant up
should work again
- 从 Virtualbox 中删除机器
- 删除
.vagrant
包含 Vagrantfile 的目录中的文件夹(如果存在) - 如果您仍然收到错误消息(就像我所做的那样),请运行
vagrant global-status
以检查任何仍可识别的机器 - 如果机器仍然列出,请运行
vagrant global-status --prune
以将其删除 vagrant up
应该再次工作
回答by Paul Munsey
On Windows, I killed my Ruby processes and then was able to successfully run 'vagrant halt' and then 'vagrant up'.
在 Windows 上,我终止了我的 Ruby 进程,然后能够成功运行“vagrant halt”和“vagrant up”。
回答by vick
On MacOSX, I went to Activity Monitor and just killed the vagrant process that was running. That solved it for me.
在 MacOSX 上,我转到 Activity Monitor 并杀死了正在运行的 vagrant 进程。那为我解决了。