Skip to content
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

setting etc_dnsmasq_d = true breaks the database #2270

Open
epipenRX opened this issue Feb 24, 2025 · 3 comments
Open

setting etc_dnsmasq_d = true breaks the database #2270

epipenRX opened this issue Feb 24, 2025 · 3 comments

Comments

@epipenRX
Copy link

epipenRX commented Feb 24, 2025

Versions

started this ticket on
Core version is v6.0.3 (Latest: v6.0.4)
Web version is v6.0.1 (Latest: v6.0.1)
FTL version is v6.0.1 (Latest: v6.0.2)

while troubleshooting i upgraded and found the same issues persist with
Core version is v6.0.4 (Latest: v6.0.4)
Web version is v6.0.1 (Latest: v6.0.1)
FTL version is v6.0.2 (Latest: v6.0.2)

Platform

PRETTY_NAME="Ubuntu 24.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.2 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

  • Platform: beelink

Expected behavior

per description, in order to enable custom settings for /etc/pihole/dnsmasq.conf
set etc_dnsmasq_d = true in /etc/pihole/pihole.toml

example: (edited to show example subnet ips are both in private network class)
attempting to add to /etc/dnsmasq.d/01-pihole-local-network.conf
localise-queries=192.168.0.0/24,192.168.2.0/24
(1 entry represents local network and the other is a network configured on the VPN)

adding this is expected to eliminate diagnosis finding:
ignoring query from non-local network 192.168.2.1 (logged only once)

restarting the pihole-FTL service and domains, and lists are now empty (despite being previously populated)
attempting to "add to allowed domains" gives error "db is not configured"

reverting etc_dnsmasq_d = false and restarting pihole-FTL service resolves all issues

NOTE: it appears that infographics on dashboard are populated still and also values for cname and custom a records. unclear how well all of that is working outside of testing that was described above

EDIT to provide example of systemctl status output when the configuration is added
NOTE: if i comment out the configuration in the dnsmasq.d config file the service starts normally with no errors

username@servername:/etc/dnsmasq.d# systemctl status pihole-FTL.service
● pihole-FTL.service - Pi-hole FTL
Loaded: loaded (/etc/systemd/system/pihole-FTL.service; enabled; preset: enabled)
Active: active (running) since Wed 2025-02-26 06:08:58 UTC; 1s ago
Process: 161100 ExecStartPre=/opt/pihole/pihole-FTL-prestart.sh (code=exited, status=0/SUCCESS)
Main PID: 161120 (pihole-FTL)
Tasks: 7 (limit: 18834)
Memory: 25.7M (peak: 31.0M)
CPU: 798ms
CGroup: /system.slice/pihole-FTL.service
└─161120 /usr/bin/pihole-FTL -f

Feb 26 06:08:58 servername pihole-FTL[161120]: 2025-02-26 06:08:58.570 UTC [161120M] INFO: - 20 entries are modified
Feb 26 06:08:58 servername pihole-FTL[161120]: 2025-02-26 06:08:58.570 UTC [161120M] INFO: - 0 entries are forced through environment
Feb 26 06:08:58 servername pihole-FTL[161120]: 2025-02-26 06:08:58.571 UTC [161120M] INFO: Parsed config file /etc/pihole/pihole.toml successfully
Feb 26 06:08:58 servername pihole-FTL[161120]: 2025-02-26 06:08:58.571 UTC [161120M] INFO: PID file does not exist or not readable
Feb 26 06:08:58 servername pihole-FTL[161120]: 2025-02-26 06:08:58.571 UTC [161120M] INFO:
Feb 26 06:08:58 servername pihole-FTL[161120]: dnsmasq: extraneous parameter at line 1 of /etc/dnsmasq.d/01-localise-queries.conf
Feb 26 06:08:58 servername dnsmasq[161120]: extraneous parameter at line 1 of /etc/dnsmasq.d/01-localise-queries.conf
Feb 26 06:08:58 servername dnsmasq[161120]: FAILED to start up
Feb 26 06:08:59 servername pihole-FTL[161120]: No other running FTL process found.
Feb 26 06:08:59 servername pihole-FTL[161120]: 2025-02-26 06:08:58.572 UTC [161120M] INFO: PID of FTL process: 161120

Steps to reproduce

see above

Debug Token

Ran
pihole -d. https://docs.pi-hole.net/core/pihole-command/#debugger
asked if i wanted to upload the log i said yes and error returned: This: command not found

