CentOS7-based VPS: Apache can not start on boot

SPQRInc

Member
Jul 27, 2015
57
1
6
I'm facing a strange problem: I got Apache2 installed on my CentOS7-based VPS.

If I reboot the container the httpd does not start:
Code:
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sa 2016-06-11 11:15:40 CEST; 1min 25s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 862 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 290 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 290 (code=exited, status=1/FAILURE)

Jun 11 11:15:40 test.example.org systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jun 11 11:15:40 test.example.org kill[862]: kill: cannot find process ""
Jun 11 11:15:40 test.example.org systemd[1]: httpd.service: control process exited, code=exited status=1
Jun 11 11:15:40 test.example.org systemd[1]: Failed to kill control group: Invalid argument
Jun 11 11:15:40 test.example.org systemd[1]: Failed to kill control group: Invalid argument
Jun 11 11:15:40 test.example.org systemd[1]: Failed to kill control group: Invalid argument
Jun 11 11:15:40 test.example.org systemd[1]: Failed to kill control group: Invalid argument
Jun 11 11:15:40 test.example.org systemd[1]: Failed to start The Apache HTTP Server.
Jun 11 11:15:40 test.example.org systemd[1]: Unit httpd.service entered failed state.
Jun 11 11:15:40 test.example.org systemd[1]: httpd.service failed.

After doing a restart of the service apache works.

What did I miss here?
 
I guess your httpd.service tries to use cgroup related things, which are not available inside the container.
 
Of course:
Code:
[Unit]

Description=The Apache HTTP Server

After=network.target remote-fs.target nss-lookup.target

Documentation=man:httpd(8)

Documentation=man:apachectl(8)


[Service]

Type=notify

EnvironmentFile=/etc/sysconfig/httpd

ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND

ExecReload=/usr/sbin/httpd $OPTIONS -k graceful

ExecStop=/bin/kill -WINCH ${MAINPID}

# We want systemd to give httpd some time to finish gracefully, but still want

# it to kill httpd after TimeoutStopSec if something went wrong during the

# graceful stop. Normally, Systemd sends SIGTERM signal right after the

# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give

# httpd time to finish.

KillSignal=SIGCONT

PrivateTmp=true


[Install]

WantedBy=multi-user.target