vagrant-hostmanager icon indicating copy to clipboard operation
vagrant-hostmanager copied to clipboard

Hostfile on host not updated on destroy of a running machine

Open EvanK opened this issue 10 years ago • 4 comments
trafficstars

Vagrant: 1.7.2 Hostmanager: 1.6.0 Provider: Virtualbox 4.3.30 Host OS: OSX 10.9.5 Guest OS: Ubuntu 14.04


On vagrant up, the hostfile entries are created on both host and guest, but on vagrant destroy (without halt, suspend, or any other machine action), the entries are not removed from the host.

The relevant lines from my Vagrantfile:

Vagrant.configure("2") do |config|
  config.hostmanager.enabled           = true
  config.hostmanager.include_offline   = true
  config.hostmanager.ignore_private_ip = false
  config.hostmanager.manage_host       = true

  config.vm.box = "ubuntu/trusty64"

  config.vm.define :local do |box|
    box.vm.hostname = "local.site1.com"

    box.vm.network :private_network, ip: "192.168.12.126"
    box.vm.network :forwarded_port, guest: 22, id: 'ssh', host: 2126, auto_correct: true
  end

  config.vm.provision :hostmanager
end

EvanK avatar Jul 30 '15 19:07 EvanK

+2 here Doesn't clean host OS hosts file OS X 10.9.4 Windows 7 x64

oddwheel avatar Sep 17 '15 14:09 oddwheel

I can confirm it.

HadesArchitect avatar Oct 13 '15 12:10 HadesArchitect

Vagrant: 1.7.4 Hostmanager: 1.6.1 Provider: Virtualbox 5 Host OS: OSX 10.11 Guest OS: Ubuntu 14.04

/etc/hosts file is updated when running either vagrant up or vagrant destroy This is my Vagrantfile https://github.com/radub/roadster/blob/master/Vagrantfile

radub avatar Oct 13 '15 15:10 radub

I have the same problem on OSX.

Along with the sudoers mod, i even gave write permissions to myself on /etc/hosts just to be sure.

sudo chmod +a "$USER allow read,write" /etc/hosts

.. because it looks like it is trying to remove itself in both places (guest and host), but it just won't do anything. My guess was permission problems, though it does write on "vagrant up" so i don't think that is the case.

==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
==> default: Updating /etc/hosts file on active guest machines...
==> default: Updating /etc/hosts file on host machine (password may be required)...

The entry remains.

Vagrant: 1.8.1 Hostmanager: 1.8.1 Provider: VirtualBox 4.3.6 Host OS: OSX 10.11.3 Guest OS: Ubuntu 14.04 trusty32

m3nt0r avatar Jun 14 '16 05:06 m3nt0r