Can't provision authorized_keys file into VM using Vagrant - vagrant

I am trying to use my own pair of RSA SSH-2 keys with Vagrant 1.9.5 on VirtualBox 5.1.22 with Windows 7 SP1 host and a CentOS 7.3 guest.
When I execute vagrant up I get :
Waiting for machine to boot. This may take a few minutes...
SSH address: 127.0.0.1:2222
SSH username: vagrant
SSH auth method: private key
Warning: Connection aborted. Retrying...
Warning: Connection reset. Retrying...
Warning: Connection aborted. Retrying...
Warning: Connection reset. Retrying...
Warning: Connection aborted. Retrying...
Warning: Connection reset. Retrying...
Warning: Connection aborted. Retrying...
...
I have found that the cause is failing to connect to the guest because the required key is not being added to ~/.ssh/authorized_keys but it contains Vagrant's default insecure_private_key.
This is my Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.boot_timeout = 120
config.ssh.insert_key = false
config.ssh.private_key_path = ["vagrant-setup/keys/my_openssh.key"]
# This is not copying authorized_keys to the guest
config.vm.provision "file", source: "vagrant-setup/.ssh/authorized_keys", destination: "~/.ssh/autorized_keys"
# Setting forward_agent to true and adding the key to Pageant doesn't make any difference
config.ssh.forward_agent = false
config.vm.define "MyMachineName" do |vs|
vs.vm.box = "vagrant-centos-73-x86_64-puppet"
vs.vm.box_url = "https://github.com/CommanderK5/packer-centos-template/releases/download/0.7.3/vagrant-centos-7.3.box"
# The shell script that will execute once just after the VM is created
vs.vm.provision "shell", path: "vagrant-setup/setup.sh"
# Create a private network, which allows host-only access to the machine using a specific IP.
config.vm.network "private_network", ip: "192.168.101.110"
vs.vm.provider "virtualbox" do |vb|
# Enable the GUI of VirtualBox and see whether the VM is waiting for input on startup
vb.gui = false
end
end
end
I have tried copying autorized_keys using vm.provision "shell" and cp from the guest. I have tried to change the permissions of autorized_keys on the guest before copying but nothing seems to work because it does not connect. And I have tried to perform the copy inside MyMachineName like vs.vm.provision "file", ...
If I login in once using vagrant ssh with user+password and I write authorized_keys by hand then afterwards I am able to log in with the SSH key and no password.
vagrant ssh-config reports
Host MyMachineName
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile C:/MyMachineName/vagrant-setup/keys/my_openssh.key
IdentitiesOnly yes
LogLevel FATAL
Putting the private key into C:\Users\My User Name\.ssh\id_rsa seems to make some difference, like if Vagrant was still looking for something there despite I explicitly set my own private key, but does not make it work. And it also seems to have a problem with C:\Users\My User Name\ having spaces but since it should not be used then that should not matter.
So the question is How do I make Vagrant work with my own pair of SSH keys without having to tweak the guest VM by hand?
There are plenty of replies at this other question, but most of them come down to put the key in authorized_keys by hand, which is exactly what I am trying to avoid.

Based on Frédéric Henri comment, this is what worked for me in order to login only with my own key and not insecure key nor user+password :
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.insert_key = false
rsakey = File.read("vagrant-setup/keys/authorized_keys")
config.vm.provision "shell", inline: <<-EOC
echo '#{rsakey}' >> /home/vagrant/.ssh/authorized_keys
sed --in-place=.bak -r 's/^#?(PermitRootLogin|PermitEmptyPasswords|PasswordAuthentication|X11Forwarding) yes/\1 no/' /etc/ssh/sshd_config
sed --in-place=.bak '/== vagrant insecure public key$/d' /home/vagrant/.ssh/authorized_keys
EOC
config.vm.define "MyMachine" do |vs|
vs.vm.box = "vagrant-centos-73-x86_64-puppet"
vs.vm.box_url = "https://github.com/CommanderK5/packer-centos-template/releases/download/0.7.3/vagrant-centos-7.3.box"
# SSH settings
vs.ssh.private_key_path = ['~/.vagrant.d/insecure_private_key', "vagrant-setup/keys/my_openssh.key"]
# The shell script that will execute once just after the VM is created
vs.vm.provision "shell", path: "vagrant-setup/my_own_custom_setup_stuff.sh"
# Create a private network, which allows host-only access to the machine using a specific IP.
config.vm.network "private_network", ip: "192.168.101.110"
end
end

Related

Laravel Homestead: requested URL could not be retrieved (working behind proxy)

