LibreNMS showing "Whoops, looks like something went wrong. Check your librenms.log."

Hi Guys,

My main LibreNMS stopped working suddenly over the weekend (not sure when exactly), but I checked it by the end of business day on Friday the 11th of June 2021, and it was all good.
Today, i’m getting “Whoops, looks like something went wrong. Check your librenms.log.”

Validation shows all good, and the only warning i’m getting is that my Database is not the latest supported version:
#######################################################################
$ ./validate.php

Component Version
LibreNMS 21.5.1-32-g20c44b85c
DB Schema 2020_12_14_091314_create_port_group_port_table (205)
PHP 7.4.20
Python 3.6.9
MySQL 10.1.48-MariaDB-0ubuntu0.18.04.1
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
[FAIL] MariaDB version 10.2.2 is the minimum supported version as of March, 2021. Update MariaDB to a supported version 10.5 suggested).
[FAIL] Your database is out of date!
[FIX]:
./lnms migrate
[INFO] Detected Python Wrapper
[OK] Connection to memcached is ok

###################################################################

LibreNMS log shows the following entry:

[previous exception] [object] (PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘librenms.isis_adjacencies’ doesn’t exist at /opt/librenms/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:79)

Which raises a question.

Any help/advice please ?
Was there any updates over the weekend that might have triggered the issue ?

The last time I updated my master and pollers last week, they were on version 21.5.1-25-g1e05cdc57 (my remote pollers are still on this version as they are not set to update automatically).

However, my master server is now on version 21.5.1-32-g20c44b85c which is set to update automatically, and was most probably updated over the weekend.

Any tips guys ?

Many thanks

Same issue here. LibreNMS web stopped working over the weekend.

Component Version
LibreNMS 21.5.1-32-g20c44b8
DB Schema 2020_12_14_091314_create_port_group_port_table (205)
PHP 7.4.14
Python 3.5.2
MySQL 10.0.38-MariaDB-0ubuntu0.16.04.1
RRDTool 1.5.5
SNMP NET-SNMP 5.7.3

Unfortunately, I dont know if this is a bug, or if it’s about time to upgrade ubuntu, and get a newer version of mariadb…

When trying to run ./lnms migrate, I get the following output:

~$ ./lnms migrate


  • Application In Production!     *
    

Do you really wish to run this command? (yes/no) [no]:

yes

Migrating: 2020_12_14_091314_create_port_groups_table

In Connection.php line 678:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘port_groups’ already exists (SQL: create table port_groups (id int unsigned not null au
to_increment primary key, name varchar(255) not null, desc varchar(255) null) default character set utf8mb4 collate ‘utf8mb4_unicode_ci’)

In Exception.php line 18:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘port_groups’ already exists

In PDOStatement.php line 112:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘port_groups’ already exists

…however, I am not able to modify the port_groups table

Same issue in this thread:

Yep, I tried the same, and got the exact same results.

Mine is running on Ubuntu 18.04, and got the same behavior. I don’t think it’s Ubuntu version, but rather the last version of LibreNMS 21.5.1-32-g20c44b85c

Regards

Same issue here since the update, like the above posts.

Same situation here. Latest 20.04 Ubuntu, same symptoms.
I would say that the first thing to fix is the non working ./lnms migrate

Migrating: 2020_12_14_091314_create_port_groups_table

In Connection.php line 678:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘port_groups’ already exists (SQL: create table port_groups (id int unsigned not null auto_increment primary key, name varchar(255) not null, desc varchar(255) nu
ll) default character set utf8mb4 collate ‘utf8mb4_unicode_ci’)

In Exception.php line 18:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘port_groups’ already exists

In PDOStatement.php line 112:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘port_groups’ already exists

Once this is addressed, then I hope the rest will follow.

Your MySQL/MariaDB server version is too low and migrations failed. I have submitted a new error screen to better explain this.
There was an update that adds a query that checks a new table that doesn’t exist yet on your db server…

Resolution:

  1. Install supported version of MySQL (5.7.7) or MariaDB (10.2.2)
  2. Delete the partially migrated port_groups table ONLY IF IT IS WHERE YOU ARE STUCK lnms tinker --execute="DB::statement('DROP TABLE port_groups');"
  3. Migrate database lnms migrate
  4. Validate system ./validate.php
1 Like

Hi Murrant,

