Migrating database from v1.63 to 23.9.1-113

Hello,

I am trying to migrate off CentOS to Ubuntu22.04.

I stood up the new server on the latest version, am i able to import database directly or should I have installed the same version imported DB then upgraded?

Thanks,

Tried direct migration, it didn’t work out so great :smiley:

                          APPLICATION IN PRODUCTION.                               

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

INFO Running migrations.

2020_06_06_222222_create_device_outages_table … 5ms FAIL

In Connection.php line 795:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘device_outages’ al
ready exists (Connection: mysql, SQL: create table device_outages (id bigint u
nsigned not null auto_increment primary key, device_id int unsigned not null, g oing_down bigint not null, up_again bigint null, uptime bigint null) default
character set utf8mb4 collate ‘utf8mb4_unicode_ci’)

In Connection.php line 580:

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

Database inconsistent

Database inconsistencies found during a database error, please fix to continue.

Your database is out of date!

./lnms migrate

I’d personally suggest installing the same version on your new install (if it works with a newer version of php) then upgrade.

If that doesn’t work upgrade you’re current version to something a lot newer first then move it across and upgrade the last bit.

I think maybe your database was stuck in bad state on your old version.

Run ./validate.php on version 1.63 and clean up every noted issue before upgrading.

If you want to try moving forward on your existing install, you could edit the noted migration to comment out the device_outage table creation (and leave availability) and try to migrate again. If that table exists as well, you can add this migration in to the migrations table in the database to skip it.

What file would I need to edit to comment out device_outage_table?

I did try to drop the device_outage table and the problem shifted to availability

In Connection.php line 795:

SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘availability’ already exists (Connection:
mysql, SQL: create table availability (availability_id int unsigned not null auto_increment primary ke
y, device_id int unsigned not null, duration bigint not null, availability_perc double(6, 6) not nul
l default ‘0’) default character set utf8mb4 collate ‘utf8mb4_unicode_ci’)

In Connection.php line 580:

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

thanks,

After some doings i was able to get php7.1 on my new system -

when running composer_wrapper i end up with an authentication error

Do not run Composer as root/super user! See How do I install untrusted packages safely? Is it safe to run Composer as superuser or root? - Composer for details
Continue as root/super user [yes]? yes

LibreNMS\ComposerHelper::preInstall
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Package operations: 79 installs, 0 updates, 0 removals

Token stored successfully.
1/1 [============================] 100%

[RuntimeException]
Failed to execute git clone --mirror – ‘https://ghp...IEB:[email protected]/librenms/StringBladeCompiler.git’ ‘/root/.cache/composer/vcs/http
s—github.com-librenms-StringBladeCompiler.git/’

Cloning into bare repository ‘/root/.cache/composer/vcs/https—github.com-librenms-StringBladeCompiler.git’…
remote: Repository not found.
fatal: repository ‘https://github.com/librenms/StringBladeCompiler.git/’ not found

install [–prefer-source] [–prefer-dist] [–prefer-install PREFER-INSTALL] [–dry-run] [–dev] [–no-suggest] [–no-dev] [–no-autoloader] [–no-progress] [–no-install] [-v|vv|vvv|–verbose] [-o|–optimize-autoloader] [-a|–classmap-authoritative] [–apcu-autoloader] [–apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [–ignore-platform-req IGNORE-PLATFORM-REQ] [–ignore-platform-reqs] [–] []…

Well, you shouldn’t run composer as root. Change to the librenms user with su like in the install directions:

su - librenms
./scripts/composer_wrapper.php install --no-dev
exit

Likely, you broke all the permissions running things as root so you’ll need to fix permissions first:

chown -R librenms:librenms /opt/librenms
chmod 771 /opt/librenms
setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/

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