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

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

Related

Vagrant times out waiting for machine to boot (Virtualbox)

To preface, I realize this is a common error message with several different causes and solutions, but nothing I've found has worked so far. I have Vagrant 2.1.5 with Virtualbox 5.2.18, running on Windows 10.
I was testing Vagrant with a very simple Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
end
Running vagrant up then gives the typical "Timed out while waiting for the machine to boot" error:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos/7'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'centos/7' is up to date...
==> default: Setting the name of the VM: vargrantTest_default_1537805339381_15444
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> 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
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.
Things I have tried:
Ensuring virtualization is enabled in BIOS
Increasing boot timeout in vagrantfile
Ensuring the VMs network settings are correct in Virtualbox (NAT adapter with cable connected)
Using vb.gui = true to watch the VM boot. It boots fine and waits at the login screen.
Using --debug flag on vagrant up. This doesn't give any obvious errors that I found, though before timing out it runs VBoxManage showvminfo --machinereadable several hundred times, resulting in a log file of over 80k lines.
As well as several other things I forgot to write down. I'm out of ideas and quite new to Vagrant, so I don't really know what the next step of troubleshooting this is. Any help would be appreciated.
Edit: Not sure why I didn't think to do it myself, but Marco gave me the idea to try to ssh directly to the VM. I tried doing so using the key file in "/.vagrant.d/insecure_private_key" created by Vagrant, but it timed out. I then tried to simply ping the VM, but doing so gives a seemingly random mix of "Request timed out" and "Destination host unreachable", so there's probably a bigger network issue somewhere (my machine, the VM, or Virtualbox) I'm unaware of.
Are you declaring some kind of network for this box? Either private or public, but something?
Also, how long is your boot timeout? Go overboard and give it 900=>15mn.

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 Homestead hangs at SSH auth method: private key on mac

I can't seem to get Homestead running. It hangs at SSH auth method: private key.
The Homestead VM starts. I can go to VirtualBox and open the terminal window and login with vagrant:vagrant.
I can't vagrant ssh, ssh vagrant#127.0.0.1:2204 or ssh vagrant#127.0.0.1 -p 2204.
None of my folders show up in the VM, but the VirtualBox says they are mapped.
Every time I vagrant up, I get:
vagrant up
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Checking if box 'laravel/homestead' is up to date...
==> homestead-7: Clearing any previously set forwarded ports...
==> homestead-7: Fixed port collision for 80 => 8000. Now on port 2200.
==> homestead-7: Fixed port collision for 443 => 44300. Now on port 2201.
==> homestead-7: Fixed port collision for 3306 => 33060. Now on port 2202.
==> homestead-7: Fixed port collision for 5432 => 54320. Now on port 2203.
==> homestead-7: Fixed port collision for 22 => 2222. Now on port 2204.
==> homestead-7: Clearing any previously set network interfaces...
==> homestead-7: Preparing network interfaces based on configuration...
homestead-7: Adapter 1: nat
homestead-7: Adapter 2: hostonly
==> homestead-7: Forwarding ports...
homestead-7: 80 (guest) => 2200 (host) (adapter 1)
homestead-7: 443 (guest) => 2201 (host) (adapter 1)
homestead-7: 3306 (guest) => 2202 (host) (adapter 1)
homestead-7: 5432 (guest) => 2203 (host) (adapter 1)
homestead-7: 22 (guest) => 2204 (host) (adapter 1)
==> homestead-7: Running 'pre-boot' VM customizations...
==> homestead-7: Booting VM...
==> homestead-7: Waiting for machine to boot. This may take a few minutes...
homestead-7: SSH address: 127.0.0.1:2204
homestead-7: SSH username: vagrant
homestead-7: 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.
I replaced the homestead insecure private key with my key on my box. I see a lot of people get Warning: Connection timeout. Retrying..., but I don't get that far.
I'm on a mac 10.11.6
Any help would be greatly appreciated!
I had the same problem on macOS 10.12 today, and lost 6 hours trying to find a fix. Finally, after several reinstallations, reboots, and trial and error, I somehow got it to work by following these steps...
Completely uninstall and reinstall Vagrant, VirtualBox, and Homestead.
Ensure the homestead-7 box is shut down within the VirtualBox UI
Right-click the homestead-7 box, and choose Settings
Click 'Network'
Under 'Adapter 1', which should be attached to NAT, click 'Advanced'
Tick the box beside 'Cable Connected'
Save settings, and reprovision Homestead with vagrant up --provision
Run vagrant reload --provision to reprovision the machine
That should be it! I was able to SSH in after this, but not able to view Homestead sites through the browser (even though I'd configured the /etc/hosts file), but a simple reboot of the Mac seemed to fix this.
Given I don't know what exactly caused this in the first place, this might just be a bit of luck for my case, but let me know how you get on.
Open VirtualBox UI and enter the virtual machine.
press Enter key to make system continue to boot.
And then you can see the vagrant up going on.
I had this problem. I enabled Vt-x in the bios and it cleared it.
Vagrant 2.1.2
vagrant destroy then vagrant up --provision worked for me.
I have noticed that it usually happens when new version of vagrant released
If you are on Windows, you have done everything here and still have trouble, maybe this is the solution you need.
Open the Command Prompt as an administrator. Type the bcdedit command. You may find hypervisorlaunchtype Auto. If that is the case, type bcdedit /set hypervisorlaunchtype off to turn it off. Reboot and try again.
Hope this helps.
Nothing here worked for me. I got into the situation of SSH auth method: private key because my mac black screened and crashed.
All that worked for me was a vagrant destroy then vagrant up --provision. Beware this will of course trash anything in your VM. but you should be using ephemeral principles anyway...
Enable "Virtualization Technology" in BIOS settings
I had to do a fsck. (disclaimer, I typed the commands from memory)
Open VirtualBox UI and enter the virtual machine.
If you see (initramfs), type exit
fsck /dev/mapper/vagrant-vg-root -y
reboot
Go back to your normal terminal and try a:
vagrant halt
vagrant up
For me, things were back to normal from here.
This happened to me all of a sudden after working fine for a while using Homestead v6.4 with virtualbox. To fix, Open VirtualBox - if using - and check the logs there.
I found instructions to manually fsck a directory which fixed the issue
Your directory will likely be different, but mine was
fsck /dev/mapper/homestead--vg-root
And then select y to fix all of the errors
Try to call vagrant up from CMD with admin rights
If you're still stuck, here's something you can quickly rule out:
For me the issue was too little video memory, for some reason in Virtual Box my video memory was set to 4mb, the minimum is 12mb, I set it to 24mb (with vm off) and ran vagrant up again, and it fixed the issue!
I got this error after installing Docker Desktop for Windows.
The two aren't compatible.
run Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor
this will disable hypervisor.
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
to enable.
I've found that now Homestead takes a long time to boot, Open VMBox, select homestead and click on Show (green button). Wait until you have the homestead login prompt.
Then go back & you can run vagrant ssh into Homestead.

Vagrant access guest machine from host (windows)

I installed a vagrant virtual machine in Windows, it's working fine, I am trying to connect to the guest machine from windows, but as soon as I uncomment some thing in Vagrantfile like :
config.vm.network "private_network", ip: "192.168.33.10"
OR
config.vm.network "public_network"
when reloading vagrant, I got this error :
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' 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.
The primary issue for this error is that the provider you're using
is not properly configured. This is very rarely a Vagrant issue.
I know this does not make sense but I just open VirtualBox and with right-click goes to Settings of created vagrant machine image and diable Audio and it is working after save and run vagrant up
I never encountered that error personally, having never used vagrant on windows. This issue has been discussed here.

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

Resources