This is a packaging error since the bug is introduced with gentoo-specific modifications. In particular, the Gentoo-supplied /etc/conf.d/icinga2 is missing variables needed for /usr/lib/icinga2/prepare-dirs, and these variables are included in the upstream icinga2.confd file. I have fixed this issue locally by expanding /etc/conf.d/icinga2 to look like this: DAEMON=/usr/sbin/icinga2 ICINGA2_CONFIG_FILE=/etc/icinga2/icinga2.conf ICINGA2_RUN_DIR=/run/icinga2 ICINGA2_STATE_DIR=/var ICINGA2_PID_FILE=$ICINGA2_RUN_DIR/icinga2.pid ICINGA2_ERROR_LOG=/var/log/icinga2/error.log ICINGA2_STARTUP_LOG=/var/log/icinga2/startup.log ICINGA2_LOG=/var/log/icinga2/icinga2.log ICINGA2_COMMAND_GROUP=icingacmd Note: Icinga2 still fails to launch with this fixed conf.d, due to another issue with /usr/lib/icinga2/prepare-dirs, but I suspect that issue is upstream rather than Gentoo-specific. (It fails to create /var/cache/icinga2, so icinga2 crashes on startup)
Note: Upstream bug for the second issue is at https://dev.icinga.org/issues/12253 I just realized that even if they fix it upstream, the Gentoo package for the existing versions would continue to fail to work, so it might be necessary to patch this in the package as well.
If a patch is available I can probably just backport it.
For the first part I submitted https://github.com/gentoo/gentoo/pull/5020 because I believe this fixes it. For the second part I submitted https://github.com/Icinga/icinga2/pull/5392
thanks for fixing this, merged it