Thanks for your reply.
Unfortunately I still face the same issue. Here what i’ve done so far:

  • Upgrade MariaDB to 10.5 following their official documentation. mariaDB is up and running:

    # mysql --version
    mysql  Ver 15.1 Distrib 10.5.10-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
    
    # systemctl status mariadb.service
    ● mariadb.service - MariaDB 10.5.10 database server
    Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
         └─migrated-from-my.cnf-settings.conf
    Active: active (running) since Wed 2021-06-16 09:37:15 UTC; 4min 44s ago
    Docs: man:mariadbd(8)
         https://mariadb.com/kb/en/library/systemd/
    Process: 7669 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
    Process: 7662 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION     (code=exited, status=0/SUCCESS)
    Process: 7484 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd  /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSRE
    Process: 7476 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION    (code=exited, status=0/SUCCESS)
    Process: 7464 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 7579 (mariadbd)
    Status: "Taking your SQL requests now..."
    Tasks: 50 (limit: 4915)
    CGroup: /system.slice/mariadb.service
         └─7579 /usr/sbin/mariadbd
    

I have run the lnms tinker command as librenms user (no output was shown, nor an error message), then run ./lnms migrate:

$ ./lnms migrate
**************************************
*     Application In Production!     *
**************************************

Do you really wish to run this command? (yes/no) [no]:
> yes

Migrating: 2020_12_14_091314_create_port_groups_table

In Connection.php line 678:

 SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'port_groups' already exists (SQL:    create table `port_groups` (`id` int unsigned not null auto_increment primary key
, `name` varchar(255) not null, `desc` varchar(255) null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')


In Exception.php line 18:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'port_groups' already exists


In PDOStatement.php line 112:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'port_groups' already exists

Running ./valiadte.php:

$ ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS  | 21.5.1-34-g048938276
DB Schema | 2020_12_14_091314_create_port_group_port_table (205)
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
[FAIL]  Your database is out of date!
    [FIX]:
    ./lnms migrate
[INFO]  Detected Python Wrapper
[OK]    Connection to memcached is ok

Kindly advise.

Thanks

Hi Murrant,

referring to Ayeisha’s article:

removing the table port_groups via mysql:

 DROP TABLE port_groups;

Then running ./lnms migrate did the trick.
The GUI is back.

Best Regards

oops, had the wrong table in my statement

A post was split to a new topic: Troubles migrating database

Hi,
Like all of you, I use to have the same problem whit my LibreNMS. MariaDB was out of update and when I was trying to do ./lnms migrate I had this error “SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'port_groups ’ already exists” on Ubunto Server 18.4.

1- I update MariaDB to 10.5.10-MariaDB-1:10.5.10+maria~bionic
2- When I did ./lnms migrate… the same error

====================================
Component | Version
--------- | -------
LibreNMS | 21.5.1-40-g53ce0e016
DB Schema | 2020_12_14_091314_create_port_group_port_table (205)
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
[FAIL] Your database is out of date!
[FIX]:
./lnms migrate
[FAIL] You need to run this script as ‘librenms’ or root

3- As Murrant commented. I delete the table

$ sudo mysql -u root
MariaDB [(none)]> SHOW DATABASES;
MariaDB [(none)]> use librenms;
MariaDB [librenms]> show tables;
MariaDB [librenms]> DROP TABLE port_groups;

4- re send ./lnms migrate and that’s all.

ty

2 Likes

Following the above advice and mysql guides I yum upgraded from 5.5.x to 5.6.x then to 5.7.x. Now mysql won’t start and mysql.log is empty.

[root@f2mlibre ~]# systemctl status mysqld -l
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: activating (start-pre) since Tue 2021-06-22 11:11:20 CDT; 1s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 21727 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Control: 21745 (mysqld_pre_syst)
Tasks: 2
CGroup: /system.slice/mysqld.service
└─control
├─21745 /bin/bash /usr/bin/mysqld_pre_systemd
└─21765 /usr/bin/python -Es /usr/sbin/semanage fcontext -a -e /var/lib/mysql /var/lib/mysql-keyring

Jun 22 11:11:20 f2mlibre.farm-market.net systemd[1]: Starting MySQL Server…
[root@f2mlibre ~]#

[root@f2mlibre ~]# mysql
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (111)

[root@f2mlibre ~]# mysqld --print-defaults
mysqld would have been started with the following arguments:
–datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --symbolic-links=0 --innodb_file_per_table=1 --sql-mode= --lower_case_table_names=0

Expected the following but ran it anyway:
[root@f2mlibre ~]# su librenms
bash-4.2$ /opt/librenms/lnms migrate


  • Application In Production!     *
    

Do you really wish to run this command? (yes/no) [no]:

yes

In Connection.php line 678:

SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = librenms and table_name =
migrations and table_type = ‘BASE TABLE’)

In Exception.php line 18:

SQLSTATE[HY000] [2002] Connection refused

In PDOConnection.php line 39:

SQLSTATE[HY000] [2002] Connection refused

Haven’t found anything on line to cure this. Sigh…

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