Timezone and Update issues

Issue 1-

PhpFailure
Fail: You have no timezone set for php.
Fix:
http://php.net/manual/en/datetime.configuration.php#ini.date.timezone

I tried navigating to that url and followed the recommended format but still not able to solve this issue. If there are multiple files that need to be edited, I’m not sure of their exact location.

Issue 2-

UpdatesWarning
Warning: Your install is over 24 hours out of date, last update: Mon, 24 Feb 2020 08:49:42 +0000
Fix:
Make sure your daily.sh cron is running and run ./daily.sh by hand to see if there are any errors.
Warning: Your local git contains modified files, this could prevent automatic updates.
Fix:
You can fix this with ./scripts/github-remove

Modified Files
html/js/lang/de.js
html/js/lang/en.js
html/js/lang/fr.js
html/js/lang/ru.js
html/js/lang/uk.js
html/js/lang/zh-TW.js

When I try to get to the /opt/librenms directory, I receive a permission error:
admin@librenms : / $ cd /opt/librenms
-bash: cd: /opt/librenms: Permission denied

I am not able to validate from CLI, if there is another way to show version/information, let me know and I will edit this post.

Thank you.

Hi,

Issue 1:

You probably have not uncommented the line and/or restarted webserver.
If the date.timezone line in php.ini starts with ; remove that

Issue 2:

You must be the librenms user and you are admin one.

2 Likes

Thank you. I do believe I have the line uncommented, but I think the issue is that there are other files that need to be updated. I’m going off of a past issue, but I could be mistaken.

Regarding the user, I do remember having to login as librenms, I must have missed that in my notes. In the web GUI I log in as admin, I must have just assumed that admin was the same user I’d use for SSH. I rarely have to SSH into the box, but it seems my notes need to be updated. I will see if that corrects the issue.

Thanks.

About php timezone, in ubuntu at least yes, there are several ini.

Iirc, there are in /etc/php/

You need to set in the cli and apache2 (if using apache) or fpm if using nginx

For the user, after switching to librenms, run ./github-remove -d then ./daily.sh and you should be good to go. Remember to validate again to be sure

1 Like

When I attempt to run that it tells me ‘command not found’ and I am in /opt/librenms/scripts and I do see github-remove when I run ls.

Thanks.

Yeah, sorry, I should said ./scripts/github-remove :slight_smile:

This is very confusing. What you stated ’ Yeah, sorry, I should said ./scripts/github-remove is what the suggested fix states, which I also tried and I see this:

/opt/librenms# ./scripts/github-remove

usage: github-remove [-h] (-d | -s | -r) [-v]

github-remove: error: one of the arguments -d/–discard -s/–save -r/–restore is required

Edit- I ended up running this, as you said, above, ./scripts/github-remove -d

that worked then I ran ./daily.sh and followed with a ./validate.php which listed this as fix

./opt/librenms/scripts/composer_wrapper.php install --no-dev

and I’m running through that now, which popped up with some errors (time) and other things to ‘fix’ which i am doing right now.

I have not tackled the time issues, yet, I started with the github-remove fix, first.

./validate shows this
[FAIL] Time between this server and the mysql database is off
Mysql time 2020-05-22 20:38:52
PHP time 2020-05-22 15:38:52

[OK] Database schema correct
[FAIL] You have a different system timezone (UTC) than the php configured timezone (CDT)
[FIX]:
Please correct either your system timezone or your timezone set in /etc/php/7.2/cli/php.ini.

When I open the file, /etc/php/7.2/cli/php.ini, this is what I have set

[Date]

; Defines the default timezone used by the date functions

; http://php.net/date.timezone
date.timezone = “America/Chicago”

Change system timezone to the same as PHP then restart mysql and validate again

1 Like

Where is the system timezone file located? That may be the issue I had last time.

Component Version
LibreNMS 1.63-116-g5927983c5
DB Schema 2020_04_19_010532_eventlog_sensor_reference_cleanup (164)
PHP 7.2.24-0ubuntu0.18.04.4
Python 3.6.9
MySQL 10.1.44-MariaDB-0ubuntu0.18.04.1
RRDTool 1.7.0
SNMP NET-SNMP 5.7.3

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

edit- I’ll try to google, this is what I just confirmed…

opt/librenms** # cat /etc/timezone
Etc/UTC

I think I found this guide, last time, and this is where I may have broken something…

I changed the time by running this command, rebooted, now I get this after a validate

‘sudo timedatectl set-timezone America/Chicago’

[OK] Composer Version: 1.10.6

[OK] Dependencies up-to-date.

[OK] Database connection successful

[ FAIL ] Database: incorrect column (notifications/datetime)

[ FAIL ] Database: incorrect column (users/created_at)

[ FAIL ] We have detected that your database schema may be wrong, please report the following to us on Discord (https://t.libren.ms/discord) or the community site (https://t.libren.ms/5gscd):

[ FIX ]:

Run the following SQL statements to fix.

SQL Statements:

ALTER TABLE notifications CHANGE datetime datetime timestamp NOT NULL DEFAULT ‘1970-01-02 00:00:00’ ;

ALTER TABLE users CHANGE created_at created_at timestamp NOT NULL DEFAULT ‘1970-01-02 00:00:01’ ;

edit- The CLI validate command doesn’t show the timezone error, but the web GUI validation does show this error, after all that, I still have a timezone issue.

Fail: You have no timezone set for php.

Fix: http://php.net/manual/en/datetime.configuration.php#ini.date.timezone

If cli validate doesnt show the error but the gui one does, that means you have another ini file to edit.

Also, entre mysql manually and run those statements.

1 Like

This is the issue I keep running into, I’m not sure with additional ini files need to be updated. I don’t know their location.

I will attempt the mysql commands now.

Thanks.

I logged into the db and I tried to run the first command and I see this:

MariaDB [(none)]> ALTER TABLE notifications CHANGE datetime datetime timestamp NOT NULL DEFAULT ‘1970-01-02 00:00:00’ ;

ERROR 1046 (3D000): No database selected

MariaDB [(none)]>

use librenms; first (to select librenms database)

1 Like

I do appreciate the assistance, I am not a heavy linux user.

MariaDB [(none)]> librenms;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘librenms’ at line 1

MariaDB [(none)]>

Hahaha, I encapsulated it for a reason :joy:
Its literally use librenms;

1 Like

I see it now, I may need to adjust the color setting on my monitor, the background is very, very light on this screen. However, I also see that the font is changed. That is my mistake. Trying the commands, now.

Ok, I entered the two commands and re-ran validate from the web GUI. I’m still seeing the timezone error which was expected since I have not edited the ini files (not sure which ones I need to edit). Here is the output from the GUI:

DatabaseFailure

Fail: Time between this server and the mysql database is off Mysql time 2020-05-26 10:51:58 PHP time 2020-05-26 15:51:58

Ok: Database schema correct

PhpFailure

Fail: You have no timezone set for php.

Fix: http://php.net/manual/en/datetime.configuration.php#ini.date.timezone

Here is the output from CLI:

root@librenms1** : /opt/librenms # ./validate.php

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

Component | Version

--------- | -------

LibreNMS | 1.63-145-ged5bc6c87

DB Schema | 2020_04_06_001048_the_great_index_rename (165)

PHP | 7.2.24-0ubuntu0.18.04.4

Python | 3.6.9

MySQL | 10.1.44-MariaDB-0ubuntu0.18.04.1

RRDTool | 1.7.0

SNMP | NET-SNMP 5.7.3

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

[OK] Composer Version: 1.10.6

[OK] Dependencies up-to-date.

[OK] Database connection successful

[OK] Database schema correct

root@librenms1** : /opt/librenms #