Recovering from PHP update


#1

Not sure how I got here, but I have a mysql error that I have been working on and am stuck.
I did try to change the database password.

[[email protected] ~]$ ./validate.php

Component Version
LibreNMS 1.48.1-29-gbc93d8c
DB Schema Not Connected (0)
PHP 7.2.14
MySQL ?
RRDTool 1.4.8
SNMP NET-SNMP 5.7.2

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

[OK] Composer Version: 1.8.3
[OK] Dependencies up-to-date.
Could not connect to database, check logs/librenms.log.

$ tail -n10 logs/librenms.log
#0 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(65): Doctrine\DBAL\Driver\PDOConnection->__construct(‘mysql:host=127…’, ‘librenms’, ‘OLD-Password’, Array)
#1 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(44): Illuminate\Database\Connectors\Connector->createPdoConnection(‘mysql:host=127…’, ‘librenms’, ‘OLD-Password’, Array)
#2 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection(‘mysql:host=127…’, Array, Array)
#3 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(183): Illuminate\Database\Connectors\MySqlConnector->connect(Array)
#4 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors{closure}()
#5 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(883): call_user_func(Object(Closure))
#6 /opt/librenms/LibreNMS/DB/Eloquent.php(110): Illuminate\Database\Connection->getPdo()
#7 /opt/librenms/includes/init.php(102): LibreNMS\DB\Eloquent::isConnected()
#8 /opt/librenms/alerts.php(31): require(’/opt/librenms/i…’)


#2

Did you edit your credentials in both .env and config.php ?
https://docs.librenms.org/Support/FAQ/#where-do-i-update-my-database-credentials

and you can connect fine using them on mysql command line


#3

I don’t have a .env file…Do I just create one? Is it in /opt/librenms ?


#4

Sounds similar to this File .env not generated

you could try run ./scripts/composer_wrapper.php install --no-dev as librenms user


#5

OK looking better
I was able to get the mysql table issues resolved

Currently ./validate .php works but ./daily fails

[[email protected] ~]$ ./daily.sh
Could not connect to database, check logs/librenms.log.
Updating SQL-Schema OK
Cleaning up DB OK
Could not connect to database, check logs/librenms.log.

it looks like one of the processes it is using an old password

/opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(65):
Doctrine\DBAL\Driver\PDOConnection->__construct(‘mysql:host=127…’, ‘librenms’, ‘OLD-password’, Array)
are the passwords from config.php or .env cached?


#6

in /opt/librenms you could try:

php artisan config:clear
php artisan cache:clear

how did you generate your .env file in the end?


#7

I found one issue, I had modified the config.php file and modified the $config[‘db_host’] = ‘127.0.0.1’; with the host name of the box. I put the loopback adress back.

Its better, but I am getting the 502 Bad Gateway nginx/1.12.2 error on the web page.


#8

Check for errrors in logs/librenms.log then.