pcs_snmp_agent fails to start when SELinux is in Enforcing mode
Issue
- When SELinux is in Enforcing mode, the
pcs_snmp_agent
service fails to start. Examining thesystemd
journal shows a permission denied error when trying to access/var/log/pcsd/pcs_snmp_agent.log
.
# journalctl -xe
...
Mar 09 12:30:27 fastvm-rhel-8-0-23 systemd[1]: Started SNMP agent for pacemaker cluster.
-- Subject: Unit pcs_snmp_agent.service has finished start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit pcs_snmp_agent.service has finished starting up.
--
-- The start-up result is done.
Mar 09 12:30:28 fastvm-rhel-8-0-23 pcs_snmp_agent[82292]: Traceback (most recent call last):
Mar 09 12:30:28 fastvm-rhel-8-0-23 pcs_snmp_agent[82292]: File "/usr/lib/pcs/pcs_snmp_agent", line 11, in <module>
Mar 09 12:30:28 fastvm-rhel-8-0-23 pcs_snmp_agent[82292]: load_entry_point('pcs==0.10.6', 'console_scripts', 'pcs_snmp_agent')()
Mar 09 12:30:28 fastvm-rhel-8-0-23 pcs_snmp_agent[82292]: File "/usr/lib/python3.6/site-packages/pcs/snmp/pcs_snmp_agent.py", line 79, in main
Mar 09 12:30:28 fastvm-rhel-8-0-23 pcs_snmp_agent[82292]: setup_logging(is_debug())
Mar 09 12:30:28 fastvm-rhel-8-0-23 pcs_snmp_agent[82292]: File "/usr/lib/python3.6/site-packages/pcs/snmp/pcs_snmp_agent.py", line 59, in setup_logging
Mar 09 12:30:28 fastvm-rhel-8-0-23 pcs_snmp_agent[82292]: settings.LOG_FILE, encoding="utf8"
Mar 09 12:30:28 fastvm-rhel-8-0-23 pcs_snmp_agent[82292]: File "/usr/lib64/python3.6/logging/handlers.py", line 437, in __init__
Mar 09 12:30:28 fastvm-rhel-8-0-23 pcs_snmp_agent[82292]: logging.FileHandler.__init__(self, filename, mode, encoding, delay)
Mar 09 12:30:28 fastvm-rhel-8-0-23 pcs_snmp_agent[82292]: File "/usr/lib64/python3.6/logging/__init__.py", line 1032, in __init__
Mar 09 12:30:28 fastvm-rhel-8-0-23 pcs_snmp_agent[82292]: StreamHandler.__init__(self, self._open())
Mar 09 12:30:28 fastvm-rhel-8-0-23 pcs_snmp_agent[82292]: File "/usr/lib64/python3.6/logging/__init__.py", line 1061, in _open
Mar 09 12:30:28 fastvm-rhel-8-0-23 pcs_snmp_agent[82292]: return open(self.baseFilename, self.mode, encoding=self.encoding)
Mar 09 12:30:28 fastvm-rhel-8-0-23 pcs_snmp_agent[82292]: PermissionError: [Errno 13] Permission denied: '/var/log/pcsd/pcs_snmp_agent.log'
Mar 09 12:30:28 fastvm-rhel-8-0-23 systemd[1]: pcs_snmp_agent.service: Main process exited, code=exited, status=1/FAILURE
Mar 09 12:30:28 fastvm-rhel-8-0-23 systemd[1]: pcs_snmp_agent.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- The unit pcs_snmp_agent.service has entered the 'failed' state with result 'exit-code'.
Environment
- Red Hat Enterprise Linux 8 (with the High Availability Add-on)
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.