devopsgroup-io/vagrant-hostmanager

Permission denied @ rb_sysopen - .vagrant.d/tmp/hosts.local

tovletoglou opened this issue · 5 comments

On a Windows system, runing the vagrant up, I'm getting the error:

C:/Users/USER/.vagrant.d/gems/2.2.5/gems/vagrant-hostmanager-1.8.6/lib/vagrant-hostmanager/hosts_file/updater.rb:85:in `initialize': Permission denied @ rb_sysopen - C:/Users/USER/.vagrant.d/tmp/hosts.local (Errno::EACCES)

Checking the file C:/Users/USER/.vagrant.d/tmp/hosts.local and it's read-only.

Then run the vagrant up again:

C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/fileutils.rb:1392:in `initialize': Permission denied @ rb_sysopen - C:/Users/USER/.vagrant.d/tmp/hosts.local (Errno::EACCES)

Example Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.provider 'virtualbox' do |vb|
    vb.gui = false
    vb.memory = '1024'
    vb.cpus = 1
  end
  config.vm.box = 'centos/7'
  config.vm.synced_folder '.',
                          '/vagrant',
                          type: 'vboxsf',
                          disabled: true
  config.vm.hostname = "my_hostname"
  config.vm.network "private_network", ip: "192.168.33.10"
  config.hostmanager.enabled = true
  config.hostmanager.manage_host = true
  config.hostmanager.manage_guest = true
  config.hostmanager.ignore_private_ip = false
  config.hostmanager.include_offline = true
end

System:
Windows 10
Vagrant 1.9.3
vagrant-hostmanager 1.8.6

I removed "read-only" attribute frome the hosts file and it worked for me.
But I think that it is temporary solution and things should work without it.

This was my workaround which I am currently using successfully (so far!):

#178 (comment)

Close issue due to inactivity

  1. don't use the plugin host updater.

vagrant plugin list
vagrant plugin uninstall

  1. Make sure your user without elevating privileges have access to read
    write to:
    C:/Windows/system32/drivers/etc/hosts