2nd install of xi-2024R2.1 fails - I fixed it

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
StevenBeauchemin
Posts: 15
Joined: Fri Jun 30, 2023 12:39 pm

2nd install of xi-2024R2.1 fails - I fixed it

Post by StevenBeauchemin »

Iterating through Nagios installs, fixing things that did not complete, I found this.

in the file /tmp/nagiosxi/01-prereqs

At the end, there is a pecl install. If this has already been installed, the script will error out.

like this:
pecl/ssh2 is already installed and is the same as the released version 1.4.1
install failed
To address this failure: the internet is your friend...
When using pecl install for a package that is already installed, it can fail because PECL typically flags existing installations as an error rather than a "nothing to do" state. This behavior can be problematic in automated scripts or when attempting to re-install a module.

To avoid errors and ensure the command is idempotent (meaning it can be run multiple times with the same result), you can check if the package is already installed before attempting to install it.
edit the 01-prereqs file, and at the bottom change it to look like this.

Code: Select all

        # Adds ssh2 VIA pecl to support newer versions of PHP
        # test pecl install - if it is already installed it will FAIL
        if ! pecl list | grep -q ssh2; then
          printf "\n" | pecl install ssh2
          echo "extension=ssh2" > /etc/php.d/ssh2.ini
        fi

        # Adds ssh2 VIA pecl to support newer versions of PHP
        # printf "\n" | pecl install ssh2
        # echo "extension=ssh2" > /etc/php.d/ssh2.ini
Basically, test for the install, and if not found, then install it.

Just sharing in case anyone else has this problem.

Steve B
sgardil
Posts: 349
Joined: Wed Aug 09, 2023 9:58 am

Re: 2nd install of xi-2024R2.1 fails - I fixed it

Post by sgardil »

StevenBeauchemin wrote: Thu Aug 28, 2025 2:18 pm Iterating through Nagios installs, fixing things that did not complete, I found this.

in the file /tmp/nagiosxi/01-prereqs

At the end, there is a pecl install. If this has already been installed, the script will error out.

like this:
pecl/ssh2 is already installed and is the same as the released version 1.4.1
install failed
To address this failure: the internet is your friend...
When using pecl install for a package that is already installed, it can fail because PECL typically flags existing installations as an error rather than a "nothing to do" state. This behavior can be problematic in automated scripts or when attempting to re-install a module.

To avoid errors and ensure the command is idempotent (meaning it can be run multiple times with the same result), you can check if the package is already installed before attempting to install it.
edit the 01-prereqs file, and at the bottom change it to look like this.

Code: Select all

        # Adds ssh2 VIA pecl to support newer versions of PHP
        # test pecl install - if it is already installed it will FAIL
        if ! pecl list | grep -q ssh2; then
          printf "\n" | pecl install ssh2
          echo "extension=ssh2" > /etc/php.d/ssh2.ini
        fi

        # Adds ssh2 VIA pecl to support newer versions of PHP
        # printf "\n" | pecl install ssh2
        # echo "extension=ssh2" > /etc/php.d/ssh2.ini
Basically, test for the install, and if not found, then install it.

Just sharing in case anyone else has this problem.

Steve B
Thanks for sharing the solution you found. We do tell users that it is strongly recommend to install our products on a clean system cause issues like this can happen with conflicting/already installed packages that we cant always account for.
Post Reply