Auto-restart salt-minion.service on crash (#69182) - #69671
Open
dwoz wants to merge 1 commit into
Open
Conversation
The shipped pkg/common/salt-minion.service systemd unit had no Restart=/RestartSec=/StartLimit* directives. When the minion crashed (unhandled exception, worker OOM, etc.) the unit stayed in the failed state until someone logged in and ran systemctl start salt-minion, leaving the host offline from the master's point of view for as long as it took a human to notice. Ask systemd to restart on failure with a 15-second gap between attempts and a 3-attempts-in-5-minutes cap so a persistent crash loop cannot hammer the box. StartLimitBurst and StartLimitIntervalSec live in [Unit] (systemd rejects them in [Service] with "Unknown key ... in section [Service], ignoring."); Restart and RestartSec live in [Service]. Extend the existing static-file audit in tests/pytests/unit/test_pkg_systemd_units.py (added alongside the KillMode=mixed fix in saltstack#68406) to assert the new directives are set and cannot silently regress. Fixes saltstack#69182
twangboy
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds
Restart=on-failure,RestartSec=15,StartLimitBurst=3, andStartLimitIntervalSec=300to the shippedpkg/common/salt-minion.servicesystemd unit so that a crashed minion (unhandled exception, worker OOM,
etc.) is revived by systemd instead of being left in the failed state.
What issues does this PR fix or reference?
Fixes #69182
Related: #68406 (the recent
KillMode=mixedfix on the same file — thisPR extends the
tests/pytests/unit/test_pkg_systemd_units.pystaticaudit added there).
Previous Behavior
The shipped unit had no
Restart=/RestartSec=/StartLimit*directives.When the
salt-minionprocess crashed the unit went tofailedandstayed there until someone ran
systemctl start salt-minionby hand. Asthe reporter observed on 3008.0rc4 (Ubuntu 22.04) and a second contributor
confirmed on 3007.14 (Rocky 9), an unhandled exception took the minion
offline from the master's point of view until the next manual intervention.
New Behavior
Restart=on-failure+RestartSec=15in[Service]cause systemd torestart the minion 15 seconds after a non-clean exit.
StartLimitBurst=3StartLimitIntervalSec=300in[Unit]cap the loop at three restartattempts per five minutes so a persistent crash cannot hammer the box.
StartLimitBurst/StartLimitIntervalSecare intentionally placed in[Unit]—systemd-analyze verifyrejects them in[Service]withUnknown key 'StartLimitIntervalSec' in section [Service], ignoring.,and
[Unit]is systemd's canonical section for these directives.Merge requirements satisfied?
changelog/69182.fixed.md)Commits signed with GPG?
Yes