-
Notifications
You must be signed in to change notification settings - Fork 129
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
Permission denied - /etc/hosts (Errno::EACCES) #92
Comments
So I've tried allowing my user (the one running the vagrant up) write access to /etc/hosts and am still getting the same error. |
i have the same issue :-( |
We ended up switching to vagrant-hostmanager. https://github.com/roots/trellis/pull/443/files |
thank you, i am switching too ;-) |
I started getting this problem today too, with:
Before today, it'd been working fine for more than a year. I updated to Vagrant 1.8.1, removed and re-installed all the plugins, and I'm still getting the error. |
@iandunn Same thing for me, I downgraded to 1.7.4 from 1.8.1 seeing a colleague with no issues was still running that version. Dit not have any effect... |
Started having this problem today. Tried updating to latest version of Vagrant and all plugins, but no dice. For now I've had to uninstall hostsupdater and edit the hosts file manually but I'd love to know if anyone gets a solution for this. |
Also happening here within the past few days, can't pinpoint what caused it. I recently upgraded to 1.8.1, so I tried reinstalling the plugins and even downgrading back to 1.7.4 to no avail. |
I am trying to replicate the issue but am not having any luck. Everything is working for me with my VagrantFiles.
Can anyone share a vagrantfile that is not working? |
Issue is occurring for me on VVV on a slightly older version. |
@Radau which is the slightly older version for you? |
@cgsmith It was off of the develop branch roughly a year ago, so the Stable 1.2.0 release should be very similar to what I'm running. |
Ok - I will try 1.2.0 and report back. Thanks @Radau |
I cannot reproduce the issue with VVV 1.2.0.
Sets the host fine. Anyone willing to do a Google Hangout to track down this issue? |
Sorry you had to switch @dblencowe - I wish I could reproduce this issue for you so you wouldn't need to switch. It seems like the Ansible provisioner failed and was trying to perform cleanup tasks and at some point called the hook for cleaning up the host file. |
I have tried running I'm not sure if this is related but I did run into an issue with my system today where it was no longer prompting me for the password when sudoing (for ANY application) until I added
EDIT: |
Just tried running Vagrant as the root user on my system and it looks like hostsupdater went through. |
So I have a pretty awful solution for this. For whatever reason the OS X ACLs for my user don't seem to be applying applying to ruby (the one that allows my user to read/write without escalating privs I ran |
FWIW, this is also happening with vagrant-ghost (on VVV and HGV). My guess is it's either related to the deprecated sudo warning I've been seeing... or a change to OS X permissions/security around /etc/hosts. For now I've uninstalled both vagrant-hostsupdater and vagrant-ghost and am back to updating my hosts file manually. |
@jb510 I was seeing a As far as OS X updates, 10.11.2 was released on December 11th, with a lot of potentially related security updates, but nothing that jumps out as the obvious cause. That was also almost 2 weeks before this issue was opened, which makes it seem like an unlikely cause, since somebody probably would have reported this issue closer to the time of the release. |
@cgsmith It happens consistently for me. I'm not sure what the specific cause is. It does seem to have coincided with updating to OS X 10.11.3 or 10.11.4 Beta. But that could be purely coincidental. Uninstalling hostsupdater and manually managing hosts vagrant comes up fine. Setting hosts to 777 also works fine, so it does seem to be access related. Why the vagrant machine suddenly can no longer modify it I'm not sure. |
@cgsmith I did not run |
I'm having the exact same problem. Before it would ask for my sudo password, now it simply stops running with that same error. |
This should help:
|
That might be acceptable as a temporary workaround, depending on your circumstances, but it's not a great permanent solution, because it would make you much more vulnerable to local DNS hijacking, since malware wouldn't need you trick you into entering your password. |
Correct, until a fix is available ... . |
This is still failing for me:
I get the same vagrant-hostsupdater/HostsUpdater.rb:85:in `initialize': Permission denied - /etc/hosts. Even if it could fail and be caught rather than killing the vagrant up, that would be a huge help. |
Yep, I don't believe a fix has been made available yet for the actual package. At this point I basically just resort to chmod'ing /etc/hosts every once in a while (issue reappears maybe once a month). Still a bad solution but if you have work that needs to be done it's been working for me Edit: Mijathis solution is better in terms of permissions as well, so you may want to use that if it works. |
I'll be able to look into if the failure can be caught and just throw a warning but won't have time until later next week. PRs are welcomed! I'll also try duplicating this next week on my box. Thanks for the info and suggestion @jjeaton |
Thanks @cgsmith! FWIW, I am having the issue with latest VVV, latest Homestead and latest vip-quickstart. |
FWIW I'm having the same issue on OSX, Homestead, Vagrant 1.8.5, and Virtualbox 5.1.0. I was able to get around it by executing: Where user is my username locally. |
I just ran into this issue today on an Windows 10 installation I've had running for a couple months without any issues. Perhaps my issue was caused by not properly using 'vagrant halt' before shutdown? I can't be sure. In any event I suspect something hosed the VirtualBox VM, and here is how I resolved the following error. The output that followed the below error is almost exactly the same as @dblencowe output.
|
Ran into the same problem (OSX host). Ran vagrant up with sudo and worked. Also had to add sudo with vagrant ssh. |
I am experiencing the same problem on my Windows machine. As with others in this thread, it used to work fine, but problems suddenly arose, probably due to a version update, I am not sure. My current Vagrant version is 1.8.6. I could overcome this issue by running my command line app as as Administrator (in my case, GIT Bash). |
@mabho Check to see if the hosts.local file is |
I was discussing this with a co-worker, and running this on OS X and he was wondering if it could just be designed to prompt for a password somehow. If that is even possible, it might be preferred to modifying permissions on the hosts file. Actually it seems like on my co-workers instance they get prompted for password but for some reason on mine it doesn't. Strange. |
This happens when you set an ACL on /etc/hosts. Some apps (like Gas Mask) do this. Check with By default it has no ACL and is root:wheel owned with permissions rw/r/r |
I did not experience this issue prior to installing Gas Mask. @johnkeates good catch. |
There are other apps and plugins that seem to mess with file ACL's, so even for those that didn't use Gas Mask, check your ACL's as they override permissions. :) |
Had this ACL on mine: |
I suppose the only way is to not use Gas Mask until it is fixed. It doesn't seem to be explicitly set by Gas Mask itself (searching for ACL in the sources didn't yield any results), but it's possible that some sort of specific 'save this file as an admin' call to a Cocoa method sets the ACL automatically. |
Ugh, yeah - Gas Mask as well. Be sure to drop a thumbs-up if you've had the same problem on @johnkeates issue over yonder: 2ndalpha/gasmask#129 |
this bastard issue got me too — after installing gasmask earlier today for the first time. Thanks, all, for pioneering the way of pain, and its resolution :) |
In my case the culprit was Helm (hosts file manager just like Gas Mask), removing ACL (#92 (comment)) from the hosts file did it for me. |
In the last week vagrant-hostmanager has stopped working on my machine. Rather than asking for my password to edit the hosts file it fails on an access denied with the message below.
I recently updated the plugin but I've been doing a load of other vagrant stuff recently so I'm not sure exactly what might have caused this. I'm running the latest OS X, Vagrant 1.7.4 and have got the same error on both Virtualbox and VMware Fusion.
The text was updated successfully, but these errors were encountered: