Eldair's avatar

Windows 10 + Vagrant + Virtualbox + Homestead

Hello,

I am having issues running homestead via virtualbox on Windows 10 TP 10130 with error code

There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: E_FAIL
VBoxManage.exe: error: Failed to create the host-only adapter
VBoxManage.exe: error: Code E_FAIL (0x80004005) - Unspecified error (extended info not available)
VBoxManage.exe: error: Context: "int __cdecl handleCreate(struct HandlerArg *,int,int *)" at line 66 of file VBoxManageHostonly.cpp

I am aware it is a common issue but was curious if someone has found a workaround?

0 likes
95 replies
mwjt42's avatar

host-only (and bridged adaptors) do not work. If you remove all networking options (expect port forwarding!) in the VagrantFile (or HomeStead's equivalent) it does seem to boot ok - I've been fighting with this for a couple of days now.

SSH into the box and use 'ifconfig' to locate your IP.

You may also need VirtualBox 5 RC1 to achieve this - install this by running as Admin and in Window's 8 compatibility mode

1 like
Eldair's avatar

Hi, thanks a lot, I will try it out today.

bashy's avatar

Vagrant doesn't support VB5 but I believe it's been merged and awaiting compile for 1.7.3.

Eldair's avatar

Hi, I managed to use Vagrant for VB5 and to install it as suggested. When I start the box from Virtualbox gui it runs until "waiting for network.." message and stops there (via Vagrant - same error as above).

jlrdw's avatar

Why don't we back up 25 yards here and wait on the final version of Windows 10 to even be released.

tradjick's avatar

Not pretty but a working solution (tested under Win10 build10130).

  1. Uninstall Vagrant and VirtualBox (restart if necessary)
  2. Install notepad+ or other notepad replacement that handles linux line-endings
  3. Download Vagrant v1.7.2, VirtualBox 5.0RC1, VirtualBox v4.3.6
  4. Enable built-in administrator account. a. win+r b. cmd c. net user administrator /active:yes optional but recommended d. net user administrator * e. enter new password and confirm
  5. switch to Administrator account a. Start b. Click username (top-left) c. Select Administrator
  6. Install Vagrant v1.7.2 (restart if necessary, log back into Administrator)
  7. Install VirtualBox v5.0RC1
  8. Install VirtualBox v4.3.6
  9. Update VBox Host-only adaptor driver a. Start->All Apps->Windows Administrative Tools->Computer Management b. Device Manager c. VirtualBox Host-Only Adapter d. Update Driver Software e. Search Automatically for updated driver software
  10. Edit VagrantFile file (where ever you vagrant up from) and change all ~/ to C:/Users/<username>/
  11. Edit Homestead.yaml (Where ever you had it, likely C:\Users\<username>\.homestead) and change all ~/ to C:/Users/<username>/
  12. Open VirtualBox
  13. Run vagrant up a. win+r b. cmd c. cd directory_of_vagrantfile d. vagrant up (will probably need to dl the box again)
  14. switch back to your usual user (do not sign out)
  15. hey presto, you have a working homestead

Each time after to manage vagrant (start, halt, whatever) switch to Administrator, manage, and switch back to your usual user. Do not sign out of the Administrator account when switching if you have a box up

1 like
jekinney's avatar

@jlrdw is 100% correct. From my experience with other windows os previews the final release core code is significantly different. Generally the core code (this case w8) for compatability issues.

Fyi, Vista's preview didn't have the dx sound and core code was nt (XP) and all your old printers and stuff worked. Released and nothing worked.

Eldair's avatar

@tradjick Thanks! That actually worked for me :) But, as others noted, win10 is not ready and definitely still not worth doing all that, so back to 8.1 for now.

1 like
tradjick's avatar

Another month to go till release @Eldair :) I'll be surprised if every software vendor is going to be on the ball. Every man and his dog not used to OS migrations is going to be jumping on the free license (and getting away from win8/8.1) so it's nice to have a solution in place just in case :D

Eldair's avatar
Eldair
OP
Best Answer
Level 3

Hello,

New solution:

  1. Install Virtualbox 5 and Vagrant 1.7.4
  2. Comment line 17: config.vm.network :private_network, ip: settings["ip"] ||= "192.168.10.10" in homestead.rb
  3. Comment line 64: b.use ClearNetworkInterfaces in action.rb (path ~\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.7.4\plugins\providers\virtualbox\action.rb)
  4. Homestead init and/or up
  5. Homestead halt
  6. In Virtualbox preferences -> network -> host-only networks edit existing Host-Only adapter and add 192.168.10.10 as IP address
  7. Select homestead box in Virtualbox and go to settings -> network -> adapter 2 and select Host-only network (the one edited in step above)
  8. Homestead up, provision

P.S. I don't know why, but I had to add :8000 to alias urls in browser to get them to open pages.
Edit: the :8000 can be avoided if you change default port forwarding 80 => 80 instead of 80 => 8000 in homestead.rb or go to settings of your box -> network settings -> adapter 1 (nat) and port forwarding option, and there is port 80 forwarded to port 8000, change 8000 to 80 and that's it.

And it's working (: Cheers

UPDATE Alternative solution by @pdcmoreira:
I found a VERY SIMPLE way to make it work without touching any file in the accepted answer!

Install and run this file: https://www.virtualbox.org/attachment/ticket/14040/VBox-Win10-fix-14040.exe (leave it running in the background) Go to the C:\Program Files\Oracle\VirtualBox folder, right click on VirtualBox.exe, go to compatibility, check the "Run in compatibility mode" checkbox and choose Windows 7. Click OK to close the window. Repeat step 2. for VBoxManage.exe and VBoxHeadless.exe Run cmd and do homestead up. There you go! It should work!

After all is done and working, close the program opened in step 1.

[UPDATED]

You don't need to run cmd as Administrator in step 4.

30 likes
malesandro's avatar

Hey people, Today I upgraded to W10, and had this problem. @Eldair 's solution worked, though it now takes FOREVER to boot homestead.

In the process, I also had a problem after upgrading to Vagrant 1.7.4. My box was/is called "default", so when I tried running vagrant up, I received an error saying that the box "base" couldn't be find. After trying for some time to fix that without luck, I came up with a handy solution for the time being. I first run a vagrant global-status, get the ID of the box I want to start, and then I do "vagrant up id_of_the_box".

Hope this helps someone. Cheers

vnobre's avatar

Hi everyone,

I've just upgraded to Windows 10 and while I was trying to implement the recommended fix I thought I ought to remove my old homestead box (bad idea).

As per the steps, I can indeed setup a laravel/homestead box via vagrant up, but the created box is not called homestead and the homestead up command gives a slightly similar error to the initial one:

D:\MyDirectory>homestead up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Setting the name of the VM: homestead
==> default: Clearing any previously set network interfaces...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: E_FAIL
VBoxManage.exe: error: Failed to create the host-only adapter
VBoxManage.exe: error: Code E_FAIL (0x80004005) - Unspecified error (extended info not available)
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleCreate(struct HandlerArg *)" at line 70 of file VBoxManageHostonly.cpp

So, considering:

  • I've removed all virtual boxes
  • I have a clean install of the latest VirtualBox and Vagrant

Is there any way that I can setup homestead to work with the regular homestead up command and multiple site mapping? Forgive my ignorance, but I have no clue on how to map several Laravel sites to a single Vagrant box instance and was happy that homestead took care of all of this for me with a simple YAML file :(

Eldair's avatar

Hi @vnobre, to me it seems like you haven't commented out lines in action.rb and homestead.rb. You should do that and manually set networks for existing box after which homestead up should work (with mapping from homestead.yaml file).

bogdanus's avatar

@Eldair You saing this: "In Virtualbox preferences -> network -> host-only networks edit existing Host-Only adapter and add 192.168.10.10 as IP address" How you edit host-only network? In my VBox if i go there i dont see any (existing) host-only interface and if i try to create/insert it VBox throws me an error. Resultcode: E_FAIL (0x80004005)

PS: Im running as Admin.

vnobre's avatar

Hi @Eldair , I was following the steps on the accepted answer, sorry! I noticed your answer with new steps after your reply. I followed your steps now, commented the necessary lines and while I'm still able to vagrant up/halt (and it does create the homestead box) I'm still getting the same error when I try to homestead up.

By doing vagrant up, it does fetch my homestead.yaml file and syncs the proper folders/sites. However, my Windows hosts file was referring to 192.168.10.10 and this no longer works. It will work if I refer to 127.0.0.1 and add :8000 to the end of the site address ( http://example.app:8000) but this is less than ideal :(

Thank you for your help either way! I'm a tad disappointed that I've made a mess of my homestead setup, I actually enjoy Windows 10 but I might have to revert to Windows 7...

Eldair's avatar

@bogdanus try to reinstall virtualbox, because it should have created one during installation. If not, try installing as admin. @vnobre the :8000 can be avoided if you change default port forwarding 80 => 80 instead of 80 => 8000 in homestead.rb or go to settings of your box -> network settings -> adapter 1 (nat) and port forwarding option, and there you will see port 80 forwarded to port 8000, change it to 80 and that's it.

vnobre's avatar

@Eldair your tip worked out great and I'm finally up and running again just as I was before! Thank you so much!

Can we mark your steps as the accepted answer? The accepted answer didn't work for me, but your steps did!

Mwaa's avatar

@Eldair Any chance you have worked with ssl certificates. I did the port forwarding part 80=>80 but i still have to add :80 on the url. And the page still does not load i get

SSL connection error: ERR_SSL_PROTOCOL_ERROR

Unable to make a secure connection to the server. This may be a problem with the server, or it may be requiring a client authentication certificate that you don't have.

Fanmade's avatar

Thank you for this excellent description! I've upgraded to Windows 10 yesterday and got my homestead machine working within a few minutes. The only thing not working for me is the port forwarding. When I change the setting in VirtualBox, there is no effect. When I edit the array in homestead.rb, I'm getting the following error on the "up" command:


To fix this, modify your current projects Vagrantfile to use another port. Example, where '1234' would be replaced by a unique host port:

  config.vm.network :forwarded_port, guest: 80, host: 1234

Sometimes, Vagrant will attempt to auto-correct this for you. In this case, Vagrant was unable to. This is usually because the guest machine is in a state which doesn't allow modifying port forwarding.

I tried investigating this and found the command "netstat -a -b" which only shows me the following:

Proto  Local Address  Remote Address  Status
TCP    0.0.0.0:80         My-Username:0   LISTEN

What am I doing wrong?

vnobre's avatar

@Mwaa I am working on a project with a self-signed SSL certificate and I had to forward 443 => 443 (by default it'll be 44300 and you'd have to add the port to the end of the address such as http://your.app:44300).

I updated the ports on the homestead.rb file and also on the Box settings as explained by Eldair.

When I perform vagrant up all I get is a warning that these are usually privileged ports, but everything is working fine.

1 like
antonybudianto's avatar

I got this error when trying the solution:

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.

Any ideas? Thank you

Next

Please or to participate in this conversation.