Vagrant Up VAB: Warning: Remote connection disconnect. Retrying - laravel

Anyone know what is going on with Vagrant?
Using Windows 10, VScode, Virtualbox 6.1.10
i have done googling and not found anything helpful
one person said to Use config.ssh.insert_key = false in your Vagrantfile and then try.
but doing so did not work (or not sure where to put it in my vagrantfile)
VAB: Booting VM...
==> VAB: Waiting for machine to boot. This may take a few minutes...
VAB: SSH address: 127.0.0.1:2222
VAB: SSH username: vagrant
VAB: SSH auth method: private key
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. Retrying...
VAB: Warning: Remote connection disconnect. 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.
here is the vagrant file without any modifications.
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'json'
require 'yaml'
VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))
homesteadYamlPath = File.expand_path("Homestead.yaml", File.dirname(__FILE__))
homesteadJsonPath = File.expand_path("Homestead.json", File.dirname(__FILE__))
afterScriptPath = "after.sh"
customizationScriptPath = "user-customizations.sh"
aliasesPath = "aliases"
require File.expand_path(confDir + '/scripts/homestead.rb')
Vagrant.require_version '>= 1.9.0'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exist? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
config.vm.provision "shell" do |s|
s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases"
end
end
if File.exist? homesteadYamlPath then
settings = YAML::load(File.read(homesteadYamlPath))
elsif File.exist? homesteadJsonPath then
settings = JSON::parse(File.read(homesteadJsonPath))
else
abort "Homestead settings file not found in " + File.dirname(__FILE__)
end
Homestead.configure(config, settings)
if File.exist? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
end
if File.exist? customizationScriptPath then
config.vm.provision "shell", path: customizationScriptPath, privileged: false, keep_color: true
end
if defined? VagrantPlugins::HostsUpdater
config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
end
end

Steps
vagrant destroy -f
deleted the old '.vagrant' directory
vagrant up

Best solution is not destroying the VM every time this error pops out (I did it for a while), since that will require a lot of time for the VM re-creation.
The straight forward solution is to just go into the oracle box and open the remote terminal and press S to skip the mounting since the box is hanging when booting up (do this just after you run vagrant up).

Related

Mac | homestead: Warning: Remote connection disconnect. Retrying

After adding dnsmasq in mac, I am getting below error in vagrant,
nat: Warning: Remote connection disconnect. Retrying...
nat: Warning: Remote connection disconnect. Retrying...
nat: Warning: Remote connection disconnect. Retrying...
nat: Warning: Remote connection disconnect. Retrying...
nat: Warning: Remote connection disconnect. Retrying...
nat: Warning: Remote connection disconnect. Retrying...
nat: Warning: Remote connection disconnect. Retrying...
nat: Warning: Remote connection disconnect. Retrying...
nat: Warning: Remote connection disconnect. 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.
Fixed,
After destroying vagrant and installing again it's working properly.
vagrant destroy

Vagrant up stuck

I'm running vagrant up and I'm facing an issue that it seemed to be this one at the beginning Vagrant stuck connection timeout retrying. I've tried all the solutions in there, I also did a vagrant destroy, but as soon as I do vagrant suspend, then the vagrant up command doesn't work, I have to quit and do vagrant reload to get the VM working. It's very annoying and frustrating.
I'm using vagrant homestead version 0.4.4 at the moment and a part of this issue everything works perfectly once the VM is started.
My current system is OSX El Captain.
Let me know if you need more details.
My Vagrantfile:
require 'json'
require 'yaml'
VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))
homesteadYamlPath = "Homestead.yaml"
homesteadJsonPath = "Homestead.json"
afterScriptPath = "after.sh"
aliasesPath = "aliases"
require File.expand_path(confDir + '/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
if File.exists? homesteadYamlPath then
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
elsif File.exists? homesteadJsonPath then
Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath)))
end
if File.exists? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath
end
end
Command up output when error:
~/Projects/credentialsApi (feature/10)$vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: A newer version of the box 'laravel/homestead' is available! You currently
==> default: have version '0.4.4'. The latest is version '0.5.0'. Run
==> default: `vagrant box update` to update.
==> default: Resuming suspended VM...
==> 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: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. 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.
~/Projects/credentialsApi (feature/10)$
vagrant ssh-config command output:
~/Projects/credentialsApi (development)$vagrant ssh-config
Host default
HostName 127.0.0.1
User vagrant
Port 2204
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile "/Users/pabloleone/Projects/credentialsApi/.vagrant/machines/default/virtualbox/private_key"
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes
I finally fixed the issue. It was due to versions. I just upgraded vagrant and the VM.
First of all, try to run vagrant with VAGRANT_LOG=debug variable to debug the issue.
If that won't help, while it's showing you timeout messages, in another terminal run: vagrant status to see whether the VM is running correctly or not. Or run VirtualBox directly from GUI and check the machine state.
If it's running, check whether SSH credentials are correct, by the following command:
vagrant ssh-config
in order to:
check the hostname and port (e.g. 127.0.0.1:2222),
your private key (IdentityFile).
Also try logging in to the VM manually by:
vagrant ssh
or by this command (change default to proper host from above ssh-config command):
vagrant ssh-config > vagrant-ssh && ssh -F vagrant-ssh default
Since it works for you after vagrant reload (so your virtualization support in BIOS is likely enabled), possibly that your SSH server is not started by default on resume due to some issues. You should then check the SSH logs by fixing it via vagrant reload && vagrant ssh and check whether the logs by:
sudo tail /var/log/secure
If that's the case, for workaround to check whether the SSH service is run, add the following line like:
config.vm.provision :shell, run: "always", path: "scripts/check_ssh_service.sh"
Similar issue: Apache doesn't start after Vagrant reload
Finally check the following list for possible solutions to the SSH timeout problem:
Make sure your firewall or antivirus is not blocking the program (which I doubt will happen often)
Give your vagrant machine some time for timeouts to happen. If you dont have a very fast PC / Mac, the VM will take while to boot into an
SSH ready state, so timeouts will happen.
Therefore, first try to let vagrant timeout COMPLETELY before concluding that there is a fault.
If vagrant times out completely then increase the timeout limit in the vagrant file to a few min and try again.
If that still doesnt work, then try to clean boot your vagrant machine through the VirtualBox interface and enable the GUI of the
machine beforehand. If the GUI doesn't show anything happening (ie.
just blackscreen, no text) while it is booting, then your vagrant
machine has got problems.
Destroy the entire machine through the VB interface and reinstall.
Delete the ubuntu image files in the Vagrant Images folder in the user folder and redownload and install.
Do you even have an intel processor that supports 64bit hardware virtualisation? Google it. If you do, make sure there is no setting in
your Bios disabling this feature.
Disable hyper-v feature if you are running windows 7 or 8. Google how to disable.
Make sure you are running through an SSH enabled client. Use Git bash. Download: http://git-scm.com/downloads
Install a 32bit version of ubuntu like trusty32 or precise32. Just change the version in the vagrant file and reinstall vagrant in new
directory.
Make sure you are using the latest vagrant and virtualbox versions.
Last resorts: Format your computer, reinstall windows and buy an intel core isomething processor.
Source: GitHub post by #dezinerdudes
See also: SSH Timeout - Cant connect via ssh no matter what

