Bug 1282197 - Nagios service fails to start on Fedora 23
Nagios service fails to start on Fedora 23
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: nagios (Show other bugs)
24
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Keiran Smith
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-15 07:21 EST by Tibbs Brookside
Modified: 2017-08-08 08:24 EDT (History)
19 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-08 08:24:30 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Working version of SRPM of nagios 4.1.1 for Fedora 23 (10.67 MB, application/x-rpm)
2016-03-07 18:44 EST, Edgar Hoch
no flags Details

  None (edit)
Description Tibbs Brookside 2015-11-15 07:21:55 EST
Description of problem:

Nagios service fails to start on Fedora 23:

Version-Release number of selected component (if applicable):

nagios-3.5.1-9.fc23.x86_64

How reproducible:

Always

Steps to Reproduce:

systemctl start nagios

Actual results:

systemctl -l status nagios
● nagios.service - SYSV: Starts and stops the Nagios monitor
   Loaded: loaded (/etc/rc.d/init.d/nagios)
   Active: active (exited) since Sun 2015-11-15 12:05:25 GMT; 6min ago
     Docs: man:systemd-sysv-generator(8)

Nov 15 12:05:25 server nagios[31134]: Starting nagios:touch: cannot touch ‘/var/run/nagios/nagios.pid’: No such file or directory
Nov 15 12:05:25 server nagios[31134]: chown: cannot access ‘/var/run/nagios/nagios.pid’: No such file or directory
Nov 15 12:05:25 server nagios[31134]: /sbin/restorecon:  lstat(/var/run/nagios/nagios.pid) failed:  No such file or directory
Nov 15 12:05:25 server nagios[31172]: Nagios 3.5.1 starting... (PID=31172)
Nov 15 12:05:25 server nagios[31172]: Local time is Sun Nov 15 12:05:25 GMT 2015
Nov 15 12:05:25 server nagios[31172]: LOG VERSION: 2.0
Nov 15 12:05:25 server nagios[31172]: Failed to obtain lock on file /var/run/nagios/nagios.pid: No such file or directory
Nov 15 12:05:25 server nagios[31172]: Bailing out due to errors encountered while attempting to daemonize... (PID=31172)
Nov 15 12:05:25 server nagios[31134]: done.

Expected results:

Nagios service should start.

Additional info:

I believe this is being cause by the fact that the:
/usr/lib/tmpfiles.d/nagios.conf
file is missing from the package which means the:
/var/run/nagios
directory isn't being created.

I copied the file from the Fedora 22 package and ran:
systemd-tmpfiles --create
and now the Nagios service starts OK.
Comment 1 Lenz Grimmer 2015-12-17 08:14:43 EST
This seems to be fixed at least in EPEL7:

[root@centos7 ~]# rpm -qf /usr/lib/tmpfiles.d/nagios.conf
nagios-4.0.8-1.el7.x86_64
[root@centos7 ~]# cat /usr/lib/tmpfiles.d/nagios.conf
D /var/run/nagios 0755 nagios nagios -
Comment 2 Tibbs Brookside 2015-12-25 11:23:55 EST
Fixed in Fedora 23 updates-testing:

rpm -qf /usr/lib/tmpfiles.d/nagios.conf
nagios-4.0.8-1.fc23.x86_64

cat /usr/lib/tmpfiles.d/nagios.conf
D /var/run/nagios 0755 nagios nagios -
Comment 3 Edgar Hoch 2016-02-22 18:25:16 EST
But nagios-4.0.8-1.fc23.x86_64 has other problems:

After "systemctl start nagios.service", the service entered failed state.

File /var/log/nagios/nagios.log shows the reason:

[1456181994] Nagios 4.0.8 starting... (PID=13477)
[1456181994] Local time is Mon Feb 22 23:59:54 CET 2016
[1456181994] LOG VERSION: 2.0
[1456181994] qh: Failed to init socket '/var/log/nagios/rw/nagios.qh'. bind() failed: No such file or directory
[1456181994] Error: Failed to initialize query handler. Aborting


So, both nagios-3.5.1-9.fc23.x86_64 and nagios-4.0.8-1.fc23.x86_64 are unusable without manual corrections by the system administrator.

Please, would it be possible to provide a working nagios package for Fedora 23?

Also, nagios 4.1.1 is the latest stable release (since 2015-08-19), so it may be worth to try to build the latest version.
Comment 4 Edgar Hoch 2016-02-22 19:30:12 EST
This files of nagios-4.0.8-1.fc23.x86_64 contains the nonexistent directory /var/log/nagios/rw/ :

[root@localhost ~]# LANG=C grep /rw $( rpm -ql nagios ) 2>/dev/null
/etc/nagios/nagios.cfg:#query_socket=/var/log/nagios/rw/nagios.qh
Binary file /usr/lib64/nagios/cgi-bin/archivejson.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/avail.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/cmd.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/config.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/extinfo.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/histogram.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/history.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/notifications.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/objectjson.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/outages.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/showlog.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/status.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/statusjson.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/statusmap.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/statuswml.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/statuswrl.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/summary.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/tac.cgi matches
Binary file /usr/lib64/nagios/cgi-bin/trends.cgi matches
Binary file /usr/sbin/nagios matches

[root@localhost ~]# strings - /usr/sbin/nagios|grep /rw
/var/log/nagios/rw/nagios.qh

[root@localhost ~]# strings - /usr/lib64/nagios/cgi-bin/*|grep /rw
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd
/var/log/nagios/rw/nagios.cmd


I have tried to create directory /var/log/nagios/rw , owner nagios, group nagios.

But this isn't enough. SELinux doesn't allow process with selinux context nagios_t to create a socket file in this directory when it has selinux type nagios_log_t:

type=AVC msg=audit(1456183775.625:31268): avc:  denied  { create } for  pid=14026 comm="nagios" name="nagios.qh" scontext=system_u:system_r:nagios_t:s0 tcontext=system_u:object_r:nagios_log_t:s0 tclass=sock_file permissive=0

I changed selinux file context of /var/log/nagios/rw to nagios_spool_t using "chcon -t nagios_spool_t /var/log/nagios/rw". Then nagios can create the socket file.

But there is still another selinux access problem:

type=AVC msg=audit(1456184980.908:31314): avc:  denied  { connectto } for  pid=14499 comm="nagios" path="/var/log/nagios/rw/nagios.qh" scontext=system_u:system_r:nagios_t:s0 tcontext=system_u:system_r:nagios_t:s0 tclass=unix_stream_socket permissive=0


audit2allow tells me that what may be wrong:

[root@localhost ~]# grep nagios /var/log/audit/audit.log|tail -1 |grep connectto|audit2allow 

#============= nagios_t ==============

#!!!! The file '/var/log/nagios/rw/nagios.qh' is mislabeled on your system.  
#!!!! Fix with $ restorecon -R -v /var/log/nagios/rw/nagios.qh
#!!!! This avc can be allowed using the boolean 'daemons_enable_cluster_mode'
allow nagios_t self:unix_stream_socket connectto;


The first comment is a result of chcon command as described above.
The suggestion in the second comment would undo the chcon command, so this doesn't solve the problem.
I don't think that nagios has something to do with cluster mode, so the suggestion of the third comment should not be applied.

Either file contexts of /var/log/nagios/rw need to be defined in the right way, or nagios should create and use another directories and files with appropriate rights.


I got a working installation with

# systemctl restart nagios
# systemctl status nagios
# grep nagios /var/log/audit/audit.log|tail -1 |grep connectto|audit2allow -M nagios-patch4
# semodule -i nagios-patch4.pp
# semanage fcontext -a -t nagios_spool_t '/var/log/nagios/rw(/.*)?'
# install -d -o nagios -g nagios -m 0750 /var/log/nagios/rw
# systemctl restart nagios
# systemctl status nagios
Comment 5 Edgar Hoch 2016-03-07 18:44 EST
Created attachment 1133952 [details]
Working version of SRPM of nagios 4.1.1 for Fedora 23

I have created and tested a rpm of nagios 4.1.1 for and on Fedora 23.

I provide the source rpm of this package. I have used changes that was used for epel7 (see bug 1291734).

It would be nice if the maintainers would build and submit packages of nagios 4.1.1 for all current Fedora version (22,23,24,rawhide). Please try the spec and patches which are contained in the source rpm file. I think the only changes needed are the version number and package comment.

