Broken Packages during Icinga2 installation

Previously i was installed icinga2 10.5 & i have removed icinga2 & trying to install icinga2 agaain looks like it is installing r2.11.2-1… when i am installing i am getting the below errors… can someone help me on this?
/etc/icinga2# apt-get -f install icinga2 icinga2-common icinga2-bin
Reading package lists… Done
Building dependency tree
Reading state information… Done
icinga2 is already the newest version (2.11.2-1.bionic).
icinga2-bin is already the newest version (2.11.2-1.bionic).
icinga2-common is already the newest version (2.11.2-1.bionic).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up icinga2-common (2.11.2-1.bionic) …
chown: cannot access ‘/etc/icinga2/icinga2.conf’: No such file or directory
dpkg: error processing package icinga2-common (–configure):
installed icinga2-common package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of icinga2-bin:
icinga2-bin depends on icinga2-common (= 2.11.2-1.bionic); however:
Package icinga2-common is not configured yet.

dpkg: error processing package icinga2-bin (–configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of icinga2:
icinga2 depends on icinga2-bin (= 2.11.2-1.bionic); however:
Package icinga2-bin is not configured yet.
icinga2 depends on icinga2-common (= 2.11.2-1.bionic); however:
Package icinga2-common is not configured yet.

dpkg: error processing package icinga2 (–configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
icinga2-common
icinga2-bin
icinga2
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@SLC-ICINGA2-01:/etc/icinga2# icinga2 --versioin

Hi,

What exactly is the scope here? Upgrade, reinstall or install from scratch?

You have packages from previous installation that haven’t finished configuring and are stack midway.

Cheers,
George

1 Like

I have been trying to reinstall the Icinga2… at this time issue is resolved… I would like to understand what is the best way to reinstall or upgrade the all icinga2 packages … Can you please provide me instructions on this?

Hi,

For every upgrade one should always check the documentation for special notes and actions and act appropriately. Then in your case it is just a matter of:

apt-get update && apt-get upgrade
(to upgrade everything in your system, which one should do at regular intervals)
OR
apt-get update && apt-get install icinga2
(this will just update icinga2 packages and all the requirements)

It is important to check that apt/dpkg exits without errors. If there are errors, you probably have issues from previous actions.

In this case, you had removed the icinga2.conf file, apt could not find it and refused to finish the setup of the package. Which left the whole system in a broken state.

Cheers,
George

2 Likes

I have a similar problem on a raspberry pi 3B running Raspbian buster headless.
I am using Director exclusively and have the following versions:

Icinga Web 2 Version
2.8.2
PHP Version
7.4.33
Copyright
© 2013-2022 The Icinga Project

Loaded modules

Name Version
director 1.7.2
incubator 0.5.0
ipl v0.3.0
monitoring 2.8.2
reactbundle 0.7.0

I can’t say what the version of icinga2 is since it does not execute the -version command.

icinga@master-bldr:~ $ sudo apt-get update && sudo apt-get install icinga2
Hit:1 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
Hit:3 http://archive.raspberrypi.org/debian bullseye InRelease
Hit:2 https://packages.icinga.com/raspbian icinga-buster InRelease
Reading package lists… Done
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
icinga2-bin : Depends: libboost-atomic1.67.0 but it is not installable
Depends: libboost-chrono1.67.0 but it is not installable
Depends: libboost-context1.67.0 but it is not installable
Depends: libboost-coroutine1.67.0 but it is not installable
Depends: libboost-date-time1.67.0 but it is not installable
Depends: libboost-filesystem1.67.0 but it is not installable
Depends: libboost-iostreams1.67.0 but it is not installable
Depends: libboost-program-options1.67.0 but it is not installable
Depends: libboost-regex1.67.0 (>= 1.67.0-10) but it is not installable
Depends: libboost-system1.67.0 but it is not installable
Depends: libboost-thread1.67.0 but it is not installable
E: Unable to correct problems, you have held broken packages.
icinga@master-bldr:~ $

Removing and installing icinga2:

icinga@master-bldr:~ $ sudo apt update
[sudo] password for icinga:
Hit:1 http://archive.raspberrypi.org/debian bullseye InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
Hit:3 https://packages.icinga.com/raspbian icinga-buster InRelease
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
All packages are up to date.
icinga@master-bldr:~ $ sudo apt remove icinga2
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Package ‘icinga2’ is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up icinga2-common (2.13.6-1.buster) …
Job for icinga2.service failed because the control process exited with error code.
See “systemctl status icinga2.service” and “journalctl -xe” for details.
invoke-rc.d: initscript icinga2, action “start” failed.
● icinga2.service - Icinga host/service/network monitoring system
Loaded: loaded (/lib/systemd/system/icinga2.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/icinga2.service.d
└─limits.conf
Active: failed (Result: exit-code) since Thu 2022-12-15 18:11:46 MST; 30ms ago
Process: 15586 ExecStartPre=/usr/lib/icinga2/prepare-dirs /etc/default/icinga2 (code=exited, status=0/SUCCESS)
Process: 15591 ExecStart=/usr/sbin/icinga2 daemon --close-stdio -e ${ICINGA2_ERROR_LOG} (code=exited, status=203/EXEC)
Main PID: 15591 (code=exited, status=203/EXEC)
CPU: 21ms

Dec 15 18:11:46 master-bldr systemd[1]: Starting Icinga host/service/network monitoring system…
Dec 15 18:11:46 master-bldr systemd[15591]: icinga2.service: Failed to locate executable /usr/sbin/icinga2: No such file or directory
Dec 15 18:11:46 master-bldr systemd[15591]: icinga2.service: Failed at step EXEC spawning /usr/sbin/icinga2: No such file or directory
Dec 15 18:11:46 master-bldr systemd[1]: icinga2.service: Main process exited, code=exited, status=203/EXEC
Dec 15 18:11:46 master-bldr systemd[1]: icinga2.service: Failed with result ‘exit-code’.
Dec 15 18:11:46 master-bldr systemd[1]: Failed to start Icinga host/service/network monitoring system.
dpkg: error processing package icinga2-common (–configure):
installed icinga2-common package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
icinga2-common
E: Sub-process /usr/bin/dpkg returned an error code (1)
icinga@master-bldr:~ $ sudo apt install icinga2
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
icinga2-bin : Depends: libboost-atomic1.67.0 but it is not installable
Depends: libboost-chrono1.67.0 but it is not installable
Depends: libboost-context1.67.0 but it is not installable
Depends: libboost-coroutine1.67.0 but it is not installable
Depends: libboost-date-time1.67.0 but it is not installable
Depends: libboost-filesystem1.67.0 but it is not installable
Depends: libboost-iostreams1.67.0 but it is not installable
Depends: libboost-program-options1.67.0 but it is not installable
Depends: libboost-regex1.67.0 (>= 1.67.0-10) but it is not installable
Depends: libboost-system1.67.0 but it is not installable
Depends: libboost-thread1.67.0 but it is not installable
E: Unable to correct problems, you have held broken packages.
icinga@master-bldr:~ $

This began with only the libboost-iostreams1.67 package being broken before I tried installing with Aptitude instead of apt.
Could anyone suggest a procedure to solve this problem?
Could I preserve my configuration while uninstalling icinga2 and reinstalling from scratch?

You need to update this package repository first.

Thanks for the response!
But I was mistaken. I upgraded to bullseye.
And I have a 32b processor:

icinga@master-bldr:~ $ sudo lshw
master-bldr
description: ARMv7 Processor rev 4 (v7l)
product: Raspberry Pi 3 Model B Plus Rev 1.3
serial: 0000000028f9985d
width: 32 bits
capabilities: smp
*-core
description: Motherboard
physical id: 0
*-cpu:0
description: CPU
product: cpu
physical id: 0
bus info: cpu@0
size: 1400MHz
capacity: 1400MHz
capabilities: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 cpufreq
*-cache
description: L1 Cache
physical id: 0
size: 32KiB
*-cpu:1

I did update raspi & icinga lists:

icinga@master-bldr:~ $ sudo cat /etc/apt/sources.list.d/raspi.list
deb http://archive.raspberrypi.org/debian/ bullseye main

Uncomment line below then ‘apt-get update’ to enable ‘apt-get source’

#deb-src http://archive.raspberrypi.org/debian/ bullseye main

icinga@master-bldr:~ $ sudo cat /etc/apt/sources.list.d/icinga.list
deb [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] https://packages.icinga.com/raspbian icinga-bullseye main

Uncomment line below then ‘apt-get update’ to enable ‘apt-get source’

#deb-src [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] https://packages.icinga.com/raspbian icinga-bullseye main

I disabled the icinga2.service launch in systemctl to make sure it wasn’t the failed launch. it also confused the install output.
Now it seems like a 32b icinga2-bin and icinga2-common are not available?

icinga@master-bldr:~ $ sudo apt install icinga2
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
icinga2 : Depends: icinga2-bin (= 2.13.6-1.bullseye) but it is not going to be installed
Depends: icinga2-common (= 2.13.6-1.bullseye) but 2.13.6-1.buster is to be installed
Recommends: icinga2-doc (= 2.13.6-1.bullseye) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
icinga@master-bldr:~ $

This seems to be confirmed by https://packages.icinga.com/raspbian/
Questions:

  1. Do I understand correctly that since the bullseye versions are only for 64bit they will not be installed and in the case of icinga2-common, the installer reverts to the 32b compatible buster version?
  2. If this is true, should I revert to buster in order to get icinga2 running again?
  3. Or switch to the 64bit image of bullseye? Also should all the hosts be running the same versions of icinga2, which would not be possible(?) since I have pi zero hosts?

There is still something wrong since apt wants to install a buster package.

Since there were no answers to my questions, I’ll attempt to answer myself.

  1. I’ll assume this is true. And I’ll reinstall from scratch.
  2. I’ll revert to buster for the Pi Zero 32b versions, and gradually transition to the 64bit versions of Raspbian OS, and replace the PI Zero hosts with Pi Zero W V2, which can use 64b Raspbian OS.
  3. Switch to 64b where possible to achieve the latest software versions, i.e. all the Pi 3b’s.
    Additionally, I’ll assume that 32bit versions of Icinga2 for Raspbian OS will not be further developed.

I also found this regarding host and master versioning:

" It generally is advised to use the newest releases with the same version on all instances. Prior to upgrading, make sure to plan a maintenance window.

The Icinga project aims to allow the following compatibility:

master (2.11) >= satellite (2.10) >= agent (2.9)"

Distributed Monitoring - Icinga 2