lightningd.service: shut down lightningd properly.
What changed, and why it matters
This commit updates the systemd service file that manages the Core Lightning daemon so that it shuts down the service gracefully instead of abruptly killing it. The change adds a two-step stop command: first a graceful shutdown with a 20-second window, then a hard stop if needed, plus a 60-second timeout. This is an operational reliability fix, not a security vulnerability fix. It reduces the risk of data corruption or inconsistent state from a forced shutdown, but it does not introduce or patch an exploit.
Adopt the updated systemd unit if running Core Lightning under systemd, especially versions supporting the graceful stop command. This is a routine maintenance/reliability improvement, not an urgent security patch.
Security signals we found
Operational hardening: prevents unclean shutdown of a financial state daemon
No memory safety, authentication, cryptography, or network changes
No vulnerability class identified in the diff
Evidence from the diff
The patch modifies contrib/init/lightningd.service to add ExecStop directives using lightning-cli graceful 20 followed by lightning-cli stop, and sets TimeoutStopSec=60. The graceful subcommand was introduced in v26.06. This ensures systemd triggers an orderly daemon shutdown rather than sending SIGTERM/SIGKILL directly, which can help avoid partial database writes, channel state inconsistencies, or loss of in-flight payments. There is no code change to lightningd itself, only to the example/init systemd unit.
Changed components
contrib/init/lightningd.serviceInspect captured patch +4 / −0
diff --git a/contrib/init/lightningd.service b/contrib/init/lightningd.service
index 8e46096b..60f76b04 100644
--- a/contrib/init/lightningd.service
+++ b/contrib/init/lightningd.service
@@ -16,6 +16,10 @@ After=network-online.target
[Service]
ExecStart=/usr/bin/lightningd --conf /etc/lightningd/lightningd.conf --pid-file=/run/lightningd/lightningd.pid
+# graceful was introduced in v26.06: before that, simply stop.
+ExecStop=/usr/bin/lightning-cli --conf /etc/lightningd/lightningd.conf graceful 20
+ExecStop=/usr/bin/lightning-cli --conf /etc/lightningd/lightningd.conf stop
+TimeoutStopSec=60
# Creates /run/lightningd owned by bitcoin
RuntimeDirectory=lightningd
Why this scored 20/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.