Skip to content

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

Open
@jamieburchell

Description

@jamieburchell

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions