Could not connect to database, check logs/librenms.log. | Whoops, looks like something went wrong. Check your librenms.log

Hi, anyone can help me, after installing librenms, i found this in the first time access from browser,

and this is my check ./validate.php

sudo /opt/librenms/./validate.php

Component Version
LibreNMS 1.68-63-g59accd7e4
DB Schema Not Connected (0)
PHP 7.4.11
Python 3.6.9
MySQL ?
RRDTool 1.7.0
SNMP NET-SNMP 5.7.3
====================================

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

some last log

[2020-10-21 15:49:14] production.ERROR: No application encryption key has been specified. {“exception”:"[object] (RuntimeException(code: 0): No application encryption key has been specified. at /opt/librenms/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:80)
[stacktrace]
#0 /opt/librenms/vendor/laravel/framework/src/Illuminate/Support/helpers.php(433): Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}(false)
#1 /opt/librenms/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(84): tap(false, Object(Closure))
#2 /opt/librenms/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(61): Illuminate\Encryption\EncryptionServiceProvider->key(Array)
#3 /opt/librenms/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(33): Illuminate\Encryption\EncryptionServiceProvider->parseKey(Array)
#4 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(805): Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}(Object(App\Application), Array)
#5 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(691): Illuminate\Container\Container->build(Object(Closure))
#6 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(796): Illuminate\Container\Container->resolve(‘encrypter’, Array, true)
#7 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(637): Illuminate\Foundation\Application->resolve(‘encrypter’, Array)
#8 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(781): Illuminate\Container\Container->make(‘encrypter’, Array)
#9 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(959): Illuminate\Foundation\Application->make(‘encrypter’)
#10 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(879): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter))
#11 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(840): Illuminate\Container\Container->resolveDependencies(Array)
#12 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(691): Illuminate\Container\Container->build(‘App\\Http\\Middle…’)
#13 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(796): Illuminate\Container\Container->resolve(‘App\\Http\\Middle…’, Array, true)
#14 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(637): Illuminate\Foundation\Application->resolve(‘App\\Http\\Middle…’, Array)
#15 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(781): Illuminate\Container\Container->make(‘App\\Http\\Middle…’, Array)
#16 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(204): Illuminate\Foundation\Application->make(‘App\\Http\\Middle…’)
#17 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(178): Illuminate\Foundation\Http\Kernel->terminateMiddleware(Object(Illuminate\Http\Request), Object(Illuminate\Http\Response))
#18 /opt/librenms/html/index.php(57): Illuminate\Foundation\Http\Kernel->terminate(Object(Illuminate\Http\Request), Object(Illuminate\Http\Response))
#19 {main}
"}

so what can i do to troubleshot this,

Thanks
Djun

try this to fix app key error Install LibreNMS Debian 9.8.1

looks like it can’t connect to your DB either , so double check config.php and .env file

Look Like this after I made adjustments to .ENV file

./validate.php

Component Version
LibreNMS 1.68-63-g59accd7e4
DB Schema No Schema (0)
PHP 7.4.11
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.15
[OK] Dependencies up-to-date.

In Connection.php line 671:

SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘librenms.devices’ doesn’t exist (SQL: select exists(select *
from devices) as exists)

In PDOConnection.php line 72:

SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘librenms.devices’ doesn’t exist

In PDOConnection.php line 67:

SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘librenms.devices’ doesn’t exist

And from my browser , look like this,

is this prompted to upgrade the php version?

Thanks,

Yes you’ll need to upgrade your PHP version, maybe check whats installed first as you seem to have 7.4 php-cli , so you will want to delete old packages first Php version upgrade

So probably just apache/nginx packages that needs correcting Http 500 after upgrade

yes, thanks @Chas , solved ,

but I have new one problems

sudo /opt/librenms/validate.php

Component Version
LibreNMS 1.68-63-g59accd7e4
DB Schema 2020_10_03_1000_add_primary_key_transport_group_transport (186)
PHP 7.4.11
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.15
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[FAIL] /usr/bin/fping could not be executed. /usr/bin/fping must have CAP_NET_RAW capability (getcap) or suid. Selinux exclusions may be required.
()
[FAIL] /usr/bin/fping6 could not be executed. /usr/bin/fping6 must have CAP_NET_RAW capability (getcap) or suid. Selinux exclusions may be required.
()
[FAIL] /usr/bin/fping6 should have CAP_NET_RAW!
[FIX]:
setcap cap_net_raw+ep /usr/bin/fping6

do you understand about this ?

try run that fix command

the command cannot be runs well

sudo /opt/librenms/validate.php

Component Version
LibreNMS 1.68-63-g59accd7e4
DB Schema 2020_10_03_1000_add_primary_key_transport_group_transport (186)
PHP 7.4.11
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.15
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[FAIL] /usr/bin/fping could not be executed. /usr/bin/fping must have CAP_NET_RAW capability (getcap) or suid. Selinux exclusions may be required.
()
[FAIL] /usr/bin/fping6 could not be executed. /usr/bin/fping6 must have CAP_NET_RAW capability (getcap) or suid. Selinux exclusions may be required.
()
[FAIL] /usr/bin/fping6 should have CAP_NET_RAW!
[FIX]:
setcap cap_net_raw+ep /usr/bin/fping6
cloud@jk1-libre01:~$ setcap cap_net_raw+ep /usr/bin/fping6
unable to set CAP_SETFCAP effective capability: Operation not permitted
cloud@jk1-libre01:~$ sudo setcap cap_net_raw+ep /usr/bin/fping6
Failed to set capabilities on file `/usr/bin/fping6’ (Invalid argument)
The value of the capability argument is not permitted for a file. Or the file is not a regular (non-symlink) file

try test fping6 Problem with validate/fping

incase it is selinux related you could try turn that off if your not using it, check sestatus and set to permissive

is alive

libre01:~$ sudo -u LibreNMS fping 10.151.152.204
10.151.152.204 is alive
libre01:~$ sudo -u LibreNMS fping6 10.151.152.204
10.151.152.204 is alive
libre01:~$

selinux status

libre01:~$ sudo sestatus
SELinux status: disabled
jk1-libre01:~$

try ping a IPv6 address for fping6 , and check if IPv6 is disabled on the server maybe

also might be file permission related Errors on ./validate.php for fping