vagrant / homestead up - connection timeout ONLY on home network - laravel

The problem
Whenever I run vagrant up (or homestead up for Laravel Homestead 2.0) I get a connection timeout error as follows;
(...usual 'vagrant up' stuff...)
==> 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: Error: Connection timeout. Retrying...
default: Error: Connection timeout. Retrying...
default: Error: Connection timeout. Retrying...
default: Error: Connection timeout. Retrying...
default: Error: 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.
(...left part out to reduce the size of this question...)
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
Important
Main key to this question is that this ONLY happens on my internet connection at home. When I'm at the office (different network) everything runs as expected. So this means it has something to do with my home network / router...?
What I'm running
Macbook Pro (late 2013)
Mac OS X 10.10.1
Router: Huawei HG556a with bridged Airport Extreme
What I've tried
I've tried so many stuff that Google almost doesn't give me new results anymore on my search queries, here are the most important ones;
Destroyed the box
Completely uninstalled Vagrant & Virtualbox, and reinstalled the latest (and tried with combinations of older) versions.
Increased the timeout to 600 and later 1200
Setting fixed IPs in the Vagrantfile
Forwarded to different ports through the Vagrantfile
Set my mac to use the DNS 8.8.8.8 and 8.8.4.4
Enabled the GUI which results in homestead login:, which is the same compared to when it works just fine at the office. Even tried logging in with user vagrant and pass vagrant
I really hope someone can give a working solution, I've seriously been at it a couple of days now...
Of course, solutions and good answer will be rewarded with upvotes and marked as answer!

Don't forget to add the "domains" for your Nginx sites to the hosts file on your machine! The hosts file will redirect your requests for the local domains into your Homestead environment. On Mac and Linux, this file is located at /etc/hosts. On Windows, it is located at C:\Windows\System32\drivers\etc\hosts. The lines you add to this file will look like the following:
192.168.10.10 homestead.app
In windows, you have to run notepad as an administrator when accessing and editing your etc/hosts file

I had the same issue.
In my case I destroy the homestead box and recreated it and all work
just fine since.
I just ran the following:
- homestead destroy
- homestead up
Hopes it helps.

Related

I can't start Laravel Homestead on MacOS using VMWare (port collision)

I tried to setup a new Laravel project this afternoon and I must have did something to my Homestead/Vagrant configuration that ruined it. I think the command I used was vagrant reload {id}.
Now when I try to start my machine, I get the following error:
Bringing machine 'homestead-7' up with 'vmware_fusion' provider...
==> homestead-7: Checking if box 'laravel/homestead' is up to date...
==> homestead-7: Verifying vmnet devices are healthy...
==> homestead-7: Preparing network adapters...
Vagrant found a port collision for the specified port and virtual machine.
While this port was marked to be auto-corrected, the ports in the
auto-correction range are all also used.
VM: homestead-7
Forwarded port: 80 => 8000
When I run Vagrant global-status, I get this:
id name provider state directory
-----------------------------------------------------------------------
410757f homestead-7 vmware_fusion not running /Users/Me/Homestead
I can't run vagrant reload 410757f as I get the same error above, and I can't provision the machine because it needs to be running.
I'm confused as to whats happening here. There is a networking colission, but I don't have any other vagrant boxes. I currently have 4 other Windows VM's, but I made sure I shut down each machine.
I've even tried destroying and recreating the homestead box (no luck). Any ideas?
Edit To extend on this, I tried looking for the process using sudo lsof -i :8000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
vmnet-nat 3943 root 42u IPv4 0x70d4a03b6f2dddd 0t0 TCP *:irdmi (LISTEN)
I killed that using sudo kill -9 3943 and ran sudo lsof -i :8000 again, which gave me nothing, then running homestead up again gave me the same error.
I seemed to solve this by removing and reinstalling VMWare.
Based on my readings online, the issue seemed to be with a cached setting relating to a previous VM on Fusion. Rather than hunt down what that might have been, I thought it was easier to just delete everything and reinstall.
I followed the instructions here and then downloaded and reinstalled it from the VMWare website.
I hope this helps someone in the future!

Laravel 5.3 Homestead Installation on Win 10

Following >> https://laravel.com/docs/5.3/homestead
bash init.sh
cp: overwrite '/c/Users/myuser/.homestead/Homestead.yaml'? y
cp: overwrite '/c/Users/myuser/.homestead/after.sh'?
cp: overwrite '/c/Users/myuser/.homestead/aliases'?
Homestead initialized!
I don't know if these needs to be overwritten ?
Also , I configure homestead.yaml
folders:
- map: ~/Homestead
to: /home/vagrant/Code
It is showing error[The host path of the shared folder is missing: ~/Homestead]
My homestead installation is
$ pwd
/Homestead
I am sure some steps are missing can someone help
Installation method - Per Project Installation
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Running provisioner: shell...
SSH authentication failed! This is typically caused by the public/private
keypair for the SSH user not being properly set on the guest VM. Please
verify that the guest VM is setup with the proper public key, and that
the private key path for Vagrant is setup properly as well.
It is a fresh installation !
vagrant destroy && up
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: Remote connection disconnect. Retrying...
default: Warning: Authentication failure. 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.
Yes, you should overwrite these files so as to have a clean installation of Homestead (just in case). Now, the reason you are getting this error is because your YAML configuration is wrong. Assuming you have your Laravel code in a Code folder in your Documents folder, your YAML should look like this (NB: this is Windows specific!):
folders:
- map: "C:/Users/Username/Documents/Code"
to: "/home/vagrant/Code"
You need to map the folder containing your local code to a folder in your virtual machine. This will then be set up using shared folders. This way, any code changes in your Code folder will be mirrored to your VM.
Personally, I prefer the Per Project Installation because I can have multiple projects running on different VMs mapped to different domains, at the same time. Check it out here: https://laravel.com/docs/5.3/homestead#per-project-installation

Vagrant Connection timeout

So after running vagrant up on my Linux Mint machine, I'm getting this output:
==> 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...
I've been looking for solution, and everywhere seems to point to enable virtualization in the bios. The problem is, there's no option to do that in my bios, on Toshiba L75D-A7283. Funny thing is, I am actually able to run different virtual machines, such as Windows 7 using virtual box, without any problems. The only issue that I have is during vagrant up and this connection timeout. Is there anything else I can do about this?
Vagrant version: Vagrant 1.7.4
VirtualBox version: 5.0.8
I had the connection timeout problem after updating to the mentioned versions of VB and Vagrant with ubuntu/trusty64 guest machine , and finally this fixed my problem:
It turns out that as I was messing around with getting the machine to load (due to Virtualization technologies being disabled), I clicked one too many items on the image settings page.
To fix this, go to the "Settings" page for the virtual machine, and click "System". Under the "motherboard" options, be sure that "Enable EFI (special OSes only)" is unchecked. Then click "OK", and try to boot the machine again. The option that was checked is basically how you get into the EFI Interface.
https://askubuntu.com/a/162149

Laravel homestead stuck on VM login

Ill try to use laravel homestead vagrant box. When I do vagrant up it stucks on
default: Warning: Connection refused. Retrying...
My intel virtualization technology is enabled. I've enabled the GUI and it shows:
I've got Vagrant 1.6.5 and VirtualBox 4.3.16.
Anybody has encountered this problem as well...?
Default login and password is just vagrant.
A few things to try:
First, make sure your virtual machine is completely shut down, and relaunch Virtual Box.
Make sure "PAE/NX" is enabled, which you can do in the processor tab
of the Virtual Box GUI. A description of how to do that is
here.
When vagrant up gets stuck at Warning: Connection refused.
Retrying..., try entering vagrant as both the username and
password in the GUI and see if it will continue the loading process.
See related StackOverflow questions Vagrant stuck connection
timeout
retrying
and Vagrant up
timeout.
Also just in case check if the network adapter #1 is cable connected. That fixed the issue for me (ie: on VirtualBox > box settings > Network > Adapter 1 > Advanced > tick "Cable Connected). Or better, add this to your vagrant file:
config.vm.provider 'virtualbox' do |vb|
vb.customize ['modifyvm', :id, '--cableconnected1', 'on']
end
You can simply type vagrant ssh on the command line / terminal of the host machine (Assuming you've already fired up the machine with vagrant up). To quote the vagrantup.com website:
This command will drop you into a full-fledged SSH session

how to correctly suspend vagrant vm on Mac OS X to be able to resume it without trubbles?

I'am using vagrant + virtualBox on Mac OS X for some python development with multi vm environment with use of salt
When I end my work I am suspending the machine. with vagrant suspend
But when I try to vagrant resume then it alwyas crashes and I have to go through whole time consuming process of vagrant destroy, vagrant up, and salt.
How to deal with it?
(please do not provide replacment of virtual box with wmware fusion as a solution I must stay open source)
UPDATE
It looks like this when called vagrant resume:
➜ four vagrant resume
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2200
default: SSH username: vagrant
default: SSH auth method: private key
default: Error: Connection refused. Retrying...
default: Error: Connection refused. Retrying...
default: Error: Connection refused. Retrying...
default: Error: Connection refused. Retrying...
default: Error: Connection refused. Retrying...
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'restoring, running'. The machine is in the
'aborted' state. Please verify everything is configured
properly and try again.
If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.
UPDATE:
I strongly recommend using reload instead of resume.
Make sure you are using the latest VirtualBox 4.3.10 and Vagrant 1.5.4, install VirtualBox Guest Additions (or upgrade it to the latest available, manually or use vagrant-vbguest etc).
When vagrant commands like reload, suspend, resume doesn't work. Try to use more native VBoxManage commands to control the VM.
For example, if it cannot be resumed (from pause in VirtualBox terminology) or crashes when running vagrant resume, try to get the UUID or VM_NAME and use VBoxManage to resume it OR do a hard reboot.
NOTE: Normally there is NO need to destroy and spin-up a new box from the base box to fix this kind of issue.
To get the VM name or UUID
VBoxManage list runningvms or VBoxManage list vms
To get the state of the VM
VBoxManage showvminfo UUID_OR_NAME | grep -i state
To resume from pause (vagrant suspend)
VBoxManage controlvm UUID_OR_NAME resume
NOTE: if it is in Saved state, use VBoxManage startvm UUID to start it.
If the above doesn't work, shut it down and restart
VBoxManage controlvm UUID_OR_NAME poweroff
and then do a vagrant up
HTH
In my case, this was happening because Grub was offering a choice of boot modes after the unexpected restart. You can see this if you set v.gui = true in your Vagrantfile (and re-provision the VM).
I think the best course of action in the future would be to disable this boot menu, but I was not able to accomplish that successfully.
What does work for me is the following sequence for sending an Enter key code to the VM (this is what was needed to select the normal boot mode):
VBoxManage list runningvms
VBoxManage controlvm VM_ID_FROM_PREVIOUS_COMMAND keyboardputscancode 1c
If you know you only have one VirtualBox VM running on your machine, you can use the following one-liner (I recommend putting it in a script and adding the script to your path):
VBoxManage controlvm `VBoxManage list runningvms | sed 's/{.*//' | sed 's/"//g'` keyboardputscancode 1c

Resources