Repository navigation
Make the pihole script path and the restart method build options - #3311
Conversation
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
left a comment
There was a problem hiding this comment.
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.
c8dedeb to
d7ab56a
Compare
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.
… 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.
DL6ER
left a comment
There was a problem hiding this comment.
The commit is not signed, and development only accepts signed commits. Please sign it and force-push.
d7ab56a to
d6bb73e
Compare
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
1 similar comment
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
fd6f89a to
2aba0e4
Compare
|
Conflicts have been resolved. |
|
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>
2aba0e4 to
524428f
Compare
|
Conflicts have been resolved. |
darkexplosiveqwx
left a comment
There was a problem hiding this comment.
I am still unsure how I'd like some packaging options to work, but this PR is fine for now.
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].