Repository navigation
Description
What happened?
I attempted a sudo systemctl restart salt-minion (which will stop and start salt-minion) on a subset of the minions registered with that salt master. That command returned without error. I then attempted a test.ping from the master which timed out on a few minions in that subset. That subset of minions are all physical hosts.
So I logged into one of the failing minions:
$ sudo systemctl status salt-minion.service
● salt-minion.service - The Salt Minion
Loaded: loaded (/lib/systemd/system/salt-minion.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2025-10-15 19:40:05 UTC; 41min ago
Docs: man:salt-minion(1)
file:///usr/share/doc/salt/html/contents.html
https://docs.saltproject.io/en/latest/contents.html
Process: 81226 ExecStart=/usr/bin/salt-minion (code=exited, status=1/FAILURE)
Main PID: 81226 (code=exited, status=1/FAILURE)
Tasks: 7 (limit: 309126)
Memory: 450.8M
CGroup: /system.slice/salt-minion.service
├─ 66658 /opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager ProcessPayload(jid=20251015190818334152) Minion._thread_return
└─1079760 /opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager
According to ps aux process 1079760 was from the time I installed 3006.16 on this minion or later that same day:
$ ps aux | grep salt
root 66658 0.5 0.0 818072 147684 ? Sl 19:08 0:25 /opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager ProcessPayload(jid=20251015190818334152) Minion._thread_return
ldavis 109652 0.0 0.0 12252 2132 pts/0 S+ 20:22 0:00 grep --color=auto salt
root 1079760 0.2 0.0 754980 94736 ? S Sep26 66:57 /opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager
As part of the job I use to install the salt-minion onedir packages, I do attempt to restart the service post-install shortly after the install completes. I tended to get less unstarted minions that way in the past (and currently).
After killing the old process and restarting salt-minion:
$ sudo kill -9 1079760
$ sudo systemctl restart salt-minion.service
I was able to test.ping from the minion's salt master again and receive a response.
I then invoked sudo systemctl stop salt-minion on the previous subset of minions. When I searched for salt-minion processes on this subset, many had correctly shutdown all of them, but a few still had lingering Minion._thread_return processes, which I kill -9ed before invoking sudo systemctl start salt-minion on them to restart salt-minion.
I noticed in /lib/systemd/system/salt-minion.service that the kill mode is set to process
...
[Service]
KillMode=process
...
instead of the default control-group.
I was requested to open a new issue for 3006.16 here:
Originally posted by @barneysowood in #65265
I cannot choose the correct OS version; apparently Ubuntu 20.04 has been removed.
Type of salt install
Official deb
Major version
3006.x
What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)
ubuntu-22.04
salt --versions-report output
$ salt --versions-report
Salt Version:
Salt: 3006.16
Python Version:
Python: 3.10.18 (main, Sep 5 2025, 22:48:51) [GCC 11.2.0]
Dependency Versions:
cffi: 1.17.1
cherrypy: 18.10.0
cryptography: 42.0.5
dateutil: 2.8.1
docker-py: Not Installed
gitdb: 4.0.10
gitpython: Not Installed
Jinja2: 3.1.6
libgit2: 1.9.1
looseversion: 1.0.2
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 24.0
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.19.1
pygit2: 1.18.2
python-gnupg: 0.4.8
PyYAML: 6.0.1
PyZMQ: 23.2.0
relenv: 0.20.6
smmap: 5.0.0
timelib: 0.3.0
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: ubuntu 20.04.6 focal
locale: utf-8
machine: x86_64
release: 5.4.0-216-generic
system: Linux
version: Ubuntu 20.04.6 focal
$ salt-minion --versions-report
Salt Version:
Salt: 3006.16
Python Version:
Python: 3.10.18 (main, Sep 5 2025, 22:48:51) [GCC 11.2.0]
Dependency Versions:
cffi: 1.14.6
cherrypy: 18.10.0
cryptography: 42.0.5
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.6
libgit2: Not Installed
looseversion: 1.0.2
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 24.0
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.19.1
pygit2: Not Installed
python-gnupg: 0.4.8
PyYAML: 6.0.1
PyZMQ: 23.2.0
relenv: 0.20.6
smmap: Not Installed
timelib: 0.3.0
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: ubuntu 20.04.2 focal
locale: utf-8
machine: x86_64
release: 5.4.0-26-generic
system: Linux
version: Ubuntu 20.04.2 focal
Activity
welcome commentedon Oct 16, 2025
Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here's some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:
There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at [email protected]. We're glad you've joined our community and look forward to doing awesome things with you!
OrangeDog commentedon Oct 19, 2025
Comments in #33665 imply that there's some reason for it, but I can't see why.
Systemd specifically advises against it:
Personally, I have overridden it to
mixed.twangboy commentedon Oct 30, 2025
Going through the history I found the reason here:
#33792 (comment)
There's a long-running issue of Salt being able to update itself.
KillMode=processallows a child process to continue upgrading salt-minion even though the parent process has been killed by the upgrade process.The discussion in the above issue was more about why that setting was applied to other salt services (master, api, etc). It was determined that it was only needed by the minion to upgrade itself.
ldav1s commentedon Oct 30, 2025
I'll have to admit that I've never used the salt builtins for this e.g.
saltutil.update(which might be platform specific).This is the method I use, which I alluded to in my original report:
But because
KillMode=processstale processes from the previoussalt-minionstill hang around.It seems that the historical problem is that the regular
KillModekillssalt-minionbefore the .deb is fully deployed, resulting in a broken package. It might be possible to move the running salt-minion processes to another cgroup prior to the package deploy so thatKillModekills nothing (the old processes are in a different cgroup at this point), the deploy completes, and something on start ofsalt-minionkills the cgroup containing the previoussalt-minionprocesses.barneysowood commentedon Nov 12, 2025
I wouldn't want to change to
KillMode=control-groupas this would break my recent fix to allowservice.restart salt-minionto work (see #68183 and #68209) as it sends a SIGTERM to all processes in the cgroup and leads to the process trying to send the return being terminated too soon.Some brief testing with
KillMode=mixedlooks positive - that only sends the SIGTERM to the main process but will cleanup any remaining processes in the cgroup with a SIGKILL once the main process exits or after TimeoutStopSec (90s), so allows the return to happen but should be much better at cleaning up any leftover processes.I'd like to do a bit more testing to make sure that works reliably.
WRT to the issue of salt being able to update itself, where systemd was killing the package upgrade, I'm not sure if that is an issue any more - both
aptpkgandyumpkgrun sub-processes in a separate systemd scope. I'll do a bit of testing, but if anyone can give an instance of when that is an issue, that'd be good.@ldav1s - WRT to
saltutil.update, I've never spotted that before.. I suspect it's an artefact of some ancient packaging system:I suspect it could be removed and I may take a look at that..
I've also been thinking about building something by way of a runner that will give a standardised way to do minion upgrades... everyone has their own way of doing it that works for them but everyone is re-inventing the wheel and it'd be better to have a standard way we can all improve.
barneysowood commentedon Nov 12, 2025
Doing a
salt <minion> pkg.upgradewith available salt packages (on Ubuntu 24.04), the package gets upgraded. Unfortunately the restart initiated by apt fails - the MinionManager process and the process handling the return don't get killed.. although they seem to die shortly after, although by that time systemd has given up. This then requires a start of the salt-minion service.Tried the same with an override to set
KillMode=mixedand although the restart has to fall back to sending SIGKILL, it does clean up the child processes and the service successfully restarts. So that's looking promising.OrangeDog commentedon Nov 13, 2025
Exactly. This hack to get it to work properly is actually the cause of it not working properly in the first place.
ldav1s commentedon Nov 13, 2025
It might not be possible to set one
KillModefor all the ways that users want to start/restartsalt-minion. For example:systemctl restart salt-minion.servicesalt pkg.upgradesalt service.restart salt-minionetc. I'll have to take a look at
KillMode=mixed.Use KillMode=mixed in salt-minion.service unit
Use KillMode=mixed in salt-minion.service unit
Use KillMode=mixed in salt-minion.service unit
Merge pull request #69384 from dwoz/fix/issue-68406
Auto-restart salt-minion.service on crash
Auto-restart salt-minion.service on crash
Auto-restart salt-minion.service on crash
Auto-restart salt-minion.service on crash (#69182) (#69671)