Lost connection to database +

$ ./validate.php

Component Version
LibreNMS 21.5.1-32-g20c44b85c
DB Schema Not Connected (0)
PHP 8.0.8
Python 3.8.3
MySQL ?
RRDTool 1.7.1
SNMP NET-SNMP 5.7.3

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

Your PHP is missing required mysql extension(s), please install and enable.
Check the install docs for more info: How to install LibreNMS - LibreNMS Docs

Where do I specify the connection to the database ?
This happened after upgrading MariaDB…

:slight_smile: Jens

mysqlcheck --auto-repair --databases librenms -p
Enter password:
librenms.access_points OK
librenms.alert_device_map OK
librenms.alert_group_map OK
librenms.alert_location_map OK
librenms.alert_log OK
librenms.alert_rules OK
librenms.alert_schedulables OK
librenms.alert_schedule OK
librenms.alert_template_map OK
librenms.alert_templates OK
librenms.alert_transport_groups OK
librenms.alert_transport_map OK
librenms.alert_transports OK
librenms.alerts OK
librenms.api_tokens OK
librenms.application_metrics OK
librenms.applications OK
librenms.authlog OK
librenms.availability OK
librenms.bgpPeers OK
librenms.bgpPeers_cbgp OK
librenms.bill_data OK
librenms.bill_history OK
librenms.bill_perms OK
librenms.bill_port_counters OK
librenms.bill_ports OK
librenms.bills OK
librenms.cache OK
librenms.cache_locks OK
librenms.callback OK
librenms.cef_switching OK
librenms.ciscoASA OK
librenms.component OK
librenms.component_prefs OK
librenms.component_statuslog OK
librenms.config OK
librenms.customers OK
librenms.customoids OK
librenms.dashboards OK
librenms.dbSchema OK
librenms.device_graphs OK
librenms.device_group_device OK
librenms.device_groups OK
librenms.device_outages OK
librenms.device_perf OK
librenms.device_relationships OK
librenms.devices OK
librenms.devices_attribs OK
librenms.devices_group_perms OK
librenms.devices_perms OK
librenms.entPhysical OK
librenms.entPhysical_state OK
librenms.entityState OK
librenms.eventlog OK
librenms.graph_types OK
librenms.hrDevice OK
librenms.ipsec_tunnels OK
librenms.ipv4_addresses OK
librenms.ipv4_mac OK
librenms.ipv4_networks OK
librenms.ipv6_addresses OK
librenms.ipv6_networks OK
librenms.juniAtmVp OK
librenms.links OK
librenms.loadbalancer_rservers OK
librenms.loadbalancer_vservers OK
librenms.locations OK
librenms.mac_accounting OK
librenms.mefinfo OK
librenms.mempools OK
librenms.migrations OK
librenms.mpls_lsp_paths OK
librenms.mpls_lsps OK
librenms.mpls_saps OK
librenms.mpls_sdp_binds OK
librenms.mpls_sdps OK
librenms.mpls_services OK
librenms.mpls_tunnel_ar_hops OK
librenms.mpls_tunnel_c_hops OK
librenms.munin_plugins OK
librenms.munin_plugins_ds OK
librenms.netscaler_vservers OK
librenms.notifications OK
librenms.notifications_attribs OK
librenms.ospf_areas OK
librenms.ospf_instances OK
librenms.ospf_nbrs OK
librenms.ospf_ports OK
librenms.packages OK
librenms.pdb_ix OK
librenms.pdb_ix_peers OK
librenms.plugins OK
librenms.poller_cluster OK
librenms.poller_cluster_stats OK
librenms.poller_groups OK
librenms.pollers OK
librenms.port_group_port OK
librenms.port_groups OK
librenms.ports OK
librenms.ports_adsl OK
librenms.ports_fdb OK
librenms.ports_nac OK
librenms.ports_perms OK
librenms.ports_stack OK
librenms.ports_statistics OK
librenms.ports_stp OK
librenms.ports_vlans OK
librenms.printer_supplies OK
librenms.processes OK
librenms.processors OK
librenms.proxmox OK
librenms.proxmox_ports OK
librenms.pseudowires OK
librenms.route OK
librenms.sensors OK
librenms.sensors_to_state_indexes OK
librenms.service_templates OK
librenms.service_templates_device OK
librenms.service_templates_device_group OK
librenms.services OK
librenms.session OK
librenms.slas OK
librenms.state_indexes OK
librenms.state_translations OK
librenms.storage OK
librenms.stp OK
librenms.syslog OK
librenms.tnmsneinfo OK
librenms.transport_group_transport OK
librenms.ucd_diskio OK
librenms.users OK
librenms.users_prefs OK
librenms.users_widgets OK
librenms.vlans OK
librenms.vminfo OK
librenms.vrf_lite_cisco OK
librenms.vrfs OK
librenms.widgets OK
librenms.wireless_sensors OK

