Upgrade to v6 breaks installer and DNS resolution on config error

tl;dr: Issue already solved, just small question regarding handling the aftermath at the end. Long description only for the error messages being searchable and maybe for the devs for fixing the bug(s).

So today I updated my main Pi-hole installation and thought I were prepared for everything... it turned out: No
Sadly the installer broke during update:

  [✓] Migrating Pi-hole configuration to version 6
    Migrating config to Pi-hole v6.0 format
    Reading legacy config files from /etc/pihole/pihole-FTL.conf
[...]
    Moving /etc/pihole/pihole-FTL.conf to /etc/pihole/migration_backup_v6/pihole-FTL.conf
    Migrating config from /etc/pihole/setupVars.conf
[...]
    Moved /etc/pihole/setupVars.conf to /etc/pihole/migration_backup_v6/setupVars.conf
    setupVars.conf migration complete
    Moving /etc/pihole/custom.list to /etc/pihole/migration_backup_v6/custom.list
    Config initialized with webserver ports 8080 (HTTP) and 443 (HTTPS), IPv6 support is enabled
    Wrote config file:
     - 152 total entries
     - 133 entries are default
     - 19 entries are modified
     - 0 entries are forced through environment
    Config file written to /etc/pihole/pihole.toml
    Trying to copy a NULL (L) string in write_dnsmasq_config() (/app/src/config/dnsmasq_config.c:301)
    Unable to update dnsmasq configuration: (null)
  [i] Testing if systemd-resolved is enabled
  [i] Systemd-resolved is not enabled
  [i] Upgrading gravity database from version 15 to 16
  [i] Upgrading gravity database from version 16 to 17
  [i] Upgrading gravity database from version 17 to 18
  [i] Upgrading gravity database from version 18 to 19
  [i] Restarting services...
  [✓] Enabling pihole-FTL service to start on reboot...
  [✓] Restarting pihole-FTL service...
  [✓] Migrating the list's cache directory to new location
  [✓] Deleting existing list cache
  [✗] DNS resolution is currently unavailable
  [i] Waiting until DNS resolution is available...

Then only more dots appeared in an endless loop, until I finally cancelled the script:

  [i] User-abort detected
  [✓] Cleaning up stray matter
  [✓] FTL is listening on port 53
     [✓] UDP (IPv4)
     [✓] TCP (IPv4)
     [✓] UDP (IPv6)
     [✓] TCP (IPv6)

  [✓] Pi-hole blocking is enabled

  Unable to complete update, please contact Pi-hole Support

The error message could also be seen in the logs. FTL was up, but DNS didn't work.

$ sudo 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 22:11:53 CET; 9min ago
    Process: 591420 ExecStartPre=/opt/pihole/pihole-FTL-prestart.sh (code=exited, status=0/SUCCESS)
   Main PID: 591437 (pihole-FTL)
      Tasks: 8 (limit: 9256)
     Memory: 99.7M
        CPU: 17.549s
     CGroup: /system.slice/pihole-FTL.service
             +-591437 /usr/bin/pihole-FTL -f

