没有不值得去解决的问题,也没有不值得去学习的技术!

SSH Login to Homestead VM Fails and Hangs When Using the vagrant ssh Command

Using the command vagrant ssh to SSH into the Homestead virtual machine failed with no response

1. Using the command vagrant ssh to SSH into the Homestead virtual machine failed with no response. See Figure 1.

Using the command vagrant ssh to SSH into the Homestead virtual machine failed with no response
Figure 1
Plaintext

Lenovo@DESKTOP-QLPK8QM MINGW64 ~/Homestead (v12.1.0)
$ vagrant ssh

Lenovo@DESKTOP-QLPK8QM MINGW64 ~/Homestead (v12.1.0)


2. The folders option specifies the local folder to be mapped to the Homestead virtual machine. The cause was that the local folder E:/wwwroot specified by map was too large.

YAML

folders:
    - map: E:/wwwroot
      to: /home/vagrant/Code

3. I finally decided to switch to a different local folder: E:/wwwroot/vagrant.

YAML

folders:
    - map: E:/wwwroot/vagrant
      to: /home/vagrant/Code

4. Running the command vagrant provision && vagrant reload on the host machine means “apply the Homestead.yaml configuration” and “restart the virtual machine”. I logged in again, and the login was successful. See Figure 2.

Running the command vagrant provision && vagrant reload on the host machine means "apply the Homestead.yaml configuration" and "restart the virtual machine". Logged in again, login successful
Figure 2
Plaintext

Lenovo@DESKTOP-QLPK8QM MINGW64 ~/Homestead (v12.1.0)
$ vagrant provision && vagrant reload
==> homestead: VM is not currently running. Please, first bring it up with `vagr
==> homestead: Checking if box 'lc/homestead' version '11.0.0' is up to date...
==> homestead: Clearing any previously set forwarded ports...
==> homestead: Clearing any previously set network interfaces...
==> homestead: Preparing network interfaces based on configuration...
    homestead: Adapter 1: nat
    homestead: Adapter 2: hostonly
==> homestead: Forwarding ports...
    homestead: 80 (guest) => 8000 (host) (adapter 1)
    homestead: 443 (guest) => 44300 (host) (adapter 1)
    homestead: 3306 (guest) => 33060 (host) (adapter 1)
    homestead: 4040 (guest) => 4040 (host) (adapter 1)
    homestead: 5432 (guest) => 54320 (host) (adapter 1)
    homestead: 8025 (guest) => 8025 (host) (adapter 1)
    homestead: 9600 (guest) => 9600 (host) (adapter 1)
    homestead: 27017 (guest) => 27017 (host) (adapter 1)
    homestead: 22 (guest) => 2222 (host) (adapter 1)
==> homestead: Running 'pre-boot' VM customizations...
==> homestead: Booting VM...
==> homestead: Waiting for machine to boot. This may take a few minutes...
    homestead: SSH address: 127.0.0.1:2222
    homestead: SSH username: vagrant
    homestead: SSH auth method: private key
    homestead:
    homestead: Vagrant insecure key detected. Vagrant will automatically replace
    homestead: this with a newly generated keypair for better security.
    homestead:
    homestead: Inserting generated public key within guest...
    homestead: Removing insecure key from the guest if it's present...
    homestead: Key inserted! Disconnecting and reconnecting using new SSH key...
==> homestead: Machine booted and ready!
==> homestead: Checking for guest additions in VM...
==> homestead: Setting hostname...
==> homestead: Configuring and enabling network interfaces...
==> homestead: Mounting shared folders...
    homestead: /vagrant => C:/Users/Lenovo/Homestead
    homestead: /home/vagrant/Code => E:/wwwroot/vagrant
==> homestead: Detected mount owner ID within mount options. (uid: 1000 guestpat
==> homestead: Detected mount group ID within mount options. (gid: 1000 guestpat
==> homestead: Machine already provisioned. Run `vagrant provision` or use the `
==> homestead: flag to force provisioning. Provisioners marked to run always wil

Lenovo@DESKTOP-QLPK8QM MINGW64 ~/Homestead (v12.1.0)
$ vagrant ssh
Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-65-generic x86_64)


Last login: Sun Feb 28 03:12:16 2021 from 10.0.2.2
vagrant@homestead:~$


关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系