root@nms01:/opt/librenms# mysql -u librenms -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 47
Server version: 10.5.11-MariaDB-1:10.5.11+maria~buster mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]>

Fix this first.

Somehow PHP 8.0 got installed. I configured PHP 7.4 as standard and got this far:

$ ./validate.php

Component Version
LibreNMS 21.6.0-18-ge9c8a3c33
DB Schema 2021_25_01_0127_create_isis_adjacencies_table (211)
PHP 7.4.20
Python 3.8.3
MySQL 10.5.11-MariaDB-1:10.5.11+maria~buster
RRDTool 1.7.1
SNMP NET-SNMP 5.7.3

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

[OK] Composer Version: 2.1.3
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
$

Now I’m getting “502 Bad Gateway” in the browser ?

Hi JJonsson,

Would you please run
php -v

In your first ./validate.php result, I can see it shows php 8.0, while your second result shows php 7.4

Which one is your Apache (system in general) is using ?
You might wanna investigate that.

See below:

 php -v
 PHP 7.4.20 (cli) (built: Jun  4 2021 21:24:37) ( NTS )
 Copyright (c) The PHP Group
 Zend Engine v3.4.0, Copyright (c) Zend Technologies
 with Zend OPcache v7.4.20, Copyright (c), by Zend Technologies

and

./validate.php
====================================
Component | Version
--------- | -------
LibreNMS  | 21.6.0-28-gfd597dbd1
DB Schema | 2021_06_07_123600_create_sessions_table (211)
PHP       | 7.4.20
Python    | 3.6.9
MySQL     | 10.5.10-MariaDB-1:10.5.10+maria~bionic
RRDTool   | 1.7.0
SNMP      | NET-SNMP 5.7.3
====================================

[OK]    Composer Version: 2.1.3
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct
[INFO]  Detected Python Wrapper
[OK]    Connection to memcached is ok

In my case, the system wide and LNMS are using php 7.4

Best Regards

Check your webserver logs for the 502 bad gateway error.

root@nms01:~# php -v
PHP 7.4.21 (cli) (built: Jul 2 2021 15:33:15) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.21, Copyright (c), by Zend Technologies

$ ./validate.php

Component Version
LibreNMS 21.7.0-7-g5056fe541
DB Schema 2021_25_01_0127_create_isis_adjacencies_table (211)
PHP 7.4.21
Python 3.8.3
MySQL 10.5.11-MariaDB-1:10.5.11+maria~buster
RRDTool 1.7.1
SNMP NET-SNMP 5.7.3

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

[OK] Composer Version: 2.1.3
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct

Right now I’m getting “HTTP Error 500”…

Does it have something to do with PHP 8 and PHP 7.4 running at the same time ?
Or LibreNMS seems to be running twice ?

root@nms01:/opt/librenms# ps aux | grep php-fpm
root 613 0.0 0.4 229292 10096 ? Ss Jul03 0:48 php-fpm: master process (/etc/php/8.0/fpm/php-fpm.conf)
www-data 707 0.0 0.3 229576 7056 ? S Jul03 0:00 php-fpm: pool www
www-data 708 0.0 0.3 229576 7056 ? S Jul03 0:00 php-fpm: pool www
root 22299 0.0 0.4 231976 9840 ? Ss Jul03 0:50 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
librenms 22301 0.0 0.3 232412 7852 ? S Jul03 0:00 php-fpm: pool librenms
librenms 22302 0.0 0.4 232412 9952 ? S Jul03 0:00 php-fpm: pool librenms
root 28501 0.0 0.0 6208 816 pts/0 S+ 11:31 0:00 grep php-fpm

Where do I find the webserver logs ?

I’m using NGINX

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.