Package: apache2
Version: 2.4.10-10+deb8u4
Severity: important

Dear Maintainer,

On Debian systems running SystemD we've noticed that systemd-sysv-generator
generates an incorrect service file, which causes systemctl to report
incorrect service status.

This bugreport is identical to a similar report I've submitted for unbound.
For information please see: 
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=807132

Normal operation:

# systemctl status apache2
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
   Active: active (running) since Wed 2016-01-27 13:32:00 CET; 4 months 19 days 
ago
  Process: 24838 ExecReload=/etc/init.d/apache2 reload (code=exited, 
status=0/SUCCESS)
   CGroup: /system.slice/apache2.service

We now kill apache2, verify no processes are running, and ask systemd for a 
status:

# killall -9 /usr/sbin/apache2
# ps -aux | grep apache | grep -v root
# systemctl status apache2                  
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
   Active: active (exited) since Wed 2016-01-27 13:32:00 CET; 4 months 19 days 
ago
  Process: 24838 ExecReload=/etc/init.d/apache2 reload (code=exited, 
status=0/SUCCESS)

It says "active (exited)". It is clearly not only exited, it is not active 
either. 
Asking systemd to start the service has no effect:

# systemctl start apache2 
# ps -aux | grep apache | grep -v root

Only stopping and starting and/or 'restart' works to resolve the issue.

Implemeting this override in SystemD seems to resolve the issue:

Create file:
/etc/systemd/system/apache2.service.d/sysv-generator-overrides.conf

with the following content:

[Service]
Type=forking
PIDFile=/var/run/apache2/apache2.pid
RemainAfterExit=no
Restart=on-failure

Then run systemctl daemon-reload

The issue is now resolved:

Normal operation:

# systemctl status apache2
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
  Drop-In: /etc/systemd/system/apache2.service.d
           └─sysv-generator-overrides.conf
   Active: active (running) since Thu 2016-06-16 09:56:28 CEST; 16min ago

We now kill apache2, verify no processes are running, and ask systemd for a 
status:

# killall -9 /usr/sbin/apache2
# ps -aux | grep apache | grep -v root
# systemctl status apache2                  

# systemctl status apache2
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
  Drop-In: /etc/systemd/system/apache2.service.d
           └─sysv-generator-overrides.conf
   Active: failed (Result: start-limit) since Thu 2016-06-16 10:13:13 CEST; 2s 
ago

I believe this bug is important, because the incorrect status report by 
systemctl causes monitoring tools
to beeing misled. e.g. tools like Puppet use systemctl to verify service 
status. A puppet manifest
to ensure Apache is running has no effect, because Puppet relies on systemd.

-- Package-specific info:

-- System Information:
Debian Release: 8.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/12 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages apache2 depends on:
ii  apache2-bin    2.4.10-10+deb8u4
ii  apache2-data   2.4.10-10+deb8u4
ii  apache2-utils  2.4.10-10+deb8u4
ii  dpkg           1.17.27
ii  lsb-base       4.1+Debian13+nmu1
ii  mime-support   3.58
ii  perl           5.20.2-3+deb8u5
ii  procps         2:3.3.9-9

Versions of packages apache2 recommends:
ii  ssl-cert  1.0.35

Versions of packages apache2 suggests:
pn  apache2-doc                                      <none>
pn  apache2-suexec-pristine | apache2-suexec-custom  <none>
pn  www-browser                                      <none>

Versions of packages apache2-bin depends on:
ii  libapr1                  1.5.1-3
ii  libaprutil1              1.5.4-1
ii  libaprutil1-dbd-sqlite3  1.5.4-1
ii  libaprutil1-ldap         1.5.4-1
ii  libc6                    2.19-18+deb8u4
ii  libldap-2.4-2            2.4.40+dfsg-1+deb8u2
ii  liblua5.1-0              5.1.5-7.1
ii  libpcre3                 2:8.35-3.3+deb8u4
ii  libssl1.0.0              1.0.1t-1+deb8u2
ii  libxml2                  2.9.1+dfsg1-5+deb8u2
ii  perl                     5.20.2-3+deb8u5
ii  zlib1g                   1:1.2.8.dfsg-2+b1

Versions of packages apache2-bin suggests:
pn  apache2-doc                                      <none>
pn  apache2-suexec-pristine | apache2-suexec-custom  <none>
pn  www-browser                                      <none>

Versions of packages apache2 is related to:
ii  apache2      2.4.10-10+deb8u4
ii  apache2-bin  2.4.10-10+deb8u4

-- Configuration Files:
/etc/apache2/apache2.conf changed [not included]
/etc/apache2/mods-available/mpm_event.conf changed [not included]
/etc/apache2/mods-available/ssl.conf changed [not included]
/etc/apache2/mods-available/status.conf changed [not included]

-- debconf-show failed

Reply via email to