【问题标题】:Vagrant can't use the requested machine because it is lockedVagrant 无法使用请求的机器,因为它已被锁定
【发布时间】:2016-08-08 15:16:53
【问题描述】:

我曾尝试访问我在宅基地上设置的项目网站,它们之前都运行良好,而我已经有几周没有处理它们了,但是今天当我尝试访问它们时,我无法访问它们'不要打开网站。我曾尝试运行 vagrant ssh,但出现此错误:

  VM must be running to open SSH connection. Run `vagrant up`
  to start the virtual machine.

当我尝试做 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

当我这样做时:

 vagrant status 'idOfTheMachine'

我明白了:

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`

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

【问题讨论】:

  • vagrant status 说什么?
  • 我已经编辑了带有流浪状态响应的问题

标签: laravel vagrant virtual-machine homestead


【解决方案1】:

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

vagrant reload {boxid}

通常会打开盒子并让我连接到它。

您可能像我一样,在完成编码以释放资源并期望能够通过“vagrant up”轻松将其重新打开时“vagrant stop”你的盒子,但似乎不是案子。希望这能让你重新站起来,知道发生了什么的其他人可以解释为什么会发生这种情况。

【讨论】:

  • 我的盒子最终被锁定,因为我的计算机在 vagrant 运行时冻结(笔记本电脑电源不足),我不得不手动关闭它。 vagrant reload 让虚拟机再次运行。
  • 遗憾的是,这个解决方案对我不起作用。要修复它,我必须重新启动计算机。如果您使用的是 Windows 并且启用了快速启动,您可能需要重新启动,而不是关闭并重新打开计算机。
【解决方案2】:

刚刚在这个问题上浪费了一个小时。我的最终解决方案:

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

【讨论】:

  • 这对我有用,但在我重新启动 Windows 之前,第 4 步和第 5 步给了我错误。
【解决方案3】:

在 Windows 上,我杀死了我的 Ruby 进程,然后能够成功运行“vagrant halt”,然后“vagrant up”。

【讨论】:

  • 这对我也有帮助:)
  • 这有帮助...甚至vagrant status 抱怨锁,直到我这样做。
【解决方案4】:

在 MacOSX 上,我去了 Activity Monitor 并杀死了正在运行的 vagrant 进程。这为我解决了。

【讨论】:

    猜你喜欢
    • 2015-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多