Vagrant: undo all changes made by setting static private ip

Vagrant was running great for me and now vagrant up takes forever to boot 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: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
After about 30 of these messages and a few minutes later it finally goes through.
The only thing I changed was I set a private static ip address:
config.vm.network "private_network", ip: "192.168.33.10" in the Vagrant file.
I have since commented this line out of the vagrant file. How can I undo all changes that were made when I changed this setting? I have deleted the files in /var/lib/dhcp/ but this didn't seem to help.

Vagrant: Debug Slow Starting VM

I'm using vagrant to setup a virtual environment on a programming project. Virtual Box is the VM provider. I'm working on a Windows workstation. This is borderline server fault territory -- but since I'm using vagrant to setup an environment for a programming project I'm asking on Stack Overflow.
When I run
vagrant up
Vagrant can take "a long time" (up to 5 minutes) to start the virtual machine. From my side (starting vagrant from a "Git Bash" shell) I see this
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
This continues for a while, and the server eventually comes up. Also, occasionally, the SSH connection will die between 12 - 24 hours after I do a vgrant up -- this forces a halt -f/re-up.
If I start the machine from Virtual Box itself, here's the relevant section of the start up routine.
The halting seems to happen when this screen reads
Waiting 10 Seconds for a Network Device
Waiting 120 Seconds for a Network Device
This seems abnormal (and certainly annoying) behavior and I'd like to debug why it's happening -- However, I'm not familiar enough with the workings of vagarnt or virtual machines to know where I should start. I'd love a magic solution to my problem, but all I'm really after is "where do I start digging"

Allow two or more vagrant VMs to communicate on their own network

I want to create multiple servers that can communicate directly with each other without using public IPs. They'll still need internet access but nothing from outside the network will need to connect to them. Creating one box usually works, but when I add additional servers the networking fails.
MacOS: 10.8.5
Virtualbox: 4.3.12
GuestOS: Ubuntu "precise64"
Using version 2 of the Vagrant config
Most of the time if I use private network I get:
saltminion01: Warning: Connection timeout. Retrying...
saltminion01: Warning: Connection timeout. Retrying...
saltminion01: Warning: Connection timeout. Retrying...
saltminion01: Warning: Connection timeout. Retrying...
saltminion01: Warning: Connection timeout. Retrying...
saltminion01: Warning: Connection timeout. Retrying...
saltminion01: Warning: Connection timeout. Retrying...
saltminion01: Warning: Connection timeout. Retrying...
saltminion01: Warning: Connection timeout. Retrying...
Does anybody have a sample Vagrantfile that does this?
Here's an example which creates two VMs:
alpha 10.0.0.10
beta 10.0.0.11
From inside either VM you can reach the other by IP address, and can connect to the outside world.
Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrant multi-machine sample setup
Vagrant.configure("2") do |config|
config.vm.define :alpha do |alpha|
alpha.vm.box = "hashicorp/precise64"
alpha.vm.network :private_network, ip: "10.0.0.10"
alpha.vm.hostname = "alpha"
end
config.vm.define :beta do |beta|
beta.vm.box = "hashicorp/precise64"
beta.vm.network :private_network, ip: "10.0.0.11"
beta.vm.hostname = "beta"
end
end

Resources