Problems getting database migration to work after running validate.php and ./lnms migrate


When I recently ran validate.php it informed me that my database is out of date, and asked me to fix it by running ./lnms migrate.
After running the migrate command I got various errors, so I searched this forum and came upon the thread here.

I followed the instructions kindly provided by Murrant, but after a while reached a point beyond which I cannot proceed. The queries just return errors.

Here’s the current output from “sudo -u librenms ./lnms migrate --pretend”:

Running the first command in that list simply returns this error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘start_recurring_dt’ in ‘field list’ (SQL: update alert_schedule set start = CONVERT_TZ(IF(recurring = 1, STR_TO_DATE(C
ONCAT(start_recurring_dt, ’ ', start_recurring_hr), ‘%Y-%m-%d %H:%i:%s’), start), @@global.time_zone, ‘+00:00’), end = CONVERT_TZ(IF(recurring = 1, STR_TO_DATE(CONCAT(IFNULL(en
d_recurring_dt, ‘9000-09-09’), ’ ', end_recurring_hr), ‘%Y-%m-%d %H:%i:%s’), end), @@global.time_zone, ‘+00:00’), recurring_day = REPLACE(recurring_day, 0, 7))

Looking at the next command, I suspect it will also fail due to referencing the same columns.

Any help in getting through this would be greatly appreciated, as I’m not terribly good with database management.

Thanks! :slight_smile:

Obligatory output from validate:

sudo -u librenms ./validate.php
Component | Version
--------- | -------
LibreNMS | 1.65-51-g3c78e0ccc
DB Schema | 2020_04_06_001048_the_great_index_rename (165)
PHP | 7.4.8
Python | 3.6.9
MySQL | 5.7.30-0ubuntu0.18.04.1
RRDTool | 1.7.0

[OK] Composer Version: 1.10.9
[OK] Dependencies up-to-date.
[OK] Database connection successful
[FAIL] Your database is out of date!

  •    [FIX]:*
  •    ./lnms migrate*
1 Like

If there’s any other information that I can provide, or anything else that I should be trying, let me know and I’ll do my very best to get it done.
I’m really not sure how to proceed in troubleshooting this, so any tips would be very gladly received.

Having the same problem.

More - probably unnecessary information;
Running in docker(-compose) did the upgrade procedure (down, pull, up -d) from 1.58.

When I got LibreNMS up again (after changing mysql pass to remove ‘’#" ) pollers no longer worked.

The rest of my case is the same, validate.php pointed me to ‘./lnms migrate’ which had faults which then lead me to the same fix by Murrant.

Now having the exact same error.

1 Like

OK, in a (probably misguided) effort to get this working, I have created the missing columns manually, then re-run migrate.
Then it complained that tables it was trying to create already existed. I dropped them and re-ran it, so that they were created successfully.

It now returns “Nothing to migrate” when run.
Running returns no errors.

Running validate.php goes absolutely nuts and seems to think lots of things are now broken in the database.

Output from validate.php here

Now having trouble adding new devices.
We have backups, so can roll back, but this will just revert to the previous, non-migrated state.

Any help at all would be super appreciated - this is well beyond my usual involvement with anything database-related. :slight_smile: