Laravel homestead stuck on VM login - laravel

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

Related

Networking/Filesystem Issues in Creating a Vagrant/Virtualbox Environment Setup on New Host Machine

Recently, my work laptop died, and I'm trying to get my project setup on a different laptop that was in my garage. My project lives inside of a trusty64 Ubuntu vagrant box using Oracle's Virtualbox software. However, I'm running into a bunch of issues trying to get the vagrant setup to work on this laptop. I also have the project running on my home desktop, and it all works there just fine.
This laptop is a Gateway NE56R12u from 2012 with 8 GB of RAM. It has a 64-bit dual-core processor running Windows 10 Professional (I installed Ubuntu 16.04 on this laptop as well doing a dual-boot, it is having the same exact errors using the Ubuntu operating system as it is having using Windows 10) My home desktop (that everything works on just fine) is also Windows 10 Professional. I'm using Vagrant 2.0.0 and VirtualBox 5.1.28 on both Windows 10 machines. They are booting the same project on the same branch.
When looking at the Virtualbox GUI on the laptop, it is only showing 32-bit options for boxes, which seems to be due to a lack of available hardware acceleration (I did not find any acceleration options in the BIOS). The Virtualbox GUI throws an error that says due to missing acceleration properties, the box will not be able to detect that I have a 64-bit processor. The acceleration tab is inaccessible. So I've switched to trying to use a 32-bit 'trusty' box.
However, I am still having problems and am unable to use a virtual machine. The problems appear to be with network connections and connecting to my filesystem.
When I type in vagrant up it starts normally:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/trusty32'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty32' is up to date...
==> default: Setting the name of the VM: directoryName_default_1509067920271_59622
==> 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: 3000 (guest) => 3000 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> 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
but then hangs there until time-out.
going into the Virtualbox GUI and watching the device boot, I watch it hang here:
waiting 10 seconds for network device
waiting 120 seconds for network device
then it says it gave up waiting for network device and continues. Eventually, it gets and hangs here:
Waiting for network configuration...
Waiting up to 60 more seconds for network configuration...
Booting system without full network configuration
then it quickly finishes booting and switches to a Vagrant login screen where I can successfully log in. When logged in, there are no files from my filesystem present. The command line where I started the boot process still has not changed at this point. It waits for the full time-out from the Vagrantfile and then throws the error that it timed out. I am not able to ssh in.
What I've done so far:
I have checked that the network adapter for the virtual machine is enabled. I have PAE set to on in my Vagrantfile because otherwise it is automatically set to off and throws a fatal error during boot (I tried turning pae, hwvirtex, vtxvpid, and vtxux all to off in my Vagrantfile). I made sure it only has one processor set. I have tried every network adapter setting available within the Virtualbox settings and there is no change. I have run bcdedit /set hypervisorlaunchtype off as an administrator on the command line. I've destroyed the .vagrant.d file folder, the .VirtualBox folder, and the VirtualBoxVMs folders from ~/user. I've tried different networking options such as public network and a private network with the local ip address.
Note: after running bcdedit /set hypervisorlaunchtype off my virtual machines no longer show in the Virtualbox GUI. However, the first time I deleted the .folder's after running that command, my machine successfully booted the box for the first time and everything was working correctly with it. However, the next day when I used vagrant up from the halted machine, it no longer worked again. Sometimes, instead of timing out, Vagrant gives the error that the machine went into the invalid state of 'unknown' state or 'paused' state. This behavior, however, is not consistent.
I've also re-installed Virtualbox and Vagrant, tried Virtualbox version 5.1.30 and version 5.2 (which I immediately learned is not compatible with Vagrant, which is interesting). At one point, upon a fresh install of Virtualbox it worked once and then it was immediately broken again after halting. Reinstalling again does not make it work. I tried using the hashicorp/precise32 box, and while that is created, boots, and is ssh accessible with access to my filesystem it does not seem to support node or versions of npm after version 1.1.14 and npm install fails. The ubuntu/xenial32 box always has a stderr while trying to boot on the command line. I can not get the logs because the VMs themselves do not show up in the Virtualbox GUI. I ran bcdedit /set hypervisorlaunchtype auto as having it set to off did not help solve my problem, but the Virtualbox GUI still does not show my VMs. Having vb.gui set to true in the Vagrantfile does not change this and the GUI does not show.
This is an error message I've gotten from the Virtualbox GUI many, many times:
The VM session was aborted.
Result Code: E_FAIL (0x80004005)
Component: SessionMachine
Interface: ISession {7844aa05-b02e-4cdd-a04f-ade4a762e6b7}
My Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty32"
config.vm.network "forwarded_port", guest: 3000, host: 3000
config.vm.boot_timeout = 500
config.vm.provider "virtualbox" do |vb|
vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
vb.customize ["modifyvm", :id, "--pae", "on"]
end
config.vm.provision :shell, :path => "scripts/init_environment.sh"
end
I don't know what's wrong. It's technically worked twice, so I feel there must be a software and not a hardware problem? I can get a different box to work fine on this computer, but that box doesn't work for my project. This project has been setup on 3 other computers successfully with 0 issues (2 of them Windows 10, one Mac OSX), though none of those machines required a 32-bit box. Any ideas are greatly appreciated, I just need this to work so I can work on the go! Many of my errors are not consistent. The next thing I'm thinking about trying is taking out the Ubuntu dual-boot...
Edit:
I will also note that I put vb.memory = "1024" into my Vagrantfile and the Virtualbox still uses 512 MB of base memory according to Virtualbox. Also, I got the VM's to show in the Virtualbox software again, and grabbed a logfile .
The issue for me seemed to be that the virtual machine had shut down previously with some orphaned child nodes (I have no idea what that means). But, I did find this article explaining how to save a broken system and reboot from disc (which the article explains where you can download this).
https://superuser.com/questions/947942/unprocessed-orphan-inode-list-in-virtualbox-vm

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