I'm working on a Windows 10 notebook behind a corporate proxy. Finally I've managed to set up VirtualBox, Vagrant and Homestead.
Unfortunately I'm not able to access my sites in the browser. It says: the requested URL could not be retrieved, unable to determine IP address from host name "test.app".
I've installed the vagrant plugin vagrant-proxyconf and set it up in my Vagrantfile within my Homestead-folder. I've added the following lines to my Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'json'
require 'yaml'
VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))
homesteadYamlPath = confDir + "/Homestead.yaml"
homesteadJsonPath = confDir + "/Homestead.json"
afterScriptPath = confDir + "/after.sh"
aliasesPath = confDir + "/aliases"
require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')
Vagrant.require_version '>= 1.9.0'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.http = "http://proxy.my.proxy.com:3128"
config.proxy.https = "http://proxy.my.proxy.com:3128"
config.proxy.no_proxy = "localhost,127.0.0.1,192.168.10.10"
end
# ... default configuration
end
This is my Homestead.yaml:
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: C:/Users/wn00111510/Projekte/ContentAnalyzer
to: /home/vagrant/contentanalyzer
- map: C:/Users/wn00111510/Projekte/Test
to: /home/vagrant/test
sites:
- map: test.app
to: /home/vagrant/test
databases:
- homestead
My hosts-file has only one entry:
192.168.10.10 test.app
The machine is running and I'm able to login into my virtual machine via vagrant ssh. vagrant reload --provision does not change something.
During booting there is a warning about a connection reset:
...
Booting VM...
Waiting for machine to boot. THis may take a few minutes...
SSH address: 127.0.0.1:2222
SSH username: vagrant
SSH auth method: private key
Warning: Connection reset. Retrying...
Warning: Remote Connection disconnect. Retrying...
Warning: Connection reset. Retrying...
Warning: Remote Connection disconnect. Retrying...
Warning: Connection reset. Retrying...
Machine booted and ready!
...
Any ideas?
I'm no expert on proxies, but since this is local to your machine you should be able to just bypass any proxy. Have you tried without the proxy plugin?.
The errors here:
Warning: Connection reset. Retrying...
Warning: Remote Connection disconnect. Retrying...
Are usually no big deal as long as the machine connects in a reasonable time.
Since you're only mapping 1 site to the machine, you should also be able to bypass DNS completely by using http://localhost:8000 (or different port that Vagrant mapped to 80 during the vagrant up process).

Vagrant GuestAdditions seems to be installed (5.1.20) correctly, but not running

I want to copy one entire folder present on my windows machine to a vm hosting ubuntu/trusty64.
But every time I try to bring my vagrant up i get below error message.
vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Configuring proxy for Apt...
==> default: Configuring proxy environment variables...
[default] GuestAdditions seems to be installed (5.1.20) correctly, but not running.
vboxadd: unrecognized service
vboxadd-service: unrecognized service
bash: line 4: setup: command not found
==> default: Checking for guest additions in VM...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
setup
Stdout from the command:
Stderr from the command:
bash: line 4: setup: command not found
Note:
Ubuntu version is up to date as you can see in the third line.
Vagrant version : Vagrant 1.9.3
Windows version : Windows 7 Enterprise Service Pack 1
Oracle VirtualBox version : Version 5.1.20 r114628 (Qt5.6.2)
On running the command vbguest status i get
$ vagrant vbguest --status
[default] GuestAdditions seems to be installed (5.1.20) correctly, but not running.
My vagrant file contents are
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/trusty64"
config.ssh.insert_key = false
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network "private_network", ip: "xxxxx"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
#config.vm.synced_folder "../data", "/vagrant_data" , "/vagrant"
config.vm.synced_folder ".", "/mydata", :mount_options => ['dmode=775','fmode=664']
#config.vm.synced_folder "./", "/vagrant", id: "vagrant-root", type: "nfs"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# apt-get update
# apt-get install -y apache2
# SHELL
if Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.http = "xxxxx"
config.proxy.https = "xxxxx"
config.proxy.ftp = "xxxxx"
config.apt_proxy.http = "xxxxx"
config.apt_proxy.https = "xxxxx"
config.proxy.no_proxy = "xxxxx"
end
if !Vagrant.has_plugin?("vagrant-proxyconf")
system('vagrant plugin install vagrant-proxyconf')
raise("vagrant-proxyconf installed. Run command again.");
end
end
Please suggest
1. How can i correct this error?
2. Share the complete folder from windows to vm?
Connect the Guest VM using WinSCP. Copy the VBoxGuestAddition.iso from the host machine. In my case, the VBoxGuestAddition present in C:\ProgramFiles\Oracle\VirtualBox.
Once iso file copied to Guest VM, login to GUest VM using putty.
mkdir /media/GuestAdditionsISO
Then execute the below command
mount -o loop /path/of/VBoxGuestAddition.iso /media/GuestAdditionsISO
Once mount command executed successfully,
cd /media/GuestAdditionsISO
sudo ./VBoxLinuxGuestAddition.run
Then re-start the VM. This works for me

