Icingaweb2 not working on Ubuntu 22 LTS due to PHP error

Hi guys,

I recently updated the OS of my working Icinga2 setup to Ubuntu 22 LTS.
Icinga generally works well (I get lots of mails when something is wrong with my landscape etc), but Icingaweb2 stopped working. For my understanding, this is exactly the same issue which is also discussed here Issues · Icinga/icingaweb2 · GitHub


Deprecated: Return type of Icinga\Application\Libraries::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Icinga/Application/Libraries.php on line 20

Deprecated: Return type of Icinga\Application\Config::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Icinga/Application/Config.php on line 125

Deprecated: Return type of Icinga\Application\Config::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Icinga/Application/Config.php on line 145

Deprecated: Return type of Icinga\Application\Config::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Icinga/Application/Config.php on line 175

Deprecated: Return type of Icinga\Application\Config::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Icinga/Application/Config.php on line 165

Deprecated: Return type of Icinga\Application\Config::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Icinga/Application/Config.php on line 155

Deprecated: Return type of Icinga\Application\Config::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Icinga/Application/Config.php on line 135

Deprecated: Return type of Icinga\Web\Session\SessionNamespace::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Icinga/Web/Session/SessionNamespace.php on line 35

Deprecated: Return type of Icinga\Authentication\AuthChain::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Icinga/Authentication/AuthChain.php on line 200

Deprecated: Return type of Icinga\Authentication\AuthChain::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Icinga/Authentication/AuthChain.php on line 220

Deprecated: Return type of Icinga\Authentication\AuthChain::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Icinga/Authentication/AuthChain.php on line 210

Deprecated: Return type of Icinga\Authentication\AuthChain::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Icinga/Authentication/AuthChain.php on line 231

Deprecated: Return type of Icinga\Authentication\AuthChain::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/share/php/Icinga/Authentication/AuthChain.php on line 189

Fatal error: Uncaught ErrorException: Uncaught Zend_Controller_Response_Exception: Cannot send headers; headers already sent in /usr/share/php/Icinga/Authentication/AuthChain.php, line 22 in /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Response/Abstract.php:323 Stack trace: #0 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Response/Abstract.php(148): Zend_Controller_Response_Abstract->canSendHeaders() #1 /usr/share/php/Icinga/Web/Response.php(356): Zend_Controller_Response_Abstract->setRedirect() #2 /usr/share/php/Icinga/Web/Response.php(407): Icinga\Web\Response->prepare() #3 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Response/Abstract.php(768): Icinga\Web\Response->sendHeaders() #4 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Front.php(992): Zend_Controller_Response_Abstract->sendResponse() #5 /usr/share/php/Icinga/Application/Web.php(304): Zend_Controller_Front->dispatch() #6 /usr/share/php/Icinga/Application/webrouter.php(107): Icinga\Application\Web->dispatch() #7 /usr/share/icingaweb2/public/index.php(4): require_once('...') #8 {main} thrown in /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Response/Abstract.php:323 Stack trace: #0 [internal function]: Icinga\Application\Web->Icinga\Application\{closure}() #1 {main} Next Zend_Controller_Exception: Uncaught Zend_Controller_Response_Exception: Cannot send headers; headers already sent in /usr/share/php/Icinga/Authentication/AuthChain.php, line 22 in /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Response/Abstract.php:323 Stack trace: #0 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Response/Abstract.php(148): Zend_Controller_Response_Abstract->canSendHeaders() #1 /usr/share/php/Icinga/Web/Response.php(356): Zend_Controller_Response_Abstract->setRedirect() #2 /usr/share/php/Icinga/Web/Response.php(407): Icinga\Web\Response->prepare() #3 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Response/Abstract.php(768): Icinga\Web\Response->sendHeaders() #4 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Front.php(992): Zend_Controller_Response_Abstract->sendResponse() #5 /usr/share/php/Icinga/Application/Web.php(304): Zend_Controller_Front->dispatch() #6 /usr/share/php/Icinga/Application/webrouter.php(107): Icinga\Application\Web->dispatch() #7 /usr/share/icingaweb2/public/index.php(4): require_once('...') #8 {main} thrown#0 [internal function]: Icinga\Application\Web->Icinga\Application\{closure}() #1 {main} in /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Plugin/Broker.php:262 Stack trace: #0 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Front.php(923): Zend_Controller_Plugin_Broker->routeShutdown() #1 /usr/share/php/Icinga/Application/Web.php(471): Zend_Controller_Front->dispatch() #2 [internal function]: Icinga\Application\Web->Icinga\Application\{closure}() #3 {main} thrown in /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Plugin/Broker.php on line 262

I made sure that Icinga as well as Icingaweb2 is up-to-date (installed via repository).

Many thanks in advance!

  • Icinga Web 2 version: 2.12.1-1+ubuntu22.04
  • Used modules and their versions (System - About): From aptitude:
    • icingaweb2-module-doc: 2.11.4-5+ubuntu22.04
    • icingaweb2-module-monitoring: 2.11.4-5+ubuntu22.04
  • Web browser used: latest version of Safari/Firefox
  • Icinga 2 version used (icinga2 --version): r2.14.1-1
  • PHP version used (php --version): PHP 8.1.2-1ubuntu2.14 with Zend Engine v4.1.2
  • Server operating system and version: Ubuntu 22.04 LTS

how did you manage to get icingaweb2-module-monitoring: 2.11.4 for different version than icingaweb2?
what’s your version of icinga-php-library and icinga-php-thirdparty?

I updated from ubuntu 18 LTS to ubuntu 20 LTS and afterwards to ubuntu 22 LTS. Then I noticed that icingaweb2 was no longer working and THEN I added the icinga repositories.

icinga-php-library: 0.13.1-1+ubuntu22.04
icinga-php-thirdparty: 0.12.1-1+ubuntu22.04

I found the issue: the repository key was not properly added to gpg. Therefore the new packages were not installed (although apt was showing them). After importing the key correctly icingaweb2 was updated and is now working properly.