Skip to content

Fix minion-driven RPM upgrade deadlock and SIGKILL (#69656) - #69664

Merged
dwoz merged 2 commits into
saltstack:3006.xfrom
dwoz:fix/issue-69656
Jul 6, 2026
Merged

dwoz merged 2 commits into
saltstack:3006.xfrom
dwoz:fix/issue-69656

Conversation

@dwoz

@dwoz dwoz commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Guards %pre minion's blocking systemctl stop salt-minion.service
behind a self-upgrade detection helper so a minion running the
pkg.installed state that drives its own RPM upgrade no longer
deadlocks the transaction and gets SIGKILLed by systemd.

What issues does this PR fix or reference?

Fixes #69656

Related: #69605, #68406, #69545.

Previous Behavior

%pre minion on upgrade unconditionally runs
/bin/systemctl stop salt-minion.service. With KillMode=mixed in
the 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 is
waiting on %pre. After TimeoutStopSec (90s) systemd SIGKILLs the
whole cgroup -- including the salt worker -- and the state run's
return is lost. Orchestrated minion upgrades cannot work at all.

New Behavior

%pre minion now walks the scriptlet's parent process chain via
/proc/<pid>/status PPid entries and /proc/<pid>/cgroup. If any
ancestor is inside salt-minion.service, the scriptlet drops a
/tmp/.salt-minion-self-upgrade marker and skips the blocking stop.
%post minion honours the same marker to skip its try-restart
(which would otherwise kill the still-running state). %posttrans's
systemctl start is a no-op against the still-active unit. The state
completes normally, and the FAQ cmd.run bg: True pattern performs
the actual restart in a detached child after the state returns.

FAQ entry corrected: the shipped unit sets KillMode=mixed, not
KillMode=process as previous wording claimed.

Merge requirements satisfied?

  • Docs
  • Changelog
  • Tests written/updated

Commits signed with GPG?

Yes

Comment thread doc/faq.rst Resolved
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
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

1 inactive deployment
ci — 93bae3aa Deployed Jul 6, 2026 by dwoz via Build Onedir Packages / RPM (arm64) #25368
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants