config, cli, packaging, nix: stop restarting headscale on a configuration error

serve exits 78 (EX_CONFIG) when the configuration file it loaded is
wrong: format, syntax, keys or values. No file, an unreadable one, the
database and ports still exit 1, so systemd keeps retrying what can
heal. The deb unit and the NixOS module set RestartPreventExitStatus=78.
A parse error gives a position and fixed words, never the file's text.

Updates #1926
This commit is contained in:
Kristoffer Dalby committed 2026-11-11 12:19:29 +01:00
1 parent 73ef19c0ab
commit eff078ffa2
10 files changed
+205 -7

No files matched your search

+1 -1
View File
@@ -53,7 +53,7 @@ case "$1" in
else
if [ -n "$2" ]; then
echo 'headscale was not restarted after the upgrade: its configuration does not pass "headscale check config" (errors above).' >&2
echo 'A running headscale keeps the previous version only until it restarts: needrestart after apt, a reboot or a crash starts this version, which refuses the configuration.' >&2
echo 'A running headscale keeps the previous version only until it restarts: needrestart after apt, a reboot or a crash starts this version, which refuses the configuration and stays stopped until it is fixed.' >&2
else
echo 'headscale was not started: its configuration does not pass "headscale check config" (errors above).' >&2
fi
+3
View File
@@ -10,6 +10,9 @@ ExecStart=/usr/bin/headscale serve
ExecReload=/usr/bin/kill -HUP $MAINPID
Restart=always
RestartSec=5
# headscale serve exits 78 (EX_CONFIG) on a configuration it rejects, which
# a restart cannot fix.
RestartPreventExitStatus=78
WorkingDirectory=/var/lib/headscale
ReadWritePaths=/var/lib/headscale