Vagrant ssh authentication failure on windows

I am trying to get Linux Ubuntu 32 bit box running on Windows VM Ware. I was following a course on UDACITY and they told me to install these software. I don't know much about how to run these software. I tried to find answers on Stack but it was all on different OS not Windows. I tried some edit also by enabling GUI and i also added Vagrant configure in Vagrantfile.
Having a problem with ssh authentication:
Error:
e2sn7cy#EMR-HZDEV08-003 /C/Users/e2sn7cy/fullstack/vagrant (master)
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty32' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 8000 => 1234 (adapter 1)
default: 8080 => 8080 (adapter 1)
default: 5000 => 4321 (adapter 1)
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
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.
My Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider :virtualbox do |vb|
vb.gui = true
end
Vagrant.configure("2") do |config|
config.ssh.private_key_path = "~/.ssh/id_rsa"
config.ssh.forward_agent = true
end
config.vm.provision "shell", path: "pg_config.sh"
# config.vm.box = "hashicorp/precise32"
config.vm.box = "ubuntu/trusty32"
config.vm.network "forwarded_port", guest: 8000, host: 1234
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.network "forwarded_port", guest: 5000, host: 4321
end
My pg_config.sh
apt-get -qqy update
apt-get -qqy install postgresql python-psycopg2
apt-get -qqy install python-flask python-sqlalchemy
apt-get -qqy install python-pip
pip install bleach
pip install oauth2client
pip install requests
pip install httplib2
su postgres -c 'createuser -dRS vagrant'
su vagrant -c 'createdb'
su vagrant -c 'createdb forum'
su vagrant -c 'psql forum -f /vagrant/forum/forum.sql'
vagrantTip="[35m[1mThe shared directory is located at /vagrant\nTo access your shared files: cd /vagrant(B[m"
echo -e $vagrantTip > /etc/motd
you can open the gui mode to see what happened in your virtual machine.
do not change the default configuration, download a new box and use the default config
if you want to use the python development environment, you can download a box including all python environment
Try setting config.vm.boot_timeout to a higher value, default is 300. Like this:
config.vm.box = "ubuntu/trusty32"
config.vm.boot_timeout = 600

Vagrant Connection timeout error

I'm trying to follow instructions in a book which involve bringing up a vagrant instance based on a Vagrantfile that I downloaded from git clone https://github.com/jorhett/learning-puppet4. For convenience, here are the contents of the Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.5.2"
# Copy files into place
$setupscript = <<END
# Hardlock domain name
echo 'supercede domain-name "example.com";' > /etc/dhcp/dhclient.conf
# Install etc/hosts for convenience
cp /vagrant/etc-puppet/hosts /etc/hosts
# Install puppet.conf in user directory to quiet deprecation warnings
#mkdir -p /home/vagrant/.puppetlabs/etc/puppet
#cp /vagrant/etc-puppet/puppet.conf /home/vagrant/.puppetlabs/etc/puppet
#chown -R vagrant:vagrant /home/vagrant/.puppetlabs
# Install example hiera settings in global directory
mkdir -p /etc/puppetlabs/puppet
cp -r /vagrant/etc-puppet/* /etc/puppetlabs/puppet/
mkdir -p /etc/puppetlabs/code
chown -R vagrant:vagrant /etc/puppetlabs
# Provide the URL to the Puppet Labs yum repo on login
echo "
You should start by enabling the Puppet Labs Puppet Collection 1 release repo
sudo yum install http://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
Then install Puppet 4 and its companion packages
sudo yum install -y puppet-agent
" > /etc/motd
# Enable MotD
sed -i -e 's/^PrintMotd no/PrintMotd yes/' /etc/ssh/sshd_config
systemctl reload sshd
END
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "puppetlabs/centos-7.0-64-nocm"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--natdnsproxy1", "off"]
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "off"]
end
# Default client
config.vm.define "client", primary: true do |client|
client.vm.hostname = "client.example.com"
client.vm.network :private_network, ip: "192.168.250.10"
client.vm.provision "shell", inline: $setupscript
end
# A puppetmaster
config.vm.define "puppetmaster", autostart: false do |puppetmaster|
puppetmaster.vm.hostname = "puppetmaster.example.com"
puppetmaster.vm.network :private_network, ip: "192.168.250.5"
puppetmaster.vm.provision "shell", inline: $setupscript
end
# Puppet Server
config.vm.define "puppetserver", autostart: false do |puppetserver|
puppetserver.vm.hostname = "puppet-server.example.com"
puppetserver.vm.network :private_network, ip: "192.168.250.6"
puppetserver.vm.provision "shell", inline: $setupscript
puppetserver.vm.provider :virtualbox do |ps|
ps.memory = 1024
end
end
end
When running vagrant up client I get the following output that ends with an error:
Bringing machine 'client' up with 'virtualbox' provider...
==> client: Importing base box 'puppetlabs/centos-7.0-64-nocm'...
==> client: Matching MAC address for NAT networking...
==> client: Checking if box 'puppetlabs/centos-7.0-64-nocm' is up to date...
==> client: Setting the name of the VM: learning-puppet4_client_1439117612834_66
905
==> client: Clearing any previously set network interfaces...
==> client: Preparing network interfaces based on configuration...
client: Adapter 1: nat
client: Adapter 2: hostonly
==> client: Forwarding ports...
client: 22 => 2222 (adapter 1)
==> client: Running 'pre-boot' VM customizations...
==> client: Booting VM...
==> client: Waiting for machine to boot. This may take a few minutes...
client: SSH address: 127.0.0.1:2222
client: SSH username: vagrant
client: SSH auth method: private key
client: Warning: Connection timeout. Retrying...
client: Warning: Connection timeout. Retrying...
client: Warning: Connection timeout. Retrying...
client: Warning: Connection timeout. Retrying...
client: Warning: Connection timeout. Retrying...
client: Warning: Connection timeout. Retrying...
client: Warning: Connection timeout. Retrying...
client: Warning: Connection timeout. Retrying...
client: Warning: Connection timeout. Retrying...
client: Warning: Connection timeout. Retrying...
client: Warning: Connection timeout. Retrying...
client: Warning: Connection timeout. Retrying...
client: Warning: Connection timeout. Retrying...
client: Warning: Connection timeout. Retrying...
client: Warning: Connection timeout. Retrying...
client: Warning: Connection timeout. Retrying...
client: Warning: Connection timeout. Retrying...
client: Warning: Connection timeout. Retrying...
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.
How to troubleshoot and fix this error?
This is happening at a really low level -- the Vagrant instance isn't booted far enough for provisioning to happen, so nothing you quoted from the Vagrantfile is relevant.
Look for an issue with the Vagrant setup on your machine, and check your machine's logfiles. In particular, check for out of memory conditions.
You can try reducing the Vagrantfile to something really simple, without any of the provisioning stuff and work with that until the virtual machine boots up.
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.5.2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "puppetlabs/centos-7.0-64-nocm"
# Default client
config.vm.define "client", primary: true do |client|
client.vm.hostname = "client.example.com"
client.vm.network :private_network, ip: "192.168.250.10"
end
end

Laravel Homestead not working, it just keeps on timing out

I'm trying to set up Laravel Homestead on Windows 8.1 x64 and I can't seem to get passed the error below.
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Setting the name of the VM: casensitive_default_1420409560257_10693
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
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.
This is a very popular error with Homestead, and I've found a couple similar posts on stackoverflow such as: one, and two. But setting the boot_mode in my Vagrantfile didn't fix the issue.
Vagrant.configure("1") do |config|
config.vm.boot_mode = :gui
end
To make sure I had VT-x I downloaded intels tool, which I do: i7 core; and I checked that Virtualization is enabled in BIOS.
In the Vagrantfile I'm using defaults (most of it appears to be commented out) and I've set config.vm.box to:
"laravel/homestead"
and my Homestead.yaml is set to (and already had id_ras.pub and id_rsa):
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/d/projects
to: /home/vagrant/projects
sites:
- map: roopla.app
to: /home/vagrant/projects/test_app/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
This is pretty far out of my normal Composer, PHP, GruntJS, BowerJS, AngularJS day, and I'm not sure what I'm really doing, initially I was just learning Laravel 4/5 and then I jumped sideways because Homestead looked useful and kewl, so I'm just blindly following instructions so any snippets of knowledge that can be imparted would be much appreciated.
First, make sure you haven't turned on Hyper-V.
Second, probably you have problem with ssh keys. The simplest solution is to alter your vagrant file not to use SSH keys but login and password.
Look at my vagrantfile:
require 'json'
require 'yaml'
VAGRANTFILE_API_VERSION = "2"
homesteadYamlPath = File.expand_path("Homestead.yaml")
afterScriptPath = File.expand_path("after.sh")
aliasesPath = File.expand_path("aliases")
require_relative 'scripts/homestead.rb'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exists? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
end
config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
if File.exists? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath
end
config.vm.network "forwarded_port", guest: 11300, host: 11301
end
I've added here 2 lines:
config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
because I had the same problem as you and now Homestead works for me without any problems.

Resources