Laravel Homestead 在 SSH 身份验证方法中挂起:Mac 上的私钥

问题描述 投票:0回答:13

我似乎无法让 Homestead 运行。它挂在 SSH 身份验证方法:私钥处。

Homestead VM 启动。我可以进入 VirtualBox 并打开终端窗口并使用 vagrant:vagrant 登录。

我无法使用 vagrant ssh、ssh [电子邮件受保护]:2204 或 ssh [电子邮件受保护] -p 2204。

我的文件夹都没有显示在虚拟机中,但 VirtualBox 说它们已映射。

每次我流浪时,我都会得到:

vagrant up
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Checking if box 'laravel/homestead' is up to date...
==> homestead-7: Clearing any previously set forwarded ports...
==> homestead-7: Fixed port collision for 80 => 8000. Now on port 2200.
==> homestead-7: Fixed port collision for 443 => 44300. Now on port 2201.
==> homestead-7: Fixed port collision for 3306 => 33060. Now on port 2202.
==> homestead-7: Fixed port collision for 5432 => 54320. Now on port 2203.
==> homestead-7: Fixed port collision for 22 => 2222. Now on port 2204.
==> homestead-7: Clearing any previously set network interfaces...
==> homestead-7: Preparing network interfaces based on configuration...
    homestead-7: Adapter 1: nat
    homestead-7: Adapter 2: hostonly
==> homestead-7: Forwarding ports...
    homestead-7: 80 (guest) => 2200 (host) (adapter 1)
    homestead-7: 443 (guest) => 2201 (host) (adapter 1)
    homestead-7: 3306 (guest) => 2202 (host) (adapter 1)
    homestead-7: 5432 (guest) => 2203 (host) (adapter 1)
    homestead-7: 22 (guest) => 2204 (host) (adapter 1)
==> homestead-7: Running 'pre-boot' VM customizations...
==> homestead-7: Booting VM...
==> homestead-7: Waiting for machine to boot. This may take a few minutes...
    homestead-7: SSH address: 127.0.0.1:2204
    homestead-7: SSH username: vagrant
    homestead-7: SSH auth method: private key
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

我用我盒子上的钥匙替换了宅基地不安全的私钥。我看到很多人收到警告:连接超时。重试...,但我还没有走那么远。

我使用的是 Mac 10.11.6

任何帮助将不胜感激!

macos laravel ssh vagrant homestead
13个回答
87
投票

我今天在 macOS 10.12 上遇到了同样的问题,并花了 6 个小时试图找到解决方案。最后,经过几次重新安装、重新启动和反复试验后,我按照以下步骤以某种方式让它工作......

  1. 完全卸载并重新安装 Vagrant、VirtualBox 和 Homestead。
  2. 确保 VirtualBox UI 中的
    homestead-7
    框已关闭
  3. 右键单击
    homestead-7
    框,然后选择设置
  4. 点击“网络”
  5. 在应附加到 NAT 的“适配器 1”下,单击“高级”
  6. 勾选“已连接电缆”旁边的框
  7. 保存设置,并使用
    vagrant up --provision
  8. 重新配置 Homestead
  9. 运行
    vagrant reload --provision
    重新配置机器

应该是这样!此后我能够通过 SSH 登录,但无法通过浏览器查看 Homestead 站点(即使我配置了

/etc/hosts
文件),但简单地重新启动 Mac 似乎就解决了这个问题。

鉴于我一开始不知道到底是什么导致了这种情况,这对我来说可能只是运气好,但请让我知道你的进展如何。


14
投票
  1. 打开 VirtualBox UI 并进入虚拟机。
  2. 按 Enter 键让系统继续启动。

然后你就可以看到 vagrant up 的情况了。


8
投票

我遇到了这个问题。我在 BIOS 中启用了 Vt-x,它清除了它。


6
投票

流浪者2.1.2

vagrant destroy
然后
vagrant up --provision
为我工作。

我注意到这通常发生在新版本的 vagrant 发布时


5
投票

如果您使用的是 Windows,您已经完成了此处的所有操作,但仍然遇到问题,也许这就是您需要的解决方案。

以管理员身份打开命令提示符。输入

bcdedit
命令。你可能会发现
hypervisorlaunchtype Auto
。如果是这种情况,请输入
bcdedit /set hypervisorlaunchtype off
将其关闭。重新启动并重试。

希望这有帮助。


3
投票

这里没有任何东西对我有用。我遇到了

SSH auth method: private key
的情况,因为我的mac黑屏并崩溃了。

对我有用的是

vagrant destroy
然后
vagrant up --provision
。请注意,这当然会破坏虚拟机中的任何内容。但无论如何你应该使用短暂的原则......


3
投票

在 BIOS 设置中启用“虚拟化技术”


3
投票

我必须进行 fsck。 (免责声明,我凭记忆输入命令)

  1. 打开 VirtualBox UI 并进入虚拟机。
  2. 如果看到 (initramfs),请输入 exit
  3. fsck /dev/mapper/vagrant-vg-root -y
  4. 重启

返回正常终端并尝试:

vagrant halt
vagrant up

对我来说,事情从这里开始恢复正常。


1
投票

在我使用 Homestead v6.4 和 virtualbox 正常工作一段时间后,突然发生了这种情况。要修复此问题,请打开 VirtualBox(如果使用)并检查那里的日志。

我找到了手动 fsck 解决问题的目录的说明

你的目录可能会有所不同,但我的是

fsck /dev/mapper/homestead--vg-root 

然后选择 y 修复所有错误


0
投票

尝试使用管理员权限从

CMD
调用 vagrant up


0
投票

如果您仍然遇到困难,可以快速排除以下问题:

对我来说,问题是视频内存太少,由于某种原因,在 Virtual Box 中我的视频内存设置为 4mb,最小值为 12mb,我将其设置为 24mb(虚拟机关闭)并再次运行

vagrant up
,它修复了问题!


0
投票

我在安装适用于 Windows 的 Docker Desktop 后收到此错误。 两者不兼容。

运行Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor

这将禁用虚拟机管理程序。

启用-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All 启用。

我发现现在 Homestead 需要很长时间才能启动,打开 VMBox,选择 homestead 并单击显示(绿色按钮)。等待,直到出现宅基地登录提示。 然后返回,你可以运行 vagrant ssh 进入 Homestead。


0
投票

我刚刚于 2024 年 3 月通过以下步骤修复了此问题:

  1. 理想情况下,捕获数据库的备份。
  2. 销毁 VirtualBox 中的虚拟机:右键单击虚拟机 > 删除 > 删除所有文件。
  3. 运行
    vagrant up
© www.soinside.com 2019 - 2024. All rights reserved.