Feb 26 22:11:53 [servername] pihole-FTL[591437]: 2025-02-26 22:11:53.570 CET [591437M] INFO:  - 133 entries are default
Feb 26 22:11:53 [servername] pihole-FTL[591437]: 2025-02-26 22:11:53.570 CET [591437M] INFO:  - 19 entries are modified
Feb 26 22:11:53 [servername] pihole-FTL[591437]: 2025-02-26 22:11:53.570 CET [591437M] INFO:  - 0 entries are forced through environment
Feb 26 22:11:53 [servername] pihole-FTL[591437]: 2025-02-26 22:11:53.571 CET [591437M] ERROR: Trying to copy a NULL (L) string in write_dnsmasq_config(>
Feb 26 22:11:55 [servername] pihole-FTL[591437]: 2025-02-26 22:11:53.571 CET [591437M] ERROR: Unable to update dnsmasq configuration: (null)
Feb 26 22:11:55 [servername] dnsmasq[591437]: started, version pi-hole-v2.91rc5 cachesize 150
Feb 26 22:11:55 [servername] dnsmasq[591437]: compile time options: IPv6 GNU-getopt no-DBus no-UBus no-i18n IDN2 DHCP DHCPv6 Lua TFTP no-conntrack ipse>
Feb 26 22:11:55 [servername] dnsmasq[591437]: reading /etc/resolv.conf
Feb 26 22:11:55 [servername] dnsmasq[591437]: ignoring nameserver 127.0.0.1 - local interface
Feb 26 22:11:55 [servername] dnsmasq[591437]: read /etc/hosts - 8 names

During debugging I luckily got a better error message:

Unable to update dnsmasq configuration: DHCP range start address is larger than or equal to the end address

... and yes, I intentionally set the start address equal to the end address. This was a valid (= accepted from the web interface) config in v5

I did this intentionally, because I put all my DHCP configuration in a separate file in /etc/dnsmasq.d/ - where I defined different IP address ranges (and configs) for different network interfaces, which I am not able to do so via web interface.

So it somehow is an edge case, but on the other hand it was a valid config in v5, so the installer should be able to upgrade it to v6 without locking up.

I already fixed the config ( sudo pihole-FTL --config misc.etc_dnsmasq_d true for the fast fix) and my network is up again.

The only problem I have left is that the web interface tells me, I'm not up to date:
image

Runing the updater a second time tells me I'm up to date

$ sudo pihole -up
  [✓] Supported OS detected
  [✓] Update local cache of available packages
  [✓] Building dependency package pihole-meta.deb
  [✓] Installing Pi-hole dependency package

  [i] Checking for updates...
  [i] Pi-hole Core:     up to date
  [i] Web Interface:    up to date
  [i] FTL:              up to date

  [✓] Everything is up to date!

Web interface also looks like a v6 web interface - but still tells me it is not up to date.
How do I recover from here?

Have you used this sudo pihole checkout master?

It said that I'm already on master:

  [i] Shortcut "master" detected - checking out master branches...
  [i] Pi-hole core
  [✓] Switching to branch: 'master' from 'refs/heads/master'
  [i] Already up to date.
  [i] Web interface
  [✓] Switching to branch: 'master' from 'refs/heads/master'
  [i] Already up to date.
  [i] Running installer to upgrade your installation

In the end it showed the current versions:

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)

and now web interface also shows them:
image

Thank you!

1 Like

Next time, use

sudo /opt/pihole/updatecheck.sh

which will only update the file containing all the version information

2 Likes

Thank you for the report and sorry for the delay in picking this up...

This bugfix should cover everything you've found:
https://github.com/pi-hole/FTL/pull/2314

1 Like

You're welcome!
No worries, two and a half day for a fix is still a very fast response. Thank you very much.

I will make use of the "empty DHCP range" feature again once it's included in the next version.

1 Like

I was just looking to review the PR proposed by @DL6ER , but have not tested it.

Have you been able to test the fix yourself @stefan, and confirm that it does what you're expecting it to do?

You can try it with the command pihole checkout ftl fix/dhcp_range (you can switch back to the main release afterwards with pihole checkout master

I haven't tested it as I didn't want to break my network once again and was not sure how to do exactly. Thanks for the instructions!

So now I tested:

  • Empty DHCP range is not allowed (FTL v6.0.2, produces error message)
  • switched ftl to fix/dhcp_range branch, log confirms restart of FTL
  • Changed DHCP range to an empty one, change is accepted and log confirms FTL restart
  • Spun up network client and confirmed (including logs) that he got an IP address via DHCP
  • switched back to non-empty DHCP range
  • switched ftl back to master (FTL v6.0.3), log confirms restart but also shows database errors like those at startup:
2025-03-02 18:20:08.433 ERROR domain_in_list("9.9.9.9.in-addr.arpa", 0x7f1bd53c02a8, gravity): Failed to perform step: SQL logic error
2025-03-02 18:20:08.472 ERROR SQLite3: no such table: main.antigravity in "SELECT adlist_id from vw_antigravity WHERE domain = ? AND group_id IN (0);" (1)
  • Confirm that clients still get DHCP leases (via log and client)

So for me it looks fine!
I just don't want to test the v5 -> v6 upgrade path, this would be more effort.

No that's fine, that test is good enough f or me

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.