pi-hole / docker-pi-hole

Pi-hole in a docker container
https://pi-hole.net
Other
8.32k stars 1.11k forks source link

Settings are not saved/loaded correctly #151

Closed JackSabbath closed 6 years ago

JackSabbath commented 7 years ago

I'm on Windows 10 with Docker for Windows CE with Hyper-V and am running the latest diginc/pi-hole:alpine image.

I observed a few bug, but they all seem related:

  1. Some settings are being reseted to default values, when docker is restarted.

    • When docker is restarted all settings in "Upstream DNS Servers" (among others) are resetted to the default configuration, that have been provided by the envirionment variables, when the container was instantiated.
    • Restarting only the container doesn't reset the settings.
  2. Settings are not read from folder, when the container gets instantiated.

    • So I configured my container A, the settings are saved under C:/Pihole.
    • I delete container A, create a container B from the same image and link the settings again to C:/Pihole again.
    • During the first run, the settings in the linked folder are not read at all. E.g. the blocklists are the default ones and not read from the file.
    • After restarting the container, the settings ARE read.
  3. Query Logging can't be re-enabled once it's disabled.

    • After pressing the "Disable query logging" button, the following things happen:
    • UI notices me, that the logging is disabled (via blue notification bar).
    • The "Current Status" under "Query Logging" (in the right corner) is still "Enabled (recommended)".
    • The button is still labeled "Disable query logging".
    • The logging is indeed disabled.
    • The logging can't be reenabled by the button.
    • Restarting the container doesn't reenable the logging either.
    • Restarting docker completely DOES reenable logging (effect of bug 1).
csuno commented 7 years ago

same here, on debian

adamklaff commented 7 years ago

I'm running on a Synology and noticed that none of my settings seem to stick in the Web interface. I get a success message on the site but the form stays the same.

1activegeek commented 7 years ago

Same boat here. Can confirm that making changes via the web interface will change the underlying config files if mapped locally. So should be no reason to override them. Though I'm going to take a guess something is still set to override or re-write certain defaults. Where they are is the missing bit of information or why they're overriding when we have a listed config.

strivingit commented 7 years ago

I noticed the same issue as will on my Ubuntu server running docker as well. I was able to get around it by changing the options for storage on my container to mount to a volume in docker instead. When I had done that, the configuration would persist and not revert to default. Oddly in both cases, log/statistical data still persists using the the commands in the guide and my work around.

diginc commented 6 years ago

Sorry for the delayed response, lets address these one by one:

Some settings are being reseted to default values, when docker is restarted. ... Upstream DNS Servers

Environment variables for DNS are maybe coded incorrectly. I think it assumes if they envs were blank you should take a default entry of googles' servers. I'll start checking for existing configuration values before overwriting them.

Settings are not read from folder, when the container gets instantiated.

This one perplexes me, I save my settings quite often and only the ones that are environment variable based should be discarded / overwritten. I just removed 1 list through the admin, saved, and destroyed/ran a new container without any problem so this one may have been fixed already?

Query Logging can't be re-enabled once it's disabled.

Confirmed, I think this is related to volume permissions though since I can reproduce it on my production container but a side container with no volumes doesn't have this issue. I'll see how

1activegeek commented 6 years ago

@diginc I believe the first and second are being viewed as one. Item one is a subset of Item two. The config settings I'm setting in my file that are overwritten, are in fact the DNS entries. I can confirm the lists seem to work fine (aka other non-env variables).

I'd say the best option to solve this would be to allow the container to first identify variables, if they don't exist, then set them with defaults, but if the Config file is present, let this override the defaults.

smithjw commented 6 years ago

I've just installed on my Synology and am running into the same issue. It looks like anything that's passed in as an Env Var at creation sticks but from there, anything that i try to modify in the interface does not stick. Could this be some kind of permissions issue?

Ulisus commented 6 years ago

I am having the same problem on my Synology NAS. I tried mapping the "pihole","dnsmasq.d" and "lighttpd" folders to the Synology Docker folder, but it won't work.

Is there any workaround till it is patched?

diginc commented 6 years ago

Could this be some kind of permissions issue?

Some of the reports in this issue could be related to this issue if the problem only presents when volume mounting : https://github.com/diginc/docker-pi-hole/issues/278

Ulisus commented 6 years ago

So i tried with no mappings. The DNS is working, but the status shown is "unknown" and is still can't save any settings. I also get the following errors:

sudo: policy plugin failed session initialization sudo: pam_open_session: System error sudo: unable to send audit message: Unknown error -1

So i think i found a more accurate issue, which is #243

diginc commented 6 years ago

edit: Responded to wrong issue :)

I think the v4 image permissions changes will take care of any issues like the OP's. The synology issue may have similar problems but for different reasons due ot the sudo errors. Lets track that in the synology issue we having going.