goodhosts / vagrant

Vagrant plugin that use goodhosts to manipulate hosts files
https://rubygems.org/gems/vagrant-goodhosts/
MIT License
17 stars 8 forks source link

vagrant-goodhosts not updating hosts file on windows #34

Closed davidshq closed 3 years ago

davidshq commented 3 years ago

After running vagrant up vagrant reports that goodhosts is "Checking for host entries" and doesn't say anything more about it.

When I attempt to reach the URL (in this case vvv.test) it can't be found.

Looking at my hosts file (C:\Windows\System32\drivers\etc\hosts) there are no entries for vvv.test, one.wordpress.test, or two.wordpress.test.

I can add these manually to the hosts file and that works.

Are there logs somewhere I can look at to see the issue goodhosts is running into?

Mte90 commented 3 years ago

The log is printed in the console. Can I have an example of the vagrant output?

Also what version of the plugin are you using?

davidshq commented 3 years ago

Below is the log for vagrant up

C:\vvv>vagrant up                                                                                                       __ __ __ __
\ V\ V\ V / Varying Vagrant Vagrants
 \_/\_/\_/  v3.6.2-git::stable(62c5796)

Platform: platform-mingw32 windows  HyperV-Admin  HasWinAdminPriv  vagrant-goodhosts vagrant-vbguest monochrome-terminal shared_db_folder_disabled, VVV Path: "C:/vvv"
Vagrant: v2.2.15, VirtualBox: vN/A

Docs:       https://varyingvagrantvagrants.org/
Contribute: https://github.com/varying-vagrant-vagrants/vvv
Dashboard:  http://vvv.test

Bringing machine 'default' up with 'hyperv' provider...
==> default: Verifying Hyper-V is enabled...
==> default: Verifying Hyper-V is accessible...
==> default: [vagrant-goodhosts] Checking for host entries
    default: Configuring the VM...
    default: Setting VM Enhanced session transport type to disabled/default (VMBus)

Vagrant requires administrator access for pruning SMB shares and
may request access to complete removal of stale shares.
==> default: Starting the machine...
==> default: Waiting for the machine to report its IP address...
    default: Timeout: 120 seconds
    default: IP: 192.168.201.135
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 192.168.201.135:22
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Preparing SMB shared folders...
    default: You will be asked for the username and password to use for the SMB
    default: folders shortly. Please use the proper username/password of your
    default: account.
    default:
    default: Username (user[@domain]): *****@*****.***
    default: Password (will be hidden):

Vagrant requires administrator access to create SMB shares and
may request access to complete setup of configured shares.
==> default: Setting hostname...
==> default: Mounting SMB shared folders...
    default: C:/vvv/database/sql => /srv/database
    default: C:/vvv/config => /srv/config
    default: C:/vvv/provision => /srv/provision
    default: C:/vvv/certificates => /srv/certificates
    default: C:/vvv/log/memcached => /var/log/memcached
    default: C:/vvv/log/nginx => /var/log/nginx
    default: C:/vvv/log/php => /var/log/php
    default: C:/vvv/log/provisioners => /var/log/provisioners
    default: C:/vvv/www => /srv/www
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
==> default: Running action triggers after up ...
==> default: Running trigger: VVV Post-Up...
    default: Running: inline script
    default:  * Restarting Nginx
    default:  * Restarting MariaDB
    default:  * Syncing clocks
    default: 24 Apr 22:09:43 ntpdate[3481]: adjust time server 91.189.91.157 offset -0.006679 sec
    default:
    default:   ✧ ▄▀▀▀▄▄▄▄▄▄▄▀▀▀▄ ✧  Thanks for  __ __ __ __
    default:    ✧█▒▒░░░░░░░░░▒▒█    using       \ V\ V\ V /
    default:  ✧   █░░█░░░░░█░░█ ✧                \_/\_/\_/
    default:   ▄▄  █░░░▀█▀░░░█  ▄▄✧
    default:  █░░█ ▀▄░░░░░░░▄▀ █░░█ Vagrant Up has finished! Visit http://vvv.test
    default: ──────────────────────────────────────────────────────────────────────
Mte90 commented 3 years ago

Thanks looking at the code https://github.com/goodhosts/vagrant/blob/65edd1fd1450504cd610e0d34ff146951b6da4a9/lib/vagrant-goodhosts/GoodHosts.rb#L95 seems that the plugin didn't find any ip address to parse. Maybe I can add an alert for this case.

Maybe it is something in the settings of VVV?

Mte90 commented 3 years ago

Have you did some changes to the vvv config file?

davidshq commented 3 years ago

I'm wondering if it has to do with Hyper-V. I've run into a few different issues using VVV with Hyper-V over the last few days. Maybe Hyper-V picks up the IP at a different point than goodhosts is expecting?

Mte90 commented 3 years ago

I don't know, I have no idea about the VVV settings as example. Maybe there is something wrong there and the plugin get wrong data.

ghost commented 3 years ago

@davidshq

for hyper-v has limitations on how vagrant works. you can't set a static IP. so whatever when you do a vagrant up, it will detect an IP and may have to edit the hosts file manually with that IP address.

Mte90 commented 3 years ago

I am closing as I did not got the info I asked like the vvv settings and the plugin version used.