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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40968297/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 14:52:30  来源:igfitidea点击:

Laravel Homestead hangs at SSH auth method: private key on mac

macoslaravelsshvagranthomestead

提问by Scott O-Town

I can't seem to get Homestead running. It hangs at SSH auth method: private key.

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

The Homestead VM starts. I can go to VirtualBox and open the terminal window and login with vagrant:vagrant.

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

I can't vagrant ssh, ssh [email protected]:2204 or ssh [email protected] -p 2204.

我不能 ssh,ssh [email protected]:2204 或 ssh [email protected] -p 2204。

None of my folders show up in the VM, but the VirtualBox says they are mapped.

我的文件夹都没有出现在 VM 中,但 VirtualBox 说它们已映射。

Every time I vagrant up, I get:

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

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.

I replaced the homestead insecure private key with my key on my box. I see a lot of people get Warning: Connection timeout. Retrying..., but I don't get that far.

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

I'm on a mac 10.11.6

我在 Mac 10.11.6 上

Any help would be greatly appreciated!

任何帮助将不胜感激!

回答by Hyman

I had the same problem on macOS 10.12 today, and lost 6 hours trying to find a fix. Finally, after several reinstallations, reboots, and trial and error, I somehow got it to work by following these steps...

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

  1. Completely uninstall and reinstall Vagrant, VirtualBox, and Homestead.
  2. Ensure the homestead-7box is shut down within the VirtualBox UI
  3. Right-click the homestead-7box, and choose Settings
  4. Click 'Network'
  5. Under 'Adapter 1', which should be attached to NAT, click 'Advanced'
  6. Tick the box beside 'Cable Connected'
  7. Save settings, and reprovision Homestead with vagrant up --provision
  8. Run vagrant reload --provisionto reprovision the machine
  1. 完全卸载并重新安装 Vagrant、VirtualBox 和 Homestead。
  2. 确保homestead-7框在 VirtualBox UI 中关闭
  3. 右键单击该homestead-7框,然后选择设置
  4. 点击“网络”
  5. 在应该连接到 NAT 的“适配器 1”下,单击“高级”
  6. 勾选“已连接电缆”旁边的框
  7. 保存设置,并重新配置 Homestead vagrant up --provision
  8. 运行vagrant reload --provision以重新配置机器

That should be it! I was able to SSH in after this, but not able to view Homestead sites through the browser (even though I'd configured the /etc/hostsfile), but a simple reboot of the Mac seemed to fix this.

应该是这样!在此之后我能够通过 SSH 进入,但无法通过浏览器查看 Homestead 站点(即使我已经配置了/etc/hosts文件),但是简单地重新启动 Mac 似乎可以解决这个问题。

Given I don't know what exactly caused this in the first place, this might just be a bit of luck for my case, but let me know how you get on.

鉴于我一开始不知道究竟是什么原因导致了这种情况,这对我来说可能只是运气好,但请告诉我您的进展情况。

回答by gedq

I had this problem. I enabled Vt-x in the bios and it cleared it.

我有这个问题。我在 bios 中启用了 Vt-x 并将其清除。

回答by Servet

Enable "Virtualization Technology" in BIOS settings

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

回答by mixa_ru

Vagrant 2.1.2

流浪者 2.1.2

vagrant destroythen vagrant up --provisionworked for me.

vagrant destroy然后vagrant up --provision对我来说有效。

I have noticed that it usually happens when new version of vagrant released

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

回答by wired00

Nothing here worked for me. I got into the situation of SSH auth method: private keybecause my mac black screened and crashed.

这里没有什么对我有用。我陷入了SSH auth method: private key因为我的 mac 黑屏并崩溃的情况。

All that worked for me was a vagrant destroythen vagrant up --provision. Beware this will of course trash anything in your VM. but you should be using ephemeral principles anyway...

所有对我有用的都是vagrant destroythen vagrant up --provision。请注意,这当然会破坏 VM 中的任何内容。但无论如何你应该使用短暂的原则......

回答by steven

  1. Open VirtualBox UI and enter the virtual machine.
  2. press Enter key to make system continue to boot.
  1. 打开VirtualBox UI,进入虚拟机。
  2. 按 Enter 键使系统继续引导。

And then you can see the vagrant up going on.

然后你可以看到流浪者在继续。

回答by varta

I had to do a fsck. (disclaimer, I typed the commands from memory)

我不得不做一个 fsck。(免责声明,我从内存中键入命令)

  1. Open VirtualBox UI and enter the virtual machine.
  2. If you see (initramfs), type exit
  3. fsck /dev/mapper/vagrant-vg-root -y
  4. reboot
  1. 打开VirtualBox UI,进入虚拟机。
  2. 如果您看到 (initramfs),请输入 exit
  3. fsck /dev/mapper/vagrant-vg-root -y
  4. 重启

Go back to your normal terminal and try a:

返回您的普通终端并尝试:

vagrant halt
vagrant up

For me, things were back to normal from here.

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

回答by alexcomo95

If you are on Windows, you have done everything here and still have trouble, maybe this is the solution you need.

如果你在 Windows 上,你已经完成了这里的一切,但仍然有问题,也许这就是你需要的解决方案。

Open the Command Prompt as an administrator. Type the bcdeditcommand. You may find hypervisorlaunchtype Auto. If that is the case, type bcdedit /set hypervisorlaunchtype offto turn it off. Reboot and try again.

以管理员身份打开命令提示符。键入bcdedit命令。你可能会发现hypervisorlaunchtype Auto。如果是这种情况,请键入bcdedit /set hypervisorlaunchtype off以将其关闭。重新启动并重试。

Hope this helps.

希望这可以帮助。