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

Duplicate local DNS entries on 2nd import of pre-v6 export #2257

Open
Nwevyn opened this issue Feb 22, 2025 · 3 comments
Open

Duplicate local DNS entries on 2nd import of pre-v6 export #2257

Nwevyn opened this issue Feb 22, 2025 · 3 comments

Comments

@Nwevyn
Copy link

Nwevyn commented Feb 22, 2025

Versions

  • Pi-hole: Core version is v6.0.3 (Latest: v6.0.3)
  • AdminLTE: Web version is v6.0.1 (Latest: v6.0.1)
  • FTL: FTL version is v6.0.2 (Latest: v6.0.2)

Platform

  • OS and version: Debian GNU/Linux 12 (bookworm)
  • Platform: Proxmox VM

Expected behavior

DNS server to not "fail"

Actual behavior / bug

A clear and concise description of what the bug is.
"DNS SERVER FAILURE" with PIHOLE.LOG (as reported in web interface):
2025-02-22 15:56:38.316 duplicate CNAME at line 123 of /etc/pihole/dnsmasq.conf
2025-02-22 15:56:38.316 FAILED to start up

Reviewing "pihole.toml" both the "hosts" and "cnameRecords" arrays show the newest entries appended to existing entries. A comma is added to the last existing entry so the array is syntactically correct.

Steps to reproduce

Have an existing pre-v6 PiHole server with several local DNS and CNAME records.
On pre-v6 PiHole, use Teleporter page to export existing configuration.

Spin up a new v6 PiHole server. Either bare metal or docker (I've tested both).
On new v6 PiHole use Teleporter page to import the pre-v6 configuration.

On pre-v6 PiHole, change a local DNS entry (either record or CNAME). Not necessary, but it was my use case.
On pre-v6 PiHole, use Teleporter page to export the updated configuration.

On v6 PiHole use Teleporter page to import the updated configuration.

See error reported upon completion of import.
pihole.log page shows above "FAILED to start up" message
Local DNS records (under "settings") show duplicates in both DNS Records and CNAME records
These duplicates are also found in the "pihole.toml" file

Debug Token

Screenshots

Additional context

Duplicate DNS Records can be deleted on the web page. However, attempting to delete duplicate CNAME records results in " Invalid configuration - dnsmasq: duplicate CNAME at line 122 of /etc/pihole/dnsmasq.conf.temp: " message. These must be deleted from underlying "pihole.toml" file.

A valid backup exported from the v6-PiHole teleporter page can be imported multiple times and will not cause duplicate entries. So, this bug is somewhere in the translation logic.

@yubiuser yubiuser transferred this issue from pi-hole/web Feb 22, 2025
@DL6ER
Copy link
Member

DL6ER commented Feb 23, 2025

Okay, so the bug path is a v5 Teleporter image imported on v6 does not wipe out the dns.hosts and dns.cnameRecords arrays. While checking the source code, I found that the same issue happens with dhcp.hosts (you probably just didn't have had that). Please try whether

sudo pihole checkout ftl fix/v5_v6_hosts_cnameRecords

fixes this for you.

@Nwevyn
Copy link
Author

Nwevyn commented Feb 24, 2025

Ok, I attempted to test this and it didn't work.

Then, I actually read the output of the "checkout" command and noticed:


  [i] Checking for availability of branch fix/v5_v6_hosts_cnameRecords on GitHub
  [✗] Requested branch is not available

  [i] Available branches are:
      - codeql
      - dependabot-npm_and_yarn-development-npm-dependencies-c947a1b127
      - development
      - fix/debugging
      - fix/ede_neterr
      - fix/fork_building_1
      - fix/strange_forwarding
      - help_indent
      - http2
      - master
      - new/GeoIP
      - new/basic_auth
      - new/editorconfig
      - new/libbacktrace2
      - new/libexecinfo
      - new/lsqlite3
      - new/unwinding
      - new/warn_open_resolver
      - special/CI_development
      - test/self-host
      - tweak/adam42
      - tweak/conn_errors
      - tweak/conn_errors_threashold
      - tweak/enabled_total_counts
      - tweak/riscv64-self-hosted
      - tweak/shm_anywhere
      - tweak/two_webthreads
      - update/dnsmasq

I don't see anything in the available list that looks like what you requested (assuming a possible typo). So, not sure what happened.

@Nwevyn
Copy link
Author

Nwevyn commented Feb 24, 2025

Now that I'm back from my morning appointment, I did a little more research here. I noticed that this fix had been merged into development and the patch was deleted. So, I took a chance (on my test VM) and did a checkout of the "development" branch and retested.

And this did fix my issue.

Thanks for all your effort.

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