Please also update nagios-plugins to 2.1.1, it builds with the spec of the previous version without problems.
Comment 6 Edgar Hoch 2016-03-07 18:46:57 EST
Please note that the SRPM contains solves bug 1295155 .
Comment 7 Alessandro Selli 2016-07-14 09:08:31 EDT
As of today, bug affects Fedora24, package nagios-4.0.8-2.fc24.x86_64.
Comment 8 Fedora End Of Life 2016-11-24 08:26:31 EST
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 9 Fedora End Of Life 2016-12-20 10:55:08 EST
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.
Comment 10 Vaclav Danek 2017-01-26 06:55:41 EST
Package: nagios-4.0.8-2.fc24.x86_64
 
Reopening for Fedora 24. Bug with selinux blocking /var/log/nagios/rw is still present.

[root@mother nagios]# cat nagios.log | grep nagios.qh
[1485430514] qh: Failed to init socket '/var/log/nagios/rw/nagios.qh'. bind() failed: No such file or directory
[1485430572] qh: Failed to init socket '/var/log/nagios/rw/nagios.qh'. bind() failed: Permission denied

[root@mother nagios]# cat /var/log/audit/audit.log | grep nagios.qh
type=AVC msg=audit(1485430572.168:319): avc:  denied  { create } for  pid=1499 comm="nagios" name="nagios.qh" scontext=system_u:system_r:nagios_t:s0 tcontext=system_u:object_r:nagios_log_t:s0 tclass=sock_file permissive=0
type=AVC msg=audit(1485430721.766:417): avc:  denied  { create } for  pid=1755 comm="nagios" name="nagios.qh" scontext=system_u:system_r:nagios_t:s0 tcontext=system_u:object_r:nagios_log_t:s0 tclass=sock_file permissive=0
type=AVC msg=audit(1485430763.844:457): avc:  denied  { create } for  pid=1801 comm="nagios" name="nagios.qh" scontext=system_u:system_r:nagios_t:s0 tcontext=system_u:object_r:nagios_log_t:s0 tclass=sock_file permissive=1
type=AVC msg=audit(1485430763.846:458): avc:  denied  { write } for  pid=1805 comm="nagios" name="nagios.qh" dev="vda1" ino=268793 scontext=system_u:system_r:nagios_t:s0 tcontext=system_u:object_r:nagios_log_t:s0 tclass=sock_file permissive=1
type=AVC msg=audit(1485430763.846:459): avc:  denied  { connectto } for  pid=1805 comm="nagios" path="/var/log/nagios/rw/nagios.qh" scontext=system_u:system_r:nagios_t:s0 tcontext=system_u:system_r:nagios_t:s0 tclass=unix_stream_socket permissive=1
type=AVC msg=audit(1485430884.423:544): avc:  denied  { unlink } for  pid=1801 comm="nagios" name="nagios.qh" dev="vda1" ino=268793 scontext=system_u:system_r:nagios_t:s0 tcontext=system_u:object_r:nagios_log_t:s0 tclass=sock_file permissive=0
type=AVC msg=audit(1485430884.497:547): avc:  denied  { unlink } for  pid=2203 comm="nagios" name="nagios.qh" dev="vda1" ino=268793 scontext=system_u:system_r:nagios_t:s0 tcontext=system_u:object_r:nagios_log_t:s0 tclass=sock_file permissive=0
type=AVC msg=audit(1485430957.919:607): avc:  denied  { unlink } for  pid=2255 comm="nagios" name="nagios.qh" dev="vda1" ino=268793 scontext=system_u:system_r:nagios_t:s0 tcontext=system_u:object_r:nagios_log_t:s0 tclass=sock_file permissive=0
Comment 11 Fedora End Of Life 2017-07-25 15:29:58 EDT
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Comment 12 Stephen John Smoogen 2017-08-02 17:34:30 EDT
Current version of nagios should work in updates.
Comment 13 Stephen John Smoogen 2017-08-02 17:36:30 EDT
The file has been moved from /var/log/nagios to /var/spool/nagios in the current package set.
Comment 14 Fedora End Of Life 2017-08-08 08:24:30 EDT
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.