Problem upgrading from Nagios xi 2024R1 to 2024R1.1 or beyond

This support forum board is for support questions relating to Nagios xi, our flagship commercial network monitoring solution.
IT_LAS
Posts: 27
Joined: Mon Dec 30, 2019 5:34 am

Problem upgrading from Nagios xi 2024R1 to 2024R1.1 or beyond

Post by IT_LAS »

Hi,
I'm trying to update a Nagios xi installation from 2024R1 to 2024R1.1, on a CentOS 9 Stream VM. When it's almost finishing,after prompting for the MySQL root's password, it shows this message:

Code: Select all

sed: -e expression #1, character 27: unfinished `s' command
I don't know where to check to find what's causing this message to popup. Could there be a problem with the installation script?
Last edited by IT_LAS on Fri Aug 23, 2024 6:20 am, edited 1 time in total.
IT_LAS
Posts: 27
Joined: Mon Dec 30, 2019 5:34 am

Re: Problem updating from Nagios xi 2024R1 to 2024R1.1 or beyond

Post by IT_LAS »

I've beena able to update the instance to the version R2024 1.0.1.
If I try to update beyond that version the process fails.
jsimon
Posts: 318
Joined: Wed Aug 23, 2023 11:27 am

Re: Problem updating from Nagios xi 2024R1 to 2024R1.1 or beyond

Post by jsimon »

Hi @IT_LAS,

Can you post the last few lines from install.log? It should be in the same directory as the upgrade script you are running. This will give us a clue as to exactly which sed command is failing.
IT_LAS
Posts: 27
Joined: Mon Dec 30, 2019 5:34 am

Re: Problem updating from Nagios xi 2024R1 to 2024R1.1 or beyond

Post by IT_LAS »

There's no install.log in the same folder that contains the upgrade script, only the "upgrade.log".

This are the last lines from that log

Code: Select all

*** Exfoliation theme installed ***
NOTE: Use 'make install-classicui' to revert to classic Nagios theme

make[1]: se sale del directorio '/tmp/nagiosxi/subcomponents/nagioscore/nagios-4.4.13'
make install-basic
make[1]: se entra en el directorio '/tmp/nagiosxi/subcomponents/nagioscore/nagios-4.4.13'
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/libexec
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/var
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/var/archives
/usr/bin/install -c -m 775 -o nagios -g nagcmd -d /usr/local/nagios/var/spool/checkresults
chmod g+s /usr/local/nagios/var/spool/checkresults

*** Main program, CGIs and HTML files installed ***

You can continue with installing Nagios as follows (type 'make'
without any arguments for a list of all possible options):

  make install-init
     - This installs the init script in /lib/systemd/system

  make install-commandmode
     - This installs and configures permissions on the
       directory for holding the external command file

  make install-config
     - This installs sample config files in /usr/local/nagios/etc

make[1]: se sale del directorio '/tmp/nagiosxi/subcomponents/nagioscore/nagios-4.4.13'
/usr/bin/install -c -m 755 -d -o root -g root /lib/systemd/system
/usr/bin/install -c -m 755 -o root -g root startup/default-service /lib/systemd/system/nagios.service
UPGRADE: Nagios Core upgraded OK.
Enter the MySQL root password to continue...
Enter the MySQL root password to continue...
Password validated.
jsimon
Posts: 318
Joined: Wed Aug 23, 2023 11:27 am

Re: Problem upgrading from Nagios xi 2024R1 to 2024R1.1 or beyond

Post by jsimon »

It looks like the next command after the Password Validated message is a sed command that should edit an sql schema file with the password you entered, and the sed command appears to be failing due to a malformed command. Is there any chance the SQL password you're using has an "/" character in it?
IT_LAS
Posts: 27
Joined: Mon Dec 30, 2019 5:34 am

Re: Problem upgrading from Nagios xi 2024R1 to 2024R1.1 or beyond

Post by IT_LAS »

No, I've tested with passwords containing $ and %.
Is there any way to check which database schema is the upgrade script trying to change?
IT_LAS
Posts: 27
Joined: Mon Dec 30, 2019 5:34 am

Re: Problem upgrading from Nagios xi 2024R1 to 2024R1.1 or beyond

Post by IT_LAS »

Ok, I think I've found it but I'm not really sure.
Checking the code from the upgrade script I've found that it checks for a database maintenance user.
The snippet for that instruction on the script is this:

Code: Select all

./xivar dbmaintpass "$dbmaintpass"
This maintenance user doesn't exist on the database.

Is this user necessary for the correct upgrade of the Nagios xi service?
jsimon
Posts: 318
Joined: Wed Aug 23, 2023 11:27 am

Re: Problem upgrading from Nagios xi 2024R1 to 2024R1.1 or beyond

Post by jsimon »

That "./xivar" instruction is actually a bit of internal logic that saves local variables to a configuration file for use during install/upgrade.

It looks to me like the schema file that the upgrade script is failing to update is called

Code: Select all

schema_60000_root.sql
. The error we're seeing here indicates that the sed command to update this file is malformed somehow, and the only variable input to it is the password you provided. Based on this it really does seem like it must be an invalid character issue. I'm curious what we see if you try running this command directly on the command line. I would recommend backing up your config files and/or snapshotting your VM before trying this:

Replace the "$dbmaintpass" in the below command with the password you tried for this upgrade, and run this on your command line on the server this upgrade is failing on. If we see the same error, we can assume the password string is the culprit.

Code: Select all

sed -i "s/DBMAINTDEFAULTPASSWORD/$dbmaintpass/" "nagiosxi/nagiosxi-db/mods/mysql/schema_60000_root.sql"
(This is the sed command that I believe is failing from the upgrade script, so we're running it by itself to confirm this hypothesis)
IT_LAS
Posts: 27
Joined: Mon Dec 30, 2019 5:34 am

Re: Problem upgrading from Nagios xi 2024R1 to 2024R1.1 or beyond

Post by IT_LAS »

At last I've been able to update the instance to the latest update.
The problem was caused because, when externalising the database, the user ‘dbmaint’ was missing. I referenced the documentation for externalising the database for versions prior to 2024 (instance and database migration to new servers with newer OS and Nagios xi version upgrades came together).
After creating such a user and modifying the necessary configuration files I first tried upgrading to version 2024R1.0.2 without errors and finally upgraded to the latest available R20241.2.1.
I'm already testing the new ‘Neptune’ theme for Nagios xi :lol:
jsimon
Posts: 318
Joined: Wed Aug 23, 2023 11:27 am

Re: Problem upgrading from Nagios xi 2024R1 to 2024R1.1 or beyond

Post by jsimon »

Great! I'm glad you were able to sort out the issue. Let us know if you have any other issues, or any feedback on the new Neptune theme!