Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Laravel 4 Basics Getting Started with Laravel Installing Laravel Homestead

Julie Awad
Julie Awad
6,675 Points

Installing Laravel Homestead

I am having trouble with connecting to the server. When I type the vagrant up command it gets stuck and repeats

default: Warning: Connection timeout. Retrying...

Over and over again. After about 3 minutes or so, it gives me an error about how it timed out and lost communication with guest host. But if I run vagrant up command again it then says my VM is already running. I then type vagrant ssh and it says

ssh_exchange_identification: Connection closed by remote host

I am doing this all inside my homestead directly just like the video, so I am not sure why it is not working. Also when I close my VM by typing vagrant halt it attempts to gracefully shutdown but that does not work and it says

default: Guest communication could not be established! This is usually because SSH is not running, the authentication information was changed, or some other networking issue.

Then it forces shutdown. This makes me think there is something wrong with my ssh key, but I clicked the github link and followed the tutorial and according to github my ssh key is working just fine. If someone could shine some light on what I am doing wrong I would appreciate. Thanks in advance.

PS: I am using windows

2 Answers

Hey Julie,

It sounds like you've changed some stuff with your ssh key.. and since then it stopped working? If it's this way round, try running

vagrant provision

This should 'update' the settings to you Homestead.yaml file. I think you will need to run this after any changes to Homestead.yaml.

When I startup vagrant, I get exactly the same default: Warning: Connection timeout. Retrying... but eventually it does kick in. In cases where it hasn't, I've navigated not only to Homestead/, but to the actual directory of the site I'm trying to work in. It is probably just fluke, but I swear it has a higher success rate!

Julie Awad
Julie Awad
6,675 Points

I tried typing vagrant provision and got an error:

Vagrant timed out while attempting to connect via SSH. This usually means that the VM booted, but there are issues with the SSH configuration or network connectivity issues. Please try to 'vagrant reload' or 'vagrant up' again.

Have you tried vagrant reload? Also, can you post your Homestead.yaml file?

Julie Awad
Julie Awad
6,675 Points

I have tried reloading and it does not improve anything. here is the contents of my yaml file:

config.vm.boot_mode = :gui

VAGRANTFILE_API_VERSION = "2"

path = "#{File.dirname(FILE)}"

require 'yaml' require path + '/scripts/homestead.rb

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| Homestead.configure(config, YAML::load(File.read(path + '/Homestead.yaml'))) end

I have not changed anything except I added the top line which is supposed to bring a gui menu to help debug.

Just to make sure - this is the tutorial you followed? https://help.github.com/articles/generating-ssh-keys#platform-windows

Following the tutorial, have you double checked the ssh files to make sure everything got setup okay?

Julie Awad
Julie Awad
6,675 Points

That's the tutorial I followed and step 4 works fine

http://laravel.io/forum/05-16-2014-homestead-yaml-folder-mapping

If you search the page for "windows", you should see an example of code of a Homestead.yaml file from 'sambarocker'.

His Homestead.yaml file looks a little but more like mine (and he's operating via windows)

One thing that I can't find in yours is

authorize: c:/Users/Andre/.ssh/id_rsa.pub

keys:
    - c:/Users/Andre/.ssh/id_rsa

which point to the local ssh keys. My Hamestead.yaml file looks like this. It's quite different to yours - maybe not a simple Mac/Windows different!

---
#ip: "192.168.10.10"
ip: "10.0.10.10"
memory: 2048
cpus: 1

authorize: /Users/Tom/.ssh/id_rsa.pub

keys:
    - /Users/Tom/.ssh/id_rsa

folders:
    - map: /Users/Tom/Homestead/Projects
      to: /home/vagrant/Sites   

sites:
    - map: laravel-basics.dev
      to: /home/vagrant/Sites/laravel-basics/public   

variables:
    - key: APP_ENV
      value: local
Julie Awad
Julie Awad
6,675 Points

I am so sorry I gave you my vagrant file on mistake my yaml file looks like this:


ip: "10.0.10.10" memory: 2048 cpus: 1

authorize: /Users/Ben/.ssh/id_rsa.pub

keys: - /Users/Ben/.ssh/id_rsa

folders: - map: /Users/Ben/Homestead/Projects to: /home/vagrant/Sites

sites: - map: laravel.dev to: /home/vagrant/Sites/laravel-basics/public

variables: - key: APP_ENV value: local

I'm sure the documentation was the first place you looked - but it seems like you're getting any success because of your ssh configuration. There's a few more resources here under Set Your SSH Key

Julie Awad
Julie Awad
6,675 Points

I used the git bash to do the command they talk about.

Did you have git before or after install of Homestead?

For me, I already had an ssh key setup so skipped this step initially. But later I had an ssh problem, so deleted all the key in ssh files and started again. After deleting everything, I creating a brand new ssh key via github instructions, I ran

vagrant provision

and it kicked back into life. I'm taking a long-shot guess, you may have setup one key via your Vagrant, and another via git so there's a clash or they're not talking to eachother? That's my last input! Apart from uninstalling everything, having an ssh key already setup, and skipping the ssh key setup on reinstall.

  • turn it on and off again for good measure.

You can always install Laravel directly onto your machine http://laravel.com/docs/installation