#1108939 apache2: logrotate conf uses invoke-rc.d that might be inhibited

Package:
apache2
Source:
apache2
Description:
Apache HTTP Server
Submitter:
Nicolas George
Date:
2026-07-18 20:13:01 UTC
Severity:
normal
#1108939#5
Date:
2025-07-08 09:54:10 UTC
From:
To:
Dear Maintainer,

The logrotate snippet for apache2 says:

	postrotate
		if pgrep -f ^/usr/sbin/apache2 > /dev/null; then
			invoke-rc.d apache2 reload 2>&1 | logger -t apache2.logrotate
		fi
	endscript

It is possible that invoke-rc.d is inhibited by
policy-rcd-declarative-deny-all or an equivalent solution but apache2
was enabled and started explicitly.

In that case, log rotation should happen, but it does not.

Since the call is already wrapped in a test that apache2 is running, I
suggest to replace “invoke-rc.d apache2 reload” by “apache2ctl
graceful”.

Regards,

#1108939#10
Date:
2025-09-26 11:55:15 UTC
From:
To:
Small clarification since I first thought about it wrong:

Log rotation is indeed happening (e.g. mv the.log the.log.1) but Apache is not
signalled to re-open the logfiles so it continues writing to its open file
handle which is now the.log.1

#1108939#15
Date:
2026-07-18 20:11:57 UTC
From:
To:
* Nicolas George [Tue Jul 08, 2025 at 11:54:10AM +0200]:

A "graceful reload" should also prevent failures to the apache2 service during
logrotate execution whenever new symbols are provided, as could be observed by
users of e.g. the checkmk monitoring system. There the apache2 web service
failed hard whenever new symbols showed up in apache2 packages, and logrotate
kicking in during the night then.

This happened in 2024 (2024-07-14), looking like this:

  apache2: Syntax error on line 126 of /omd/sites/monitoring/etc/apache/apache.conf: Cannot load /omd/sites/monitoring/lib/apache/modules/mod_headers.so into server: /omd/sites/monitoring/lib/apache/modules/mod_headers.so: undefined symbol: ap_set_content_type_ex

Then also in 2025 (2025-09-09):

  apache2: Syntax error on line 133 of /omd/sites/monitoring/etc/apache/apache.conf: Cannot load /omd/sites/monitoring/lib/apache/modules/mod_rewrite.so into server: /omd/sites/monitoring/lib/apache/modules/mod_rewrite.so: undefined symbol: ap_stat_check

And once again also in 2026 (2026-01-26):

  apache2: Syntax error on line 95 of /omd/sites/monitoring/etc/apache/apache.conf: Cannot load /omd/sites/monitoring/lib/apache/modules/mod_mpm_prefork.so into server: /omd/sites/monitoring/lib/apache/modules/mod_mpm_prefork.so: undefined symbol: ap_set_listentcpdeferaccept

Also see https://forum.checkmk.com/t/apache-failed-with-syntax-error/48244
for further user reports about this.

regards
-mika-