Upgrade Failure from 5.2.9 to 5.4.0

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
christiandunn1
Posts: 18
Joined: Wed Mar 23, 2011 6:32 pm
Location: Edmonton

Upgrade Failure from 5.2.9 to 5.4.0

Post by christiandunn1 »

Linux Distribution and version? RHEL 7.2
32 or 64bit? 64-bit
VMware Image or Manual Install of XI? Manual
Are there special configurations on your system, ie; is Gnome installed? Are you using a proxy? Are you using SSL? We are using SLL.

Hello,

I am experiencing an upgrade failure updating from version 5.2.9 to 5.4.0 using the NagiosXI GUI. I have uploaded the text output from the GUI update screen as an attachment and included the last few lines in this post.
nagioserror.txt
Dashlets installed/updated OK
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:2: ERROR: column "api_key" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:3: ERROR: column "api_enabled" of relation "xi_users" already exists
UPDATE 24
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:8: ERROR: column "login_attempts" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:9: ERROR: column "last_attempt" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:10: ERROR: column "last_password_change" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:13: ERROR: column "last_login" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:14: ERROR: column "last_edited" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:15: ERROR: column "last_edited_by" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:16: ERROR: column "created_by" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:17: ERROR: column "created_time" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:24: ERROR: relation "xi_eventqueue_eventqueue_id_seq" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:33: ERROR: relation "xi_eventqueue" already exists
ERROR 1060 (42S21) at line 39: Duplicate column name 'exclude'
You do not have the required permissions to view the files attached to this post.
Last edited by dwhitfield on Mon Jan 09, 2017 3:02 pm, edited 1 time in total.
Reason: marking with green check mark
jomann
Development Lead
Posts: 611
Joined: Mon Apr 22, 2013 10:06 am
Location: Nagios Enterprises

Re: Upgrade Failure from 5.2.9 to 5.4.0

Post by jomann »

Can you run the 5.4 upgrade manually from the command line? https://assets.nagios.com/downloads/nag ... nstall.pdf

Before doing so, run the following command after you cd into the nagiosxi directory to run the upgrade:

Code: Select all

touch 'mysql.540.updated'
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
christiandunn1
Posts: 18
Joined: Wed Mar 23, 2011 6:32 pm
Location: Edmonton

Re: Upgrade Failure from 5.2.9 to 5.4.0

Post by christiandunn1 »

Hi jomann,

I followed your instructions but I seem to have the same result.

[root@prdmon1 nagiosxi]# ll mysql.540.updated
-rw-r--r-- 1 root root 0 Jan 5 15:48 mysql.540.updated
[root@prdmon1 nagiosxi]# pwd
/tmp/nagiosxi
[root@prdmon1 nagiosxi]#

After running ./upgrade it terminates with the following lines:

Dashlets installed/updated OK
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:2: ERROR: column "api_key" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:3: ERROR: column "api_enabled" of relation "xi_users" already exists
UPDATE 24
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:8: ERROR: column "login_attempts" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:9: ERROR: column "last_attempt" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:10: ERROR: column "last_password_change" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:13: ERROR: column "last_login" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:14: ERROR: column "last_edited" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:15: ERROR: column "last_edited_by" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:16: ERROR: column "created_by" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:17: ERROR: column "created_time" of relation "xi_users" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:24: ERROR: relation "xi_eventqueue_eventqueue_id_seq" already exists
psql:nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql:33: ERROR: relation "xi_eventqueue" already exists
ERROR 1060 (42S21) at line 39: Duplicate column name 'exclude'
You have mail in /var/spool/mail/root
[root@prdmon1 nagiosxi]#
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Upgrade Failure from 5.2.9 to 5.4.0

Post by dwhitfield »

Do you have a snapshot of 5.2.9? Usually, these errors mean that the first upgrade failed and then you try to do another upgrade on top. These issues can generally be worked around, but if you have a snapshot of 5.2.9 you can roll back to, that's probably going to be quicker.
christiandunn1
Posts: 18
Joined: Wed Mar 23, 2011 6:32 pm
Location: Edmonton

Re: Upgrade Failure from 5.2.9 to 5.4.0

Post by christiandunn1 »

If you mean a virtual machine snapshot then unfortunately no, this is a physical box. I do have backups but this issue has been going on for a while and we can't afford to lose the config changes since it began.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Upgrade Failure from 5.2.9 to 5.4.0

Post by dwhitfield »

in the upgrade script, comment out the following lines. It's possible the line #s won't be exactly, but there should be close.

Code: Select all

653:        echo "ALTER TABLE xi_auditlog ADD COLUMN details text;" | psql $cfg__db_info__nagiosxi__db $cfg__db_info__nagiosxi__user
654:        echo "DELETE FROM xi_usermeta WHERE keyname='theme';" | psql $cfg__db_info__nagiosxi__db $cfg__db_info__nagiosxi__user
655:        echo "DELETE FROM xi_options WHERE name='theme';" | psql $cfg__db_info__nagiosxi__db $cfg__db_info__nagiosxi__user
839:            psql $cfg__db_info__nagiosxi__db $cfg__db_info__nagiosxi__user -f nagiosxi/nagiosxi-db/mods/pgsql/schema_01.sql
940:            psql $cfg__db_info__nagiosxi__db $cfg__db_info__nagiosxi__user -f nagiosxi/nagiosxi-db/mods/pgsql/schema_02.sql
Then re-run the upgrade and post the new upgrade.log.
christiandunn1
Posts: 18
Joined: Wed Mar 23, 2011 6:32 pm
Location: Edmonton

Re: Upgrade Failure from 5.2.9 to 5.4.0

Post by christiandunn1 »

It terminates with a syntax error now.

