Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No entries written to C:/Windows/system32/drivers/etc/hosts #195

Open
jamieburchell opened this issue Jan 22, 2021 · 1 comment
Open

No entries written to C:/Windows/system32/drivers/etc/hosts #195

jamieburchell opened this issue Jan 22, 2021 · 1 comment
Labels

Comments

@jamieburchell
Copy link

jamieburchell commented Jan 22, 2021

Vagrant version: 2.2.9 and 2.2.13
Plugin version: 1.2.1
Windows version: 10 Pro

In an administrator prompt after running vagrant up I see these lines in the terminal:

==> dev.example.com: [vagrant-hostsupdater]   192.168.33.10  dev.example.com  # VAGRANT: 1b9d67f6a740862c3f5891f0706c83a7 (dev.example.com) / 60fc44c4-a0b1-47bc-9ebb-b1524a8de2d1

However, no entries appear in the Windows hosts file.

vagrant halt shows:

==> dev.example.com: Attempting graceful shutdown of VM...
==> dev.example.com: [vagrant-hostsupdater] Removing hosts

I have also set my own user account so that I can edit the hosts file without administrator privileges.

If I manually create the entries in the Windows hosts file, then I receive the following in the terminal on vagrant halt:

==> dev.example.com: Attempting graceful shutdown of VM...
==> dev.example.com: [vagrant-hostsupdater] Removing hosts
==> dev.example.com: [vagrant-hostsupdater] Failed to remove hosts, could not use sudo
==> dev.example.com: [vagrant-hostsupdater] Consider adding the following to your sudoers file:
==> dev.example.com: [vagrant-hostsupdater]   https://github.com/cogitatio/vagrant-hostsupdater#suppressing-prompts-for-elevating-privileges
sed: can't read ~/.ssh/known_hosts: No such file or directory

(note that this is from the Windows command prompt).

In vagrant version 2.2.14, there are multiple repeat entries in the terminal as reported in another issue. However, it seems that one entry is written to the hosts file and only during the last batch of messages stating that the line is being written. I have observed that sometimes the entry is not removed on a vagrant halt and sometimes it is. Both times the failed to remove host message is shown.

@Nisus-Liu
Copy link

貌似我也是呢,日志显示写入了,实际上 hosts 并没有改变。

Arenoros added a commit to Arenoros/vagrant-hostsupdater that referenced this issue Dec 1, 2021
scm6079 added a commit to Cyberitas/vagrant-hostsupdater that referenced this issue Aug 7, 2023
 agiledivider#195 No entries written to C:/Windows/system32/drivers/etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants