Hostmanager updates only linux /etc/hosts if used with WSL
nick4fake opened this issue · 8 comments
Hi,
I am using vagrant in WSL environment: https://www.vagrantup.com/docs/other/wsl.html
It works perfectly, but there is one small problem: vagrant-hostmanager only updates ubuntu hosts file, leaving windows one untouched.
That's weird because I'm having the exact opposite problem. Using vagrant in WSL it updates Windows hosts file but not Ubuntu's.
Can confirm. Hostmanager only updates Ubuntu hosts file. Not Windows.
Same Issue Here.
Same issue here using vagrant 2.0.3 installed in both WSL and Windows with VAGRANT_WSL_ENABLE_WINDOWS_ACCESS=1 exported from dotfiles on terminal launch.
Running vagrant up
updates /etc/hosts but not System32\drivers\etc\hosts. Currently I am tee-ing it into Windows hosts file but that's not ideal obvs.
cat /etc/hosts | grep 192.* | sudo tee -a /mnt/c/Windows/System32/drivers/etc/hosts
Not sure what the workaround is here, but the semantics of VAGRANT_WSL_ENABLE_WINDOWS_ACCESS would seem to play nicely with keeping Windows hosts file in sync with WSL when the latter is updated by Vagrant.
@seth-reeser @stevebritton @nick4fake Hey! Any update on this? Would be super helpful for us Windows WSL users. Thanks for your hard work on this awesome plugin.
Also seeing this issue. Unfortunately, @snailuj's workaround doesn't work unless you run WSL with elevated privileges--using sudo
doesn't give you the access you need to edit the file.
Thanks!
https://github.com/shayne/go-wsl2-host seems to be a good solution, also beyond Vagrant.