Vagrant Warning: Connection refused. Retrying

Testing default example
$ vagrant init hashicorp/precise32
$ vagrant up
My box:
Windows 8.1
VirtualBox 5.0.2
Vagrant 1.7.4
Intel i7-4700MQ CPU witch seems to have Intel® Virtualization Technology (VT-x) http://ark.intel.com/products/75117/Intel-Core-i7-4700MQ-Processor-6M-Cache-up-to-3_40-GHz
I know this is common error but after trying everything I still cannot make it work
While VM shows:
And I can log in successfully:
Firewall / Antivirus turned off.
Hyper-V is not installed
I have tried connecting via putty to 127.0.0.1 2222
EDIT:
Vagrantfile (I have removed commented out lines)
Vagrant.configure(2) do |config|
config.vm.box = "hashicorp/precise32"
end
This is what vagrant ssh does... nothing. And vagrant reload stuck on same issue.
This happens with Vagrant from time to time with the first spin up. After it does that it will timeout and drop you back at the prompt, go vagrant ssh, it will let you in. If it does not go vagrant reload and it will restart the vm. This occurs because the vagrant images have dns turned off so it takes a while to resolve the connection. Again, this sometimes occurs on the first up after you download it and spin it up.
I suspect this could be a misconfigured VBox guest.
I suppose you could try making sure that NAT and port forwarding are enabled in the settings of your VM, and if they aren't, you could enable it manually: in the VirtualBox Graphical Manager, select the machine, click on settings, click on network at the right of the popup, check all the adapters and make sure that the adapter that is "attached to NAT" is enabled. Also, check the port forwarding settings. You can also access the network settings when you are running the VM, from the buttons at the bottom/left (the third button in your second pic, from left to right).
Something that I found out was the case for me after multiple destroys/reebots: check if you have an SSH agent running with a key loaded (like Pageant for PuTTY).
In my case having another SSH key loaded with Pageant (instead of the one configured for Vagrant) was conflicting with the authentication process, which resulted in endless "Connection refused. Retrying" and ultimately in me being unable to use Vagrant.
The solution is to either
Load the appropriate key in Pageant
Close pageant (what I usually do, as it's faster in my case)
Hope this helps someone out there!
here are a few things I would try (and I do understand you might have tried a lot of this and it might not solve your issues but just in case) :
follow the steps from https://www.hanselman.com/blog/SwitchEasilyBetweenVirtualBoxAndHyperVWithABCDEditBootEntryInWindows81.aspx to completely disable Hyper-V (not sure its enough from windows features - and even though you're using a 32-bit box)
not sure if you enabled the gui mode when you logged into the vm from virtual box or you just opened it after, but enable the option and check if nothing is blocking during the startup
config.vm.provider :virtualbox do |vb|
vb.gui = true
end
use another ssh port (even though it does not mention there is a collision) you can try another port
config.vm.network :forwarded_port, guest: 22, host: 2522, auto_correct: false, id: "ssh"
see after vagrant up if you can connect with putty.
optionally, you can run vagrant up --debug to get more information about the error, you will see where it loops/error and give the output of that for others on SO to comment
EDIT
Giving another look, I thought the issue was about connection timeout but it is connection refused the message says
SSH username: vagrant
SSH auth method: password
but you're not passing any password in the Vagrantfile you show. Just add
Vagrant.configure(2) do |config|
config.vm.box = "hashicorp/precise32"
config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
end
I would recommend to use ssh-key as it is a bit more simple to use.

vagrant / homestead up - connection timeout ONLY on home network

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.

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