Failed to set up Icinga Web 2

Hello guys,
I tried to install Icinga web 2 in CentOS, I got this error

Successfully connected to existing database "icingaweb2"...
Database schema already exists...
Login "root" already exists...
Required privileges were already granted to login "root".
The database has been fully set up!

General configuration could not be written to: /etc/icingaweb2/config.ini. An error occured:
ERROR: RuntimeException in /usr/share/php/Icinga/Util/File.php:39 with message: SplFileObject::__construct(/etc/icingaweb2/config.ini): failed to open stream: Permission denied

Authentication configuration could not be written to: /etc/icingaweb2/authentication.ini. An error occured:
ERROR: RuntimeException in /usr/share/php/Icinga/Util/File.php:39 with message: SplFileObject::__construct(/etc/icingaweb2/authentication.ini): failed to open stream: Permission denied
Unable to define account "icingaweb2admin" as initial administrator. An error occured:
ERROR: RuntimeException in /usr/share/php/Icinga/Util/File.php:39 with message: SplFileObject::__construct(/etc/icingaweb2/roles.ini): failed to open stream: Permission denied

User Group Backend configuration could not be written to: /etc/icingaweb2/groups.ini. An error occured:
ERROR: RuntimeException in /usr/share/php/Icinga/Util/File.php:39 with message: SplFileObject::__construct(/etc/icingaweb2/groups.ini): failed to open stream: Permission denied

Resource configuration could not be written to: /etc/icingaweb2/resources.ini. An error occured:
ERROR: RuntimeException in /usr/share/php/Icinga/Util/File.php:39 with message: SplFileObject::__construct(/etc/icingaweb2/resources.ini): failed to open stream: Permission denied

Monitoring backend configuration could not be written to: /etc/icingaweb2/modules/monitoring/backends.ini. An error occured:
ERROR: RuntimeException in /usr/share/php/Icinga/Util/File.php:97 with message: Failed to create missing directory "/etc/icingaweb2/modules/monitoring/" (mkdir(): Permission denied)
Resource configuration could not be udpated: /etc/icingaweb2/resources.ini. An error occured:
ERROR: RuntimeException in /usr/share/php/Icinga/Util/File.php:39 with message: SplFileObject::__construct(/etc/icingaweb2/resources.ini): failed to open stream: Permission denied

Command transport configuration could not be written to: /etc/icingaweb2/modules/monitoring/commandtransports.ini. An error occured:
ERROR: RuntimeException in /usr/share/php/Icinga/Util/File.php:97 with message: Failed to create missing directory "/etc/icingaweb2/modules/monitoring/" (mkdir(): Permission denied)

Monitoring security configuration could not be written to: /etc/icingaweb2/modules/monitoring/config.ini. An error occured:
ERROR: RuntimeException in /usr/share/php/Icinga/Util/File.php:97 with message: Failed to create missing directory "/etc/icingaweb2/modules/monitoring/" (mkdir(): Permission denied)

Module "monitoring" could not be enabled. An error occured:
ERROR: Icinga\Exception\SystemPermissionException in /usr/share/php/Icinga/Application/Modules/Manager.php:269 with message: Failed to create enabledModules directory "/etc/icingaweb2/enabledModules" (mkdir(): Permission denied)

Can you guys help me to know the issue here,
Thank’s in advance.

looks like icingaweb2 has no access to /etc/icingaweb2 check the permissions

what is the permission that should be there ?

They should look like this:

drwxrws---   5 root     icingaweb2  4096 Mär 13  2018 ./
drwxr-xr-x 135 root     root       12288 Mai 15 07:04 ../
-rw-rw-r--   1 www-data icingaweb2   286 Aug 13  2018 authentication.ini
-rw-rw-r--   1 www-data icingaweb2   276 Mär 15  2018 config.ini
drwxrwsr--   3 www-data icingaweb2  4096 Jul 14  2017 dashboards/
drwxr-sr--   2 www-data icingaweb2  4096 Mär  4 08:50 enabledModules/
-rw-rw-r--   1 www-data icingaweb2    54 Apr  3  2017 groups.ini
drwxrws---   9 root     icingaweb2  4096 Nov 26 07:15 modules/
-rw-rw-r--   1 www-data icingaweb2  1162 Nov 26 07:15 resources.ini
-rw-rw-r--   1 www-data icingaweb2   733 Mär 12 13:55 roles.ini

1 Like

Hi,

either install the icingaweb2-selinux package receiving the proper policies or set SELinux to permissive.

Cheers,
Michael

1 Like

it worked, thank you :slight_smile: