Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1666209
Summary: | Nagios cannot start after system reboot because of missing directory | ||
---|---|---|---|
Product: | [Fedora] Fedora EPEL | Reporter: | Stefan Joosten <stefan+redhatbugs> |
Component: | nagios | Assignee: | Guido Aulisi <guido.aulisi> |
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | epel7 | CC: | affix, athmanem, b.heden, herrold, jose.p.oliveira.oss, lemenkov, linux, mike, shawn.starr, smooge, smooge, s, swilkerson |
Target Milestone: | --- | Keywords: | Reopened |
Target Release: | --- | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | nagios-4.4.3-1.fc28 nagios-4.4.3-1.fc29 nagios-4.4.3-1.el6 nagios-4.4.3-1.el7 nagios-4.4.6-4.el8 nagios-4.4.6-4.el7 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2021-03-22 00:31:13 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Stefan Joosten
2019-01-15 08:28:49 UTC
Two ways of fixing I came up with are: A. Change nagios.cfg to go directly to /var/run by taking out the `nagios` subdirectory of the `lock_file` option B. Have the systemd.service create the `nagios` runtime directory. This might be easier if this problem does not occur on EL6 for example (perhaps it's init script already takes care of this, I haven't checked). Solution A, changing nagios.cfg: --- nagios.cfg 2019-01-15 10:14:06.346940829 +0100 +++ nagios.cfg.fix_lock_path 2019-01-15 10:14:16.884977509 +0100 @@ -166,7 +166,7 @@ # This is the lockfile that Nagios will use to store its PID number # in when it is running in daemon mode. -lock_file=/var/run/nagios/nagios.pid +lock_file=/var/run/nagios.pid Solution B, changing the systemd unit file: --- nagios.service 2019-01-15 10:30:12.572302032 +0100 +++ nagios.service.fix_lock_path 2019-01-15 10:39:19.450194861 +0100 @@ -7,6 +7,8 @@ Type=forking User=nagios Group=nagios +RuntimeDirectory=nagios +RuntimeDirectoryMode=0750 PIDFile=/var/run/nagios/nagios.pid # Mimic older config file wants EnvironmentFile=-/etc/sysconfig/nagios This creates the /run/nagios directory with the user and group permissions set, mode gets set to 0750 as it's created by the RPM. However this does cause a new issue (!) upon removal of the package. Directory /run/nagios is now removed by systemd upon a stop of the service. Causing a `yum remove nagios` to spit out a warning: Erasing : nagios-4.4.2-3.el7.x86_64 warning: file /var/run/nagios: remove failed: No such file or directory Of course pick which you prefer, either seem to work for me, or perhaps you'll think of another solution. I just hope this helps :) Uh.. I think I just assumed solution A (editing the path of the lock_file) would work... But I tested it and of course it does not work because user nagios has no permission to write to /run : nagios[6017]: Failed to obtain lock on file /var/run/nagios.pid: Permission denied So disregard solution A. nagios-4.4.3-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-d661b588d2 nagios-4.4.3-1.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-17b388679b nagios-4.4.3-1.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-376ecc221c nagios-4.4.3-1.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2019-0b44528ff1 nagios-4.4.3-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-d661b588d2 nagios-4.4.3-1.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-17b388679b nagios-4.4.3-1.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-0b44528ff1 nagios-4.4.3-1.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-376ecc221c nagios-4.4.3-1.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report. nagios-4.4.3-1.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report. nagios-4.4.3-1.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report. nagios-4.4.3-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report. Thanks for working on this. Unfortunately the problem still persists for me. I'm on CentOS 7 using nagios-4.4.3-1.el7 from EPEL. I extracted the RPM and had a look at file usr/lib/systemd/system/nagios.service It does not seem to include my little patch of adding the two lines "RuntimeDirectory" and "RuntimeDirectoryMode". I can still reproduce the error as originally reported. After a reboot Nagios fails to start on CentOS 7 for me unless I manually create the directory to place it's lock/PID file. This is my current patch to usr/lib/systemd/system/nagios.service : --- nagios.service 2019-03-22 15:38:48.066376767 +0100 +++ nagios.service.lock_file.patch 2019-03-22 15:38:37.921396470 +0100 @@ -10,6 +10,8 @@ ExecStop=/usr/bin/kill -s TERM ${MAINPID} ExecStopPost=/usr/bin/rm -f /var/spool/nagios/cmd/nagios.cmd ExecReload=/usr/bin/kill -s HUP ${MAINPID} +RuntimeDirectory=nagios +RuntimeDirectoryMode=0750 [Install] WantedBy=multi-user.target After these are added the nagios service works as intended for me. I changed the bug's status, hope that's OK. In Centos 7 +RuntimeDirectory=nagios +RuntimeDirectoryMode=0750 didnt work I used this workaround which will survive package updates mkdir -p /etc/systemd/system/nagios.service.d cat > /etc/systemd/system/nagios.service.d/overides.conf << "EOF" [Service] ExecStartPre=/usr/bin/mkdir -p /var/run/nagios ExecStartPre=/usr/bin/chown nagios /var/run/nagios EOF systemctl daemon-reload systemctl restart nagios BE nice if this was fixed in the service file though BTW I didn't put the plus in (copied from commit) This package has changed maintainer in the Fedora. Reassigning to the new maintainer of this component. This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component. FEDORA-EPEL-2021-e9c2beec98 has been submitted as an update to Fedora EPEL 8. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2021-e9c2beec98 FEDORA-EPEL-2021-04cc5bcb08 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2021-04cc5bcb08 FEDORA-EPEL-2021-04cc5bcb08 has been pushed to the Fedora EPEL 7 testing repository. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2021-04cc5bcb08 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-EPEL-2021-e9c2beec98 has been pushed to the Fedora EPEL 8 testing repository. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2021-e9c2beec98 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-EPEL-2021-e9c2beec98 has been pushed to the Fedora EPEL 8 stable repository. If problem still persists, please make note of it in this bug report. FEDORA-EPEL-2021-04cc5bcb08 has been pushed to the Fedora EPEL 7 stable repository. If problem still persists, please make note of it in this bug report. |