Repository navigation
Fix minion-driven RPM upgrade deadlock and SIGKILL (#69656) - #69664
Merged
Merged
Conversation
bdrx312
reviewed
Jul 2, 2026
The RPM %pre minion scriptlet's blocking systemctl stop salt-minion.service deadlocks when the upgrade is driven by the running minion itself (via pkg.installed / pkg.install from a state run): the stop waits for every process in the KillMode=mixed cgroup to exit, including the salt worker running the state, which is waiting on dnf, which is waiting on %pre. After TimeoutStopSec, systemd SIGKILLs the whole cgroup and the state run's return is lost. Orchestrated minion upgrades cannot work at all. %pre minion now detects the self-upgrade case by walking the scriptlet's parent process chain looking for salt-minion.service in /proc/<pid>/cgroup and, in that case, skips the in-scriptlet stop and drops a /tmp/.salt-minion-self-upgrade marker. %post minion honours that marker to skip the try-restart that would otherwise interrupt the still-running state run. %posttrans minion's start is a no-op against the still-active unit, so the state completes and the FAQ cmd.run bg: True pattern performs the actual restart in a detached child. Also corrected the FAQ entry: the shipped unit sets KillMode=mixed, not KillMode=process as the old wording claimed. Fixes saltstack#69656
twangboy
previously approved these changes
Jul 6, 2026
Both branches of the `{%- if grains['kernel'] == 'Windows' %}` block
contained identical content, so remove the conditional and leave a
single unconditional `- name:` line.
This branch was previously deployed
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?
Guards
%pre minion's blockingsystemctl stop salt-minion.servicebehind a self-upgrade detection helper so a minion running the
pkg.installedstate that drives its own RPM upgrade no longerdeadlocks the transaction and gets SIGKILLed by systemd.
What issues does this PR fix or reference?
Fixes #69656
Related: #69605, #68406, #69545.
Previous Behavior
%pre minionon upgrade unconditionally runs/bin/systemctl stop salt-minion.service. WithKillMode=mixedinthe shipped unit, the stop waits for every process in the cgroup to
exit. When the transaction was driven by the running minion, the salt
worker running the state is in that cgroup, waiting on
dnf, which iswaiting on
%pre. AfterTimeoutStopSec(90s) systemd SIGKILLs thewhole cgroup -- including the salt worker -- and the state run's
return is lost. Orchestrated minion upgrades cannot work at all.
New Behavior
%pre minionnow walks the scriptlet's parent process chain via/proc/<pid>/statusPPid entries and/proc/<pid>/cgroup. If anyancestor is inside
salt-minion.service, the scriptlet drops a/tmp/.salt-minion-self-upgrademarker and skips the blocking stop.%post minionhonours the same marker to skip itstry-restart(which would otherwise kill the still-running state).
%posttrans'ssystemctl startis a no-op against the still-active unit. The statecompletes normally, and the FAQ
cmd.run bg: Truepattern performsthe actual restart in a detached child after the state returns.
FAQ entry corrected: the shipped unit sets
KillMode=mixed, notKillMode=processas previous wording claimed.Merge requirements satisfied?
Commits signed with GPG?
Yes