after upgrade noted above same issue with the debug token: This: command not found

@DL6ER
Copy link
Member

DL6ER commented Feb 24, 2025

Well, quite obviously, this shouldn't happen. I wonder what might be the cause as I know many (including me) are using etc_dnsmasq_d = true without issues.

Question 1: Could you try if you observe the same if you instead use:

sudo pihole-FTL --config misc.dnsmasq_lines '["localise-queries=192.168.0.0/24,192.169.2.0/24"]'

This will add this one line right away into the configuration without having to go the detour over a file in /etc/dnsmasq.d?

Question 2: Do you have any other files in /etc/dnsmasq.d/ that could look at that may be the root cause for this defect?

@epipenRX
Copy link
Author

epipenRX commented Feb 26, 2025

hey, thanks for your feedback
i edited my original post to reflect that both subnets are in the 192.168.x.x ranges (there was a typo and one of the subnets was 192.169... but that is trivial anyways, and i got the gist of what you were trying to tell me. these are examples anyways to obfuscate my config)

here's what happens when i run the commant. i copy pasted except to match my actual subnet ranges.
username@servername:~# sudo pihole-FTL --config misc.dnsmasq_lines '["localise-queries=192.168.0.0/24,192.168.2.0/24"]'
New dnsmasq configuration is not valid (nsmasq: extraneous parameter at line 145 of /etc/pihole/dnsmasq.conf.temp: "localise-queries=192.168.0.0/24,192.168.2.0/24"), config remains unchanged
NOTE: i fed this into chatgpt and it suggested the following

  • sudo pihole-FTL --config misc.dnsmasq_lines '[{"localise-queries": "192.168.0.0/24,192.168.2.0/24"}]'
    suggesting the command may need to be passed in a json format
    • i didn't want to try this though because if it stuck and failed i didn't know a way to revert it and didn't want to spend my night troubleshooting or reverting and restoring my router heh

i double checked systemctl status pihole-FTL and it has the same error when i use that configuration line, and if i comment it out the service starts normally and shows a normal status.

regarding other config files in the dnsmasq.d directory... yes (but it hadn't gotten as far as loading them till i commented out the localise-queries config file). they shouldn't have loaded, but dnsmasq attempted to load them.
they were legacy from before i upgraded pihole, and i had renamed them Ex: filename.conf to filename.conf.disabled
this has been my practice for many config.d type folders and expected no issue. but i found that it did attempt to load them and failed (because some dhcp configurations matched those already loaded from /etc/pihole/dnsmasq.conf
this indicates that the /etc/pihole/dnsmasq.conf is bugged and the following line that gets added should be changed
from (i may open another ticket for this)
conf-dir=/etc/dnsmasq.d
to
conf-dir=/etc/dnsmasq.d/*.conf
....as is typical for default config.d behavior

i have tried:
comma separated format
2 line format, enable first subnet only, enable second subnet only
spelling localise as localize (incease there was a typo or something in the code)
using a : instead of an =
using space before and after boht : and =

same error every time

for sanity i tried uncommenting one of my old (non duplicate) dhcp reservations: (and even reanamed to remove the trailing .disabled from the filename)

  • the service still started normally but i was unable to find the dhcp reservation in the list of reservations i have configured in pihole web UI and expected them all to be visible.

this was basically a fresh install of pihole becuase the upgrade from v5.21 to 6.03 broke everything and i fully uninstalled pihole and lighthttpd and cleaned up files and then reinstalled from scratch and reconfigured everything (i spent the night troubleshooting and reconfiguring)

before doing all of this troublehsooting just now i have also backed up pihole and run pihole -up to see if it would resolve any issues
currently
Core version is v6.0.4 (Latest: v6.0.4)
Web version is v6.0.1 (Latest: v6.0.1)
FTL version is v6.0.2 (Latest: v6.0.2)

@epipenRX
Copy link
Author

also i suppose we proved that the original issue is not correct anymore
etc_dnsmasq_d = true breaks the database

but now we see that (for me at least) loading configs from /etc/dnsmasq.d has issues
1: any configuration of localise-queries seems to break dnsmasq
2: dnsmasq should only load files in dnsmasq.d that strictly end with .conf
3: dhcp reservations (and perhaps other settings) are not loading from the dnsmasq.d, and if they are, they are not being displayed or visibly appended to the list of dhcp reservations in the UI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants