Skip to content

Make the pihole script path and the restart method build options - #3311

Merged
DL6ER merged 1 commit into
pi-hole:developmentfrom
cyberb:feat/configurable-script-and-restart
Nov 22, 2026
Merged

DL6ER merged 1 commit into
pi-hole:developmentfrom
cyberb:feat/configurable-script-and-restart

Conversation

@cyberb

@cyberb cyberb commented Oct 27, 2026

Copy link
Copy Markdown

Lets packagers such as Syncloud, which ships Pi-hole as a snap, point FTL at their own pihole script and restart it through systemd instead of re-executing argv[0].

cyberb added a commit to syncloud/pihole that referenced this pull request Oct 27, 2026
The fork's syncloud-v6.7 branch is v6.7 plus three commits: the CivetWeb UNIX
socket support, not aborting when only a socket is configured, and the
PIHOLE_SCRIPT and FTL_RESTART_COMMAND build options proposed upstream in
pi-hole/FTL#3311. Those replace the three code sed patches.

FTL_RESTART_COMMAND makes FTL ask systemd to restart snap.pihole.ftl instead
of re-executing argv[0]. Under the snap FTL is started through ld.so with a
library path, so the re-exec of pihole-FTL.bin crashed and systemd counted an
automatic restart (test_web_action_restartdns). The UI's Restart DNS, config
changes, teleporter import and NTP time updates all go through this path.

cmake is run directly because FTL's build.sh splits its cmake arguments on
spaces. The binary is checked for both baked-in strings. The path seds stay
until a release carries PIHOLE_INSTALL_DIR.

@darkexplosiveqwx darkexplosiveqwx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that this is still a draft, but I'd like to share my thoughts on the concept of this addition early.

Having a configurable /usr/local/bin/pihole is generally fine as an option.

I however don't like carrying FTL_RESTART_COMMAND. Even though its a compile-time option it's still a script we execute. The hardcoded shell doesn't make it look better. Additionally I don't see any other use case than your special setup.
Something I'd possibly be more open to accept would be a compile-time option for FTL to simply skip the self-exec and exit with RESTART_FTL_CODE. This would restore control to a supervisor to handle those situations.

@cyberb
cyberb force-pushed the feat/configurable-script-and-restart branch from c8dedeb to d7ab56a Compare October 27, 2026 15:38
cyberb added a commit to syncloud/pihole that referenced this pull request Oct 27, 2026
pi-hole/FTL#3311 now takes FTL_EXIT_ON_RESTART instead of a restart command:
FTL skips the re-exec of argv[0] and exits with RESTART_FTL_CODE (22), and the
snap's Restart=always brings it back after the 10s restart-delay. Bump the fork
to the rebuilt syncloud-v6.7 branch.

systemd counts those as automatic restarts, so assert_no_restarts now expects
NRestarts to equal the exits with status 22 in the unit's journal; any other
restart still fails the test.
cyberb added a commit to syncloud/pihole that referenced this pull request Oct 27, 2026
… the web UI (#6)

Bump the test platform image to 26.10.02, whose snapd matches the store, so the daily SnapdUpgradeJob no longer swaps snapd mid-test; the refresh hold entrypoint moves into a snapd_hold variable.

Serialise gravity runs with flock in bin/pihole.sh, as concurrent pihole -g rebuilt the same database.

Build FTL from cyberb/FTL syncloud-v6.7 (v6.7 plus CivetWeb UNIX socket support, socket-only port check and the PIHOLE_SCRIPT and FTL_EXIT_ON_RESTART options proposed in pi-hole/FTL#3311) instead of sed-patching the tarball. The web UI's Update gravity now runs our pihole wrapper instead of the missing /usr/local/bin/pihole, and FTL restarts (Restart DNS, restart-requiring settings, teleporter import, NTP) exit with code 22 for systemd to restart instead of re-executing argv[0], which crashed under the ld.so wrapper.

Tests: concurrent CLI gravity, web API gravity and restartdns, UI gravity update and Restart DNS (in Expert mode), status web waits for FTL to listen, and the restart check now requires every automatic restart in the journal to follow a status 22 exit.
@cyberb
cyberb marked this pull request as ready for review October 27, 2026 18:00
@cyberb
cyberb requested a review from a team as a code owner October 27, 2026 18:00

@DL6ER DL6ER left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit is not signed, and development only accepts signed commits. Please sign it and force-push.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

This pull request has conflicts, please resolve those before we can evaluate the pull request.

1 similar comment
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@cyberb
cyberb force-pushed the feat/configurable-script-and-restart branch from fd6f89a to 2aba0e4 Compare November 5, 2026 16:18
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Conflicts have been resolved.

DL6ER
DL6ER previously approved these changes Nov 5, 2026
@github-actions

Copy link
Copy Markdown

This pull request has conflicts, please resolve those before we can evaluate the pull request.

FTL runs /usr/local/bin/pihole for gravity updates and restarts itself by
re-executing argv[0]. Packagers that install the script elsewhere, or that
start FTL through a loader or wrapper so argv[0] cannot be re-executed on its
own, have to patch the sources.

PIHOLE_SCRIPT (default /usr/local/bin/pihole) sets the script path.
FTL_EXIT_ON_RESTART (default OFF) skips the re-exec, so FTL exits with
RESTART_FTL_CODE and leaves the restart to its supervisor. Defaults keep the
current behaviour.

Signed-off-by: Boris Rybalkin <ribalkin@gmail.com>
@cyberb
cyberb force-pushed the feat/configurable-script-and-restart branch from 2aba0e4 to 524428f Compare November 14, 2026 11:26
@github-actions

Copy link
Copy Markdown

Conflicts have been resolved.

@darkexplosiveqwx darkexplosiveqwx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still unsure how I'd like some packaging options to work, but this PR is fine for now.

@DL6ER
DL6ER merged commit e4bf852 into pi-hole:development Nov 22, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants