Post-install ./validate.php showing PHP timezone and Cron failures

Greetings!

I’ve just discovered LibreNMS and we’ve decided to deploy it, however I’ve run in to a few problems with the validate.php final step.

Environment:
I’ve started with a fresh install of Ubuntu 16.04 to a VM, and followed the install documentation here: http://docs.librenms.org/Installation/Installation-Ubuntu-1604-Apache/

root@LIT-UP-NMS-01:/opt/librenms# uname -a
Linux LIT-UP-NMS-01 4.4.0-67-generic #88-Ubuntu SMP Wed Mar 8 16:34:45 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

root@LIT-UP-NMS-01:/etc# cat os-release 
NAME="Ubuntu"
VERSION="16.04.2 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.2 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

Validate.php Output:

root@LIT-UP-NMS-01:/opt/librenms# ./validate.php 
==========================================================
Component | Version
--------- | -------
LibreNMS  | 73a9092c82ed042f080babace6adbdec268e3a32
DB Schema | 177
PHP       | 7.0.15-0ubuntu0.16.04.4
MySQL     | 10.0.29-MariaDB-0ubuntu0.16.04.1
RRDTool   | 1.5.5
SNMP      | NET-SNMP 5.7.3
==========================================================

[OK]    Database connection successful
[FAIL]  You have no timezone set for php. [FIX] http://php.net/manual/en/datetime.configuration.php#ini.date.timezone
[FAIL]  Discovery has never run, check the cron job
[FAIL]  The poller has never run, check the cron job

I’ve ensured that my two php.ini files have the correct timezone as required by the documentation:

/etc/php/7.0/apache2/php.ini Date config:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone = "America/Chicago"

/etc/php/7.0/cli/php.ini Date config:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone = "America/Chicago"

I’ve even gone as far as to create a test.php file with an echo of the timezone, as seen here with it’s output:

root@LIT-UP-NMS-01:/opt/librenms# cat test.php
#!/usr/bin/env php
<?php
echo date_default_timezone_get();
?> 
root@LIT-UP-NMS-01:/opt/librenms# ./test.php 
America/Chicago 

Is this a bug in the current validate.php file?

As for the cron failures, I feel like either steps are missing from the cron installation (I don’t recall simply copying a file to activate cron jobs), or I have failed to prepare the Ubuntu installation completely for LibreNMS.

Any help would be appreciated - thank you in advance!

1 Like

You need to remove the semi-colin ; in front of your timezone line

I’m looking at the updating the documentation as soon as I figure out the missing cron step :slight_smile:

I believe you may just need:

systemctl restart crond

I feel like an idiot! My experience has mostly just been scripting in tcsh, so the all mighty # comments out lines in my world. Thanks for letting me know - it definitely fixed the issue.

As for the cron errors - I don’t have crond, it seems:

root@LIT-UP-NMS-01:/opt/librenms# systemctl restart crond
Failed to restart crond.service: Unit crond.service not found.

However, when I check services I do see a cron entry, and it is started:

root@LIT-UP-NMS-01:/opt/librenms# service --status-all | grep -i cron
 [ + ]  cron

Any ideas?

Not sure I’m pretty clueless when it comes to Centos7 and cron

I am using RHEL7 (which is what CENTOS7 is based off of). For me I just needed to copy /opt/librenms/librenms.nonroot.cron to /etc/cron.d/ – I am pretty sure no restart of cron was required.

I suppose it must have just taken a while. Things appear to be normal now:

root@LIT-UP-NMS-01:/opt/librenms# ./validate.php 
==========================================================
Component | Version
--------- | -------
LibreNMS  | 559a22157f7197576c52542665486585344d78b5
DB Schema | 177
PHP       | 7.0.15-0ubuntu0.16.04.4
MySQL     | 10.0.29-MariaDB-0ubuntu0.16.04.1
RRDTool   | 1.5.5
SNMP      | NET-SNMP 5.7.3
==========================================================

[OK]    Database connection successful

Thanks all for the assistance!

I still havent managed to get this fixed despite following all instructions here, any further hints/advice?

$ ./validate.php

Component Version
LibreNMS 1.48.1-50-g0b802d6
DB Schema 2019_01_16_195644_add_vrf_id_and_bgpLocalAs (131)
PHP 7.2.15-1+ubuntu16.04.1+deb.sury.org+1
MySQL 10.0.36-MariaDB-0ubuntu0.16.04.1
RRDTool 1.5.5
SNMP NET-SNMP 5.7.3

====================================

[OK] Composer Version: 1.8.4
[OK] Dependencies up-to-date.
[OK] Database connection successful
[FAIL] Time between this server and the mysql database is off
Mysql time 2019-02-14 12:30:36
PHP time 2019-02-14 10:30:36

[OK] Database schema correct
[FAIL] You have no timezone set for php.
[FIX]:
http://php.net/manual/en/datetime.configuration.php#ini.date.timezone

/etc/php/7.2/apache2/php.ini

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = “Africa/Lusaka”

:~# cat /etc/timezone
Africa/Lusaka

Please don’t post on old threads. You have to php.ini files, you only updated the apache php.ini, not the cli php.ini.