Two Issues after fresh install

Hey guys,

I just did a fresh install using the instructions here:
https://docs.librenms.org/Installation/Installation-CentOS-7-Nginx/

The only error I have in /validation is regarding the Discovery error. I have tried updating librenms and rebooting however that has not fixed anything although I seem to have to fix the user permissions every time I run the updater. Not sure if thats normal.

Issue# 1

When I go to create a new device group.

I get “Whoops, looks like something went wrong. Check your librenms.log.” This happens in chrome and IE.

Issue #2 Fail: Discovery has never run. Check the cron job

Here are the errors I am getting in my librenms.log

https://p.libren.ms/view/3cffb2a4

Discovery pastebin:
https://p.libren.ms/view/4303a756

Poller pastebin:
https://p.libren.ms/view/5cd2d897

Thanks!

Do you actually have devices in the system that can be discovered via snmp?

Elias, Yeah it seems to be successfully monitoring a couple devices.

In this order:

Please let us know which one worked as trying to isolate the issue.

Ahhh yes Issue #2 seems to have resolved itself after I added actual devices for librenms to monitor. That makes sense!

the librenms user was not in the nginx user group. I added it but it didnt fix the issue.

I ran * chmod g+w /opt/librenms/cache and that didnt work

I tried the commands in this link

but the commands dont work. I tried supplementing nginx for www-data and got “chown: cannot access ‘devices_relationships.cache’: No such file or directory”

ahh that file lives in /opt/librenms/cache/devices_relationships.cache

Do you see it in there?

if the file doesnt exist, look at the error in the librenms.log in /opt/librenms/logs

Chas, The file does not exist in /opt/librenms/cache/

Here is the error from librenms.log

[2019-07-17 11:54:02] production.ERROR: file_put_contents(/opt/librenms/cache/devices_relationships.cache): failed to open stream: Permission denied {“userId”:1,“exception”:"[object] (ErrorException(code: 0): fi$
[stacktrace]
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, ‘file_put_conten…’, ‘/opt/librenms/L…’, 173, Array)
production.ERROR: file_put_contents(/opt/librenms/cache/devices_relationships.cache): failed to open stream: Permission denied {“userId”:1,“exception”:"[object] (ErrorException(code: 0): fi$
[stacktrace]
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, ‘file_put_conten…’, ‘/opt/librenms/L…’, 173, Array)

next steps in this order.

  • chmod +x /opt/librenms/cache
  • work now?
  • touch /opt/librenms/cache/devices_relationships.cache
  • chown www-data:www-data /opt/librenms/cache/devices_relationships.cache (or substitute to your webserver user)
  • work now?

Ok so I completed the steps you gave above and rebooted.

[root@librenms cache]# ls -l
total 240
-rw-r–r--. 1 nginx nginx 0 Jul 17 12:58 devices_relationships.cache
-rw-r–r--. 1 librenms librenms 242192 Jul 17 09:58 os_defs.cache

Still getting the same error in librenms.log.

[2019-07-17 13:05:48] production.ERROR: file_put_contents(/opt/librenms/cache/devices_relationships.cache): failed to open stream: Permission denied {“userId”:1,“exception”:"[object] (ErrorException(code: 0): fi$
[stacktrace]
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, ‘file_put_conten…’, ‘/opt/librenms/L…’, 173, Array)

Just noticed in the nginx documentation you followed the php group is apache in /etc/php-fpm.d/www.conf https://docs.librenms.org/Installation/Installation-CentOS-7-Nginx/

Not sure i understand why that would be, i would test by changing the group to nginx , restart php-fpm and try again.

Possibly also chgrp nginx /var/lib/php/session/

Permissions is messed up somewhere, find the user/group php is running under and make sure thats applied to the above file.

I just created a new vm and followed the centos apache instructions and have ended up with the same exact issue with the same errors in librenms.log. Tomorrow I will try the ubuntu instructions to see what I get.

1 Like

Hmm ! checked it with SELinux off just incase?, will be interesting if Ubuntu is successful

I had the same issue with my install, after a few days the issue went away, I was able to create groups no problem. I dont know the cause. I did fix the daily.sh , I did not have that in cron. ( reminder , run that command as the Libernms user account. jb

Interesting! I just tried again with the ubuntu and nginx instructions and still have the same result.

Thanks for the SELinux suggestion.

grep os_defs.cache /var/log/audit/audit.log | audit2why

type=AVC msg=audit(1610047568.195:26389): avc: denied { write } for pid=3603 comm=“php” name=“os_defs.cache” dev=“dm-0” ino=1781197 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:usr_t:s0 tclass=file permissive=0

    Was caused by:
            Missing type enforcement (TE) allow rule.

            You can use audit2allow to generate a loadable module to allow this access.

Now I just have to figure out how to use audit2allow.