./upgrade: line 656: syntax error near unexpected token `fi'

I've included the upgrade.log contents below as well.

[root@prdmon1 nagiosxi]# cat upgrade.log
Archive: sourceguardian/ixed4.lin.x86-64.zip
inflating: /usr/lib64/php/modules/ixed.5.4.lin
Sourceguardian extension found for PHP version 5.4
Sourceguardian extension already in php.ini
Checking required prereqs...
Please wait...

OLD VERSION: 520
Loaded plugins: langpacks, package_upload, product-id, search-disabled-repos,
: subscription-manager
No Packages marked for removal
Loaded plugins: langpacks, product-id
Loaded plugins: langpacks, package_upload, product-id, search-disabled-repos,
: subscription-manager
Package automake-1.13.4-3.el7.noarch already installed and latest version
Package autoconf-2.69-11.el7.noarch already installed and latest version
Package php-mbstring-5.4.16-42.el7.x86_64 already installed and latest version
Package 2:nmap-6.47-1.x86_64 already installed and latest version
Package subversion-1.7.14-10.el7.x86_64 already installed and latest version
Nothing to do
Loaded plugins: langpacks, package_upload, product-id, search-disabled-repos,
: subscription-manager
Package perl-Test-Simple-0.98-243.el7.noarch already installed and latest version
Package perl-Class-Accessor-0.34-12.el7.noarch already installed and latest version
Package perl-Params-Validate-1.08-4.el7.x86_64 already installed and latest version
Package perl-Config-Tiny-2.14-7.el7.noarch already installed and latest version
Package perl-Math-Calc-Units-1.07-9.el7.noarch already installed and latest version
Package perl-Number-Format-1.73-14.el7.noarch already installed and latest version
Nothing to do
Loaded plugins: langpacks, package_upload, product-id, search-disabled-repos,
: subscription-manager
Package php-pecl-ssh2-0.12-1.el7.x86_64 already installed and latest version
Nothing to do
[root@prdmon1 nagiosxi]#
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Upgrade Failure from 5.2.9 to 5.4.0

Post by dwhitfield »

My apologies,

652, 656, 838-842, and 939-943 need to be added to the list of lines to comment out.

Again, please post errors if commenting out those lines doesn't do the trick.
christiandunn1
Posts: 18
Joined: Wed Mar 23, 2011 6:32 pm
Location: Edmonton

Re: Upgrade Failure from 5.2.9 to 5.4.0

Post by christiandunn1 »

That seems to have fixed the syntax error but the script still exits with:

Dashlets installed/updated OK
ERROR 1060 (42S21) at line 39: Duplicate column name 'exclude'
[root@prdmon1 nagiosxi]#


I've uploaded the upgrade.log as well.
upgrade.log
You do not have the required permissions to view the files attached to this post.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Upgrade Failure from 5.2.9 to 5.4.0

Post by dwhitfield »

We're gonna need to comment out all the MYSQL stuff too it looks like. It doesn't look like I'm going to be able to track down all the if/fi syntax stuff today, but if I do get to that, the following is what I'll be working from:

Code: Select all

411:    # new CCM updates require that mysqld be restarted just once to make sure date matches what is on the system
413:            sh ./nagiosxi/basedir/scripts/manage_services.sh restart $mysqld
436:    mysql -h $cfg__db_info__nagiosql__dbserver -u $cfg__db_info__nagiosql__user --password="$cfg__db_info__nagiosql__pwd" --database=$cfg__db_info__nagiosql__db -B -N -e "SHOW TABLES" | grep -v "tbl_info" | awk '{print "ALTER TABLE", $1, "CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;"}' | mysql  -h $cfg__db_info__nagiosql__dbserver -u $cfg__db_info__nagiosql__user --password="$cfg__db_info__nagiosql__pwd" --database=$cfg__db_info__nagiosql__db
496:    if [ -f /root/scripts/automysqlbackup ]; then
497:        sed -i 's/eval rm -fv "$BACKUPDIR\/weekly\/$DB_week.$REMW.*"/eval rm -fv "$BACKUPDIR\/weekly\/$DB\/${DB}_week.$REMW.*"/' /root/scripts/automysqlbackup
504:    mysql -h $cfg__db_info__ndoutils__dbserver -u $cfg__db_info__ndoutils__user --password="$cfg__db_info__ndoutils__pwd" --database=$cfg__db_info__ndoutils__db < nagiosxi/verify_upgraded_ndo.sql
533:    # install new version of the mysql_check_health
534:    echo "Installing new version mysql_check_health (version 2.1.8.2)"
535:    #do the check_mysql_health magic
537:        cd subcomponents/extraplugins/check_mysql_health-2.1.8.2
544:    cp -r subcomponents/extraplugins/check_mysql_health-2.1.8.2/plugins-scripts/check_mysql_health /usr/local/nagios/libexec/
828:    if [ ! -f 'mysql.530.updated' ]; then
841:            mysql -h $cfg__db_info__nagiosxi__dbserver -u $cfg__db_info__nagiosxi__user --password="$cfg__db_info__nagiosxi__pwd" --database=$cfg__db_info__nagiosxi__db < nagiosxi/nagiosxi-db/mods/mysql/schema_01.sql
845:        mysql -h $cfg__db_info__nagiosql__dbserver -u $cfg__db_info__nagiosql__user --password="$cfg__db_info__nagiosql__pwd" --database=$cfg__db_info__nagiosql__db < subcomponents/nagiosql/mods/schema_01.sql
846:        touch 'mysql.530.updated'
932:    if [ ! -f 'mysql.540.updated' ]; then
942:            mysql -h $cfg__db_info__nagiosxi__dbserver -u $cfg__db_info__nagiosxi__user --password="$cfg__db_info__nagiosxi__pwd" --database=$cfg__db_info__nagiosxi__db < nagiosxi/nagiosxi-db/mods/mysql/schema_02.sql
944:        touch 'mysql.540.updated'
Locked