Wrong database schema error after upgrade

Issues with Database after Upgrade < 25.12.0-dev.21+e59be9a75 - Tue Nov 25 2025 18:35:34 GMT+0300>

After the mentioned upgrade pushed yesterday, the Librenms stopped polling the graph. We managed to fix that however now when we run the validate.php we get below error

“[FAIL] We have detected that your database schema may be wrong
Database: incorrect column (device_stats/ping_last_timestamp)
[FIX]:
Run the following SQL statements to fix it
SQL Statements:
ALTER TABLE device_stats CHANGE ping_last_timestamp ping_last_timestamp timestamp NOT NULL ;
Attempt to fix this issue (y or n)?:y”

When we run to attemp to fix the issue by pressing “yes” the error still remains. However I can confirm that the librenms graphs are being populated correctly.

Can you please guide as how to overcome this error.

Below is the complete output of validate.php

sudo -u librenms php validate.php

Component Version
LibreNMS 25.12.0-dev.21+e59be9a75 (2025-11-25T15:35:34+00:00)
DB Schema 2025_05_28_092148_create_device_stats (359)
PHP 8.3.11
Python 3.10.12
Database MariaDB 10.6.22-MariaDB-0ubuntu0.22.04.1
RRDTool 1.7.2
SNMP 5.9.1
===========================================

[OK] Composer Version: 2.9.2
[OK] Dependencies up-to-date.
[OK] Database Connected
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK] Database and column collations are correct
[FAIL] We have detected that your database schema may be wrong
Database: incorrect column (device_stats/ping_last_timestamp)
[FIX]:
Run the following SQL statements to fix it
SQL Statements:
ALTER TABLE device_stats CHANGE ping_last_timestamp ping_last_timestamp timestamp NOT NULL ;
Attempt to fix this issue (y or n)?:y
Attempted to apply fix.
[OK] MySQL and PHP time match
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[OK] Redis is functional
[OK] rrd_dir is writable
[OK] rrdtool version ok

Thanks,
Abbas

also experiencing this (polling stopped and errors from validatre.php) after yesterday’s update.

[librenms@nms ~]$ ./validate.php

Component Version
LibreNMS 25.12.0-dev.21+e59be9a75 (2025-11-25T17:35:34+02:00)
DB Schema 2025_05_28_092148_create_device_stats (359)
PHP 8.3.28
Python 3.6.8
Database MariaDB 10.3.39-MariaDB
RRDTool 1.7.0
SNMP 5.8
===========================================

[OK] Composer Version: 2.9.2
[OK] Dependencies up-to-date.
[OK] Database Connected
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK] Database and column collations are correct
[FAIL] We have detected that your database schema may be wrong
Database: incorrect column (device_stats/ping_last_timestamp)
[FIX]:
Run the following SQL statements to fix it
SQL Statements:
ALTER TABLE device_stats CHANGE ping_last_timestamp ping_last_timestamp timestamp NOT NULL ;
Attempt to fix this issue (y or n)?:y
Attempted to apply fix.
[OK] MySQL and PHP time match
[FAIL] Poller is not running. No poller has run within the last 300 seconds.
[OK] Dispatcher Service not detected
[OK] Locks are functional
[FAIL] No active python wrapper pollers found
[OK] Redis is unavailable
[OK] rrd_dir is writable
[OK] rrdtool version ok
[FAIL] Scheduler is not running
[FIX]:
sudo cp /opt/librenms/dist/librenms-scheduler.service /opt/librenms/dist/librenms-scheduler.timer /etc/systemd/system/
sudo systemctl enable librenms-scheduler.timer
sudo systemctl start librenms-scheduler.timer

hello, I got the same error.

When I tried to migrate, it gave an error again and did not fix it.

I confirmed the same problem, polling fails after yesterday upgrade!!!

Exactly same issue here. All polling has failed since around midnight UK time.

Validate php output:

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

Component Version
LibreNMS 25.12.0-dev.21+e59be9a75 (2025-11-25T15:35:34+00:00)
DB Schema 2025_10_17_112553_bgp_peers_cbgp_bigint (358)
PHP 8.3.21
Python 3.8.10
Database MariaDB 10.6.22-MariaDB-ubu2004
RRDTool 1.7.2
SNMP 5.8
===========================================

[OK] Composer Version: 2.9.2
[OK] Dependencies up-to-date.
[OK] Database Connected
[FAIL] Your database is out of date!
[FIX]:
./lnms migrate
Attempt to fix this issue (y or n)?:n
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK] MySQL and PHP time match
[OK] Distributed Polling setting is enabled globally
[OK] Connected to rrdcached
[OK] Active pollers found
[OK] Dispatcher Service is enabled
[OK] Locks are functional
[OK] Python wrapper cron entry is not present
[OK] Redis is functional
[OK] rrdtool version ok
[OK] Connected to rrdcached

Daily log shows:

Updating SQL-Schema FAIL

INFO Running migrations.

2025_05_28_092148_create_device_stats … 27.80ms FAIL

In Connection.php line 824:

SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for ‘ping_last_timestamp’ (Connection: mysql, SQL: create table device_stats (id bigint unsigned not null auto_
increment primary key, created_at timestamp null, updated_at timestamp null, device_id int unsigned not null, ping_last_timestamp timestamp not null, ping_rtt_last float(53) unsigned
null, ping_rtt_prev float(53) unsigned null, ping_rtt_avg float(53) unsigned null, ping_rtt_diff_avg_last float(53) as (ping_rtt_last - ping_rtt_avg), ping_rtt_diff_prev_last float(53)
as (ping_rtt_last - ping_rtt_prev), ping_loss_last float(53) unsigned null, ping_loss_prev float(53) unsigned null, ping_loss_avg float(53) unsigned null) default character set utf8mb4 co
llate ‘utf8mb4_unicode_ci’)

In Connection.php line 570:

SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for ‘ping_last_timestamp’

Exactly the same here

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

Component Version
LibreNMS 25.12.0-dev.21+e59be9a75 (2025-11-25T15:35:34+00:00)
DB Schema 2025_05_28_092148_create_device_stats (359)
PHP 8.3.22
Python 3.9.2
Database MariaDB 10.5.29-MariaDB-0+deb11u1
RRDTool 1.7.2
SNMP 5.9
===========================================

[OK] Composer Version: 2.9.2
[OK] Dependencies up-to-date.
[OK] Database Connected
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK] Database and column collations are correct
[FAIL] We have detected that your database schema may be wrong
Database: incorrect column (device_stats/ping_last_timestamp)
[FIX]:
Run the following SQL statements to fix it
SQL Statements:
ALTER TABLE device_stats CHANGE ping_last_timestamp ping_last_timestamp timestamp NOT NULL ;
Attempt to fix this issue (y or n)?:y
Attempted to apply fix.
[OK] MySQL and PHP time match
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[WARN] Using database for locking, you should set CACHE_STORE=redis
[OK] rrdtool version ok
[OK] Connected to rrdcached

running validate again gives the same error and fix

Fixed as of 4 hours ago, run ./daily.sh

2 Likes

It’s fixed for me. Thank you.