4

Does anyone know what can cause this error in Apache's error log (particularly in Arch Linux):

PID file /run/httpd/httpd.pid not readable (yet?) after start.

The error is not stopping Apache from running normally (once it is started), but is potentially slowing down my service restart time significantly.

Any guidance would be appreciated.

Charlie
  • 151
  • 1
  • 1
  • 5
  • (1) does `/run/httpd` exist (and is that where you'd like to put the pid file? (2) is it writable for whatever user apache runs as? – Wrikken Apr 22 '13 at 21:30
  • `/run/httpd` does exist. Apache is running under the user:group http:http but the mode of the pid file is root:root. Why is systemd creating the pid file as root:root? Is there anyway to change this? – Charlie Apr 23 '13 at 14:41
  • Probably, the parent process is running as `root` (unless you actually start apache as the HTTP user instead of as root, see also [the remarks about the User directive here](http://httpd.apache.org/docs/2.2/mod/mpm_common.html#user)). An option is using a more desirable umask (making the pid file readable, yet not writeable by `http`). – Wrikken Apr 23 '13 at 15:30
  • The parent process is running as root, but these lines are in my httpd.conf file: ` User http Group http ` – Charlie Apr 23 '13 at 15:35
  • I don't run archlinux (in Debian I'd put it in `envvars`), but [this question seems to deal with it](http://stackoverflow.com/questions/5477899/changing-umask-of-apache-on-archlinux) (although the suggested editing of a `rd.d` script is something I normally want to avoid). Are your btw _sure_ it slows the starting down? I would think it only delays/blocks the detecting of a start, but apache runs nonetheless. – Wrikken Apr 23 '13 at 16:12
  • I no longer think it's slowing the start up process down. But it is still an error I'd like to get rid of. – Charlie Apr 23 '13 at 18:39

3 Answers3

2

The solution is to adjust the file /usr/lib/tmpfiles.d/apache.conf. The default values are wrong. You have to change this

d /run/httpd 0755 root root -

to

d /run/httpd 0755 http http -

.

After restarting apache the PID file will be created with chown http:http and not chown root:root.

Ressources:

rumpelsepp
  • 103
  • 10
1

My take is that this bug is a feature: Nothing I've done has been able to get rid of it (tried everything suggested here and then some) yet the software runs just fine. So, I take it as a slightly mis-written success message - I've started!

Richard T
  • 4,570
  • 5
  • 37
  • 49
0

I have met this issue:

PID file *.pid not readable (yet?) after start.

Recent days, my apache server was compiling from the package-issued version is httpd-2.4.12.tar.gz. Here is my httpd.service contents, following this my problem got fixed. Hope this can help anyone who have met this.

[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
ExecStart=/usr/local/apache/bin/apachectl start -DFOREGROUND
PIDFile=/run/apache/apache.pid
ExecReload=/usr/local/apache/bin/apachectl restart
ExecStop=/user/local/apache/bin/apachectl stop
PrivateTmp=True

[Install]
WantedBy=multi-user.target
Wtower
  • 18,848
  • 11
  • 103
  • 80
  • 1
    When you start a process in the foreground, you should use `Type=simple`. Furthermore, `PIDFile` is not required. – rumpelsepp Mar 29 '16 at 08:19