-
Couldn't load subscription status.
- Fork 5.6k
Description
What happened?
I was looking at my master logs and saw some errors related to grains. These showed up because the custom grains assumed running as root (the minions run as root).
Is the master supposed to execute custom grains? I can't think of a reason why the master needs to execute them? I think this is "similar" to #66746 in that the master shouldn't be doing anything with grains, that's for the minion.
I can't find any documentation that says the master process should be executing grains. https://docs.saltproject.io/salt/user-guide/en/latest/topics/grains.html
Setup.
Create a custom grains and make it available in the files repo.
import logging
def __virtual__():
return True
def custom_grain():
logging.error('Custom Grain!')
return {}Sync the grains (I was initially doing this for renderer stuffs and grains got pulled in).
# change as necessary, we run salt as "salt:salt" so that's who needs to sync
$ sudo -g salt -u salt salt-run saltutil.sync_all
cache:
clouds:
engines:
executors:
fileserver:
grains:
- grains.custom
modules:
output:
pillar:
proxymodules:
queues:
renderers:
returners:
roster:
runners:
sdb:
serializers:
states:Restart the master and see the error messages in the log files.
Oct 21 10:53:54 arcs-msalt01.arcs.gatech.edu python3[1788524]: [ERROR ] Custom Grain!
Oct 21 10:53:54 arcs-msalt01.arcs.gatech.edu python3[1788549]: [ERROR ] Custom Grain!
Oct 21 10:53:54 arcs-msalt01.arcs.gatech.edu python3[1788552]: [ERROR ] Custom Grain!
Oct 21 10:53:54 arcs-msalt01.arcs.gatech.edu python3[1788539]: [ERROR ] Custom Grain!
Oct 21 10:53:54 arcs-msalt01.arcs.gatech.edu python3[1788542]: [ERROR ] Custom Grain!
Every so often the grains get run again so the errors keep coming up. I'm guessing the master is also on a grain refresh cycle like the minion.
Type of salt install
Official rpm
Major version
3007.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)
rhel-9
salt --versions-report output
Salt Version:
Salt: 3007.8
Python Version:
Python: 3.10.18 (main, Sep 5 2025, 22:48:51) [GCC 11.2.0]
Dependency Versions:
cffi: 1.16.0
cherrypy: unknown
cryptography: 42.0.5
dateutil: 2.8.2
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.6
libgit2: Not Installed
looseversion: 1.3.0
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.7
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.5.2
PyYAML: 6.0.1
PyZMQ: 25.1.2
relenv: 0.20.6
smmap: Not Installed
timelib: 0.3.0
Tornado: 6.4.2
ZMQ: 4.3.4
Salt Package Information:
Package Type: onedir
System Versions:
dist: rhel 9.6 Plow
locale: utf-8
machine: x86_64
release: 5.14.0-570.41.1.el9_6.x86_64
system: Linux
version: Red Hat Enterprise Linux 9.6 Plow