"No backend has been configured" after initial setup

I am trying to set up icingaweb2 with LDAP authentication talking to a local icinga2 setup via command pipe. After running the setup wizard I can successfully log into icingaweb2 but I am getting the following error message both in the Web UI and logs:

2023-06-27T09:16:51+00:00 - ERROR - Icinga\Exception\ConfigurationError in /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/MonitoringBackend.php:186 with message: No backend has been configured
#0 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/MonitoringBackend.php(76): Icinga\Module\Monitoring\Backend\MonitoringBackend::loadConfig()
#1 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Controller.php(32): Icinga\Module\Monitoring\Backend\MonitoringBackend::instance()
#2 /usr/share/php/Icinga/Web/Controller/ModuleActionController.php(28): Icinga\Module\Monitoring\Controller->moduleInit()
#3 /usr/share/php/Icinga/Web/Controller/ActionController.php(169): Icinga\Web\Controller\ModuleActionController->prepareInit()
#4 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(59): Icinga\Web\Controller\ActionController->__construct()
#5 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch()
#6 /usr/share/php/Icinga/Application/Web.php(290): Zend_Controller_Front->dispatch()
#7 /usr/share/php/Icinga/Application/webrouter.php(105): Icinga\Application\Web->dispatch()
#8 /usr/share/icingaweb2/public/index.php(4): require_once(String)
#9 {main}

The setup module has generated the following configuration files:

/etc/icingaweb2/groups.ini:

[icingaweb2]
resource = "icingaweb_ldap"
user_backend = "icingaweb2"
group_class = "posixGroup"
group_name_attribute = "cn"
group_member_attribute = "memberUid"
base_dn = "dc=skole,dc=skolelinux,dc=no"
backend = "ldap"

/etc/icingaweb2/roles.ini:

[Administrators]
groups = "icinga-admins"
permissions = "*"

/etc/icingaweb2/modules/monitoring/config.ini:

[security]
protected_customvars = "*pw*,*pass*,community"

/etc/icingaweb2/modules/monitoring/backends.ini:

[icinga2]
type = "ido"
resource = "icinga_ido"

/etc/icingaweb2/modules/monitoring/commandtransports.ini:

[icinga2]
transport = "local"
path = "/var/run/icinga2/cmd/icinga2.cmd"

/etc/icingaweb2/resources.ini`:

[icingaweb_db]
type = "db"
db = "mysql"
host = "localhost"
dbname = "icingaweb2"
username = "icingaweb2"
password = "v64nhbe27dfBjR3T"
use_ssl = "0"

[icingaweb_ldap]
type = "ldap"
hostname = "tjener.intern"
port = "389"
encryption = "starttls"
root_dn = "dc=skole,dc=skolelinux,dc=no"
timeout = "5"

[icinga_ido]
type = "db"
db = "mysql"
host = "localhost"
dbname = "icingadb"
username = "icinga2"
password = "v64nhbe27dfBjR3T"
use_ssl = "0"

/etc/icingaweb2/config.ini:

[global]
show_stacktraces = "1"
show_application_state_messages = "1"
config_resource = "icingaweb_db"

[logging]
log = "file"
level = "ERROR"
file = "/var/log/icingaweb2/icingaweb2.log"

/etc/icingaweb2/authentication.ini:

[icingaweb2]
user_class = "inetOrgPerson"
user_name_attribute = "uid"
backend = "ldap"
base_dn = "dc=skole,dc=skolelinux,dc=no"
resource = "icingaweb_ldap"

The icingaweb2 DB referenced above exists and can be accessed:

$ echo 'show tables;' | mysql --user=icingaweb2 --password=v64nhbe27dfBjR3T -t icingaweb2                                                                                                                                             
+----------------------------+                                                                                                                                                                                                                                                    
| Tables_in_icingaweb2       |                                                                                                                                                                                                                                                    
+----------------------------+                                                                                                                                                                                                                                                    
| icingaweb_group            |                                                                                                                                                                                                                                                    
| icingaweb_group_membership |                                                                                                                                                                                                                                                    
| icingaweb_rememberme       |                                                                                                                                                                                                                                                    
| icingaweb_schema           |                                                                                                                                                                                                                                                    
| icingaweb_user             |                                                                                                                                                                                                                                                    
| icingaweb_user_preference  |                                                                                                                                                                                                                                                    
+----------------------------+                      

My goal is to update a non-interactive setup script for Debian bullseye (see share/debian-edu-config/tools/edu-icinga-setup · personal/gber/icingaweb-fix · Debian Edu / debian-edu-config · GitLab).

I am using Debian bullseye which provides icinga 2.13.6 and icingaweb2 2.11.4 packages running on PHP 8.2 under Apache with MySQL and OpenLDAP.

Have you actually installed one of the monitoring modules, that is icingaweb2-monitoring or icingadb-web?

The icingaweb2 monitoring module is installed and enabled.

And Configuration → Modules → Monitoring → Backends says what?

I managed to reproduce this error by removing the backend that was there. Configuration files (backends.ini and resources.ini) look good, but maybe there is a typo.

That page showed a permission error. Looking further I found that /etc/icingaweb2/modules had drwxrwSrwx permissions, note the lack of x for the group, so a chmod g+x /etc/icingaweb2/modules fixed it. It’s a bit weird, since I don’t know where that comes from (some weird umask in the installer/CFengine maybe) and it shouldn’t prevent backend.ini from being read, it was written to by the setup module without problems. Thanks for pointing me in the right direction.

That bit you’re talking about is the SGID bit and is responsible for automatic group permission transfer to new files in the directory. If you remove it, and create a new configuration using the UI, it’s not guaranteed it can be read again. You should restore it.