Vagrant | Homestead - vagrant up command connection timeout - vagrant

When I execute the 'vagrant up' command, it says
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.

Related

Skip/Ignore boot errors for vagrant up

Hi Guys I have a situation where I don't want use vagrant user or any other user for ssh. Whenever I do vagrant up the VM's boots and I get the below error for ssh. Its because of timeout as it is unable to find vagrant user. By default when we do vagrant up the vagrants checks for vm to boot and it does the same by sshing. Is there is way where I can ignore this bootstrap error or skip the ssh step? I did an extensive search and unable to find any documentation regarding the same. The reason I need this is because I have multiple VM which needs to be started one by one. I need to skip this error or ignore the below error so that all the VM's are started.
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.

Vagrant hangs after macOS upgrade

After upgrading to macOS Mojave, my local vagrant stopped working with timeout error after SSH auth method: private key as below:
mch1: SSH address: 127.0.0.1:2222
mch1: SSH username: vagrant
mch1: SSH auth method: private key
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.
Vagrant version : 2.2.2
VirtualBoxVersion 5.2.22 r126460 (Qt5.6.3)
Most probably this is an issue with the new security features on Mojave.
Please give the console app (from where you ran vagrant up, e.g. iTerm2) full write permissions on the disk
System preferences
Security & Privacy
Privacy
Full Disk Access
then restart console and try again.

How to setup Vagrant DNS servers in MacOS without change the DNS in the network setup

I have a vagrant machine and this vm runs a DNS server to resolve the internal domains of each micro-service instance running in a docker container inside the vagrant. Actually, after run vagrant up, I need to put the vagrant vm IP address in my network configuration to my computer resolve the development domain, so I can access the application, but the problem is that I work remotelly and frequently I need to connect in public hotspots that uses network authentication and if I have the vagrant DNS in my interface's configuration I could not connect to the hotspot without removing the vagrant IP, but I need to put it back after some minutes later to start working.
So, the question is, there is a way to configure an virtual interface or a VPN interface that points to the vagrant but does not block my network as I describe above ?
When I was using linux, I just put the vagrant IP in the resolv.conf and I had no headaches, but as MacOS does not have the resolv.conf like linux, I could not find a easy way to deal with theses problems.

Figwheel not hot reloading or updating on file save when using vagrant

When running figwheel from with a vagrant box it seems that file changes aren't noticed and as a result figwheel does not update/reload the page.
After spending hours trying to figure out what was going on it eventually came down to how figwheel detects file changes.
To detect file changes figwheel uses the hawk library which in turn uses the operating system to that tell hawk the file has updated. Because vagrant defaults to using vboxsf there is no underlying update mechanism to provide updates that the file has changed, see here. To fix this we just need to tell figwheel, and thus hawk, to poll for file changes:
:figwheel {:hawk-options {:watcher :polling}
Just pop this in the your profile.clj and that will allow figwheel to see changes after the file has been saved, although it does take a while for the polling to pick up the changes so wait a little bit.
This only however solves half of the problem because figwheel still requires an active websocket connection to actually push the code changes. This is complicated by the fact the a vagrant vm is a separate machine on the network and requires you expose this websocket to more than just localhost. This can be achieved by adding another key to the figwheel map in project.clj:
:figwheel {:server-ip "0.0.0.0"}
and then exposing the figwheel websocket port in the vagrantfile:
config.vm.network "forwarded_port", guest: 3449, host: 3449
and that should fix figwheel on vagrant!
FYI had a similar problem and work on the following solution
troubleshooting on vagrant docker
to quote
Watch Task not working in Docker / Vagrant?
Scenario: Changes made to a file mounted with Docker / Vagrant between
the guest and host os via NFS; filesystem events are not received
correctly.
Resolution: Use rsync in these environments, as NFS does not support
inotify. You may also wish to run a repl server in the guest os and
connect to it from the host.

Laravel Homestead not logging in

I'm currently trying to setup Laravel Homestead 2.0+. When running homestead up, the machine boots up, but then timeouts with the messages:
default: Warning: Connection timeout. Retrying...
The status of the box is running, and I cannot SSH into it.
Looking further into it, when I boot up the VirtualBox GUI, it seems that the box is awaiting login information.
Its asking for a username and password - is this the reason it timeout? Also what is the login information for the box... strange how it doesn't login automatically.
It's a bug. Make sure you have a working internet connection. If not, turn off the router/modem completely while starting vm.

Resources