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
/etc/hosts does not reload when changed #6711
Comments
I was able to get it to work on macOS by using a Darwin specific defaultHostsPaths():
So I needed to use "private/" in front of "etc/hosts". |
I also needed this change in fswatcher.go:
See the "Watching a file doesn't work well" comment in the README of the fsnotify repo. |
@hwilson-dev, hello and thanks for the report. What version of macOS do you use? It seems, the |
@EugeneOne1 I'm on macOS 13.5.1. I started with v0.107.36 and am now on v0.107.44. Without the changes mentioned above, it never worked for me on Windows or macOS. |
@hwilson-dev, do you happen to find out, which of these changes are required on Windows to fix the issue? AFAIK, at least, the file location isn't that tricky there. |
@EugeneOne1 The fswatcher.go change above:
Made it work on Windows for me. |
Updates #6711. Squashed commit of the following: commit 3ddfe80 Merge: 185957c d338451 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Feb 13 13:01:30 2024 +0300 Merge branch 'master' into 6711-watch-hosts commit 185957c Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Feb 9 18:11:41 2024 +0300 aghos: imp docs commit 3afbbcb Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Feb 9 15:40:02 2024 +0300 all: upd golibs, imp fswatcher
@hwilson-dev, hello again. We've pushed the edge release that implements the suggested fixes, could you please check if it now tracks changes to the hosts file? Thanks for your participation. |
@hwilson-dev, we're going to close the issue for now, feel free to reopen it if the problem reoccurs. |
Prerequisites
I have checked the Wiki and Discussions and found no answer
I have searched other issues and found no duplicates
I want to report a bug and not ask a question or ask for help
I have set up AdGuard Home correctly and configured clients to use it. (Use the Discussions for help with installing and configuring clients.)
Platform (OS and CPU architecture)
Darwin (aka macOS), AMD64 (aka x86_64)
Installation
GitHub releases or script from README
Setup
On one machine
AdGuard Home version
0.107.44
Action
When I make a change the /etc/hosts, I expect it to show in the 'runtime clients' table and I expect the configured IP address to be returned when querying it.
Expected result
I expect the newly configured data to be show and used.
Actual result
The change in /etc/hosts does not become active until I restart the AdguardHome process.
By looking at the code and turning on debug, I see that an FSWatcher is instantiated for the file. But it never seem to recive any change notifications from the OS. I tried both macOS and Windows.
I cloned the fsnotify repo and ran their test application. It works as expected. So I suspect the issue is with the AdguardHome use of that code.
Please take a look.
Additional information and/or screenshots
No response
The text was updated successfully, but these errors were encountered: