Vagrant无法使用请求的计算机,因为它已被锁定

Mar*_*rco 11 virtual-machine vagrant laravel homestead

我试图访问我在宅基地上设置的项目网站,他们以前工作得很好,我几周没有工作,但是今天当我试图访问它们时我无法打开这些网站.我试图运行vagrant ssh但我收到此错误:

  VM must be running to open SSH connection. Run `vagrant up`
  to start the virtual machine.
Run Code Online (Sandbox Code Playgroud)

当我尝试做流浪汉时,我得到:

  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
Run Code Online (Sandbox Code Playgroud)

当我做:

 vagrant status 'idOfTheMachine'
Run Code Online (Sandbox Code Playgroud)

我明白了:

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`
Run Code Online (Sandbox Code Playgroud)

当我打开virtualbox并尝试查看共享文件夹时,我可以看到终端中的共享文件夹,但不能查看其中的项目.我已经搜索过这个问题,但找不到任何解决方案.我应该销毁虚拟盒子上的家用机器并制作一个新机器,如果是这样,如何正确地进行,以便我在新机器上有相同的项目?

Tyl*_*r H 14

我也有这个问题,虽然我不明白它是如何/为什么会发生的,但我确实发现它正在运行

vagrant reload {boxid}
Run Code Online (Sandbox Code Playgroud)

通常会打开盒子并允许我连接它.

当你完成编码以释放资源并希望能够毫不费力地将它变回'流浪汉'时,你可能会喜欢我并且'流浪汉停止'你的盒子,但看起来情况并非如此.希望这会让你重新站起来,知道发生什么事的其他人可以解释为什么会发生这种情况.


小智 10

在 Windows 上,我终止了 Ruby 进程,然后能够成功运行“vagranthalt”和“vagrantup”。


小智 7

刚刚失去一个小时来解决这个问题.我的最终解决方案

  1. 从Virtualbox中删除计算机
  2. 删除.vagrant包含Vagrantfile的目录中的文件夹(如果存在)
  3. 如果您仍然收到错误(正如我所做的那样),请运行vagrant global-status以检查是否有任何仍然可识别的计算机
  4. 如果仍然列出机器,请运行vagrant global-status --prune以将其删除
  5. vagrant up 应该再次工作