You are not logged in.

#1 2013-03-15 09:55:02

estol
Member
Registered: 2011-03-04
Posts: 10

[SOLVED] Can't start Apache with systemd

Hey there,

I recently moved my system to systemd, and now I can't start apache. Installed apache, php, php-apache, and mysql for a regular LAMP setup, I ran before. Then copied my configuration file for apache, which worked for years now, on several webservers, and then, when I try to start it with systemctl start httpd, systemd tells me the job failed for httpd.service. then I check systemctl status httpd and I see the following:

httpd.service - Apache Web Server
          Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
          Active: failed (Result: resources) since Fri 2013-03-15 12:40:36 CET; 13s ago
         Process: 21992 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)

Mar 15 12:40:34 Silentium systemd[1]: Starting Apache Web Server...
Mar 15 12:40:35 Silentium systemd[1]: PID file /run/httpd/httpd.pid not readable (yet?) after start.
Mar 15 12:40:36 Silentium systemd[1]: httpd.service never wrote its PID file. Failing.
Mar 15 12:40:36 Silentium systemd[1]: Failed to start Apache Web Server.
Mar 15 12:40:36 Silentium systemd[1]: Unit httpd.service entered failed state

tried chowning the /run/httpd directory to http user and http group - of course, apache is ran by http who is a member of http -, no effect, tried setting it to chmod 777, no effect. When I check the error log for httpd it says:

[Fri Mar 15 12:45:26 2013] [error] (2)No such file or directory: Couldn't bind unix domain socket /var/run/httpd/cgisock.22028
[Fri Mar 15 12:45:26 2013] [error] (2)No such file or directory: could not create /var/run/httpd/httpd.pid
[Fri Mar 15 12:45:26 2013] [error] httpd: could not log pid to file /var/run/httpd/httpd.pid


how can I fix this?

thanks,

estol

Last edited by estol (2013-03-18 14:15:33)

Offline

#2 2013-03-15 15:43:30

KingX
Member
From: CA
Registered: 2010-03-24
Posts: 324

Re: [SOLVED] Can't start Apache with systemd

Workaround would be to create the pid file and then have it owned by the http user/group. Create the file, make sure http can access it restart the service. Should fix it.

touch /var/run/httpd/httpd.pid

Offline

#3 2013-03-15 15:54:24

estol
Member
Registered: 2011-03-04
Posts: 10

Re: [SOLVED] Can't start Apache with systemd

Created the pid file, owned by http:http, tried to start httpd, no effect, same error messages in logs. Set 777 chmod on the pid file, same error message.

[edit]
The strangest thing is, that not only systemctl start httpd does this, but issuing httpd on the shell as well. Might not be systemd?

Last edited by estol (2013-03-15 15:55:50)

Offline

#4 2013-03-18 09:24:04

Base Reef
Member
Registered: 2013-03-18
Posts: 1

Re: [SOLVED] Can't start Apache with systemd

Considering the fact that I didn't have /run/httpd at all, this should help.

# systemctl stop httpd
# rm -r /run/httpd
# mkdir /run/httpd
# systemctl start httpd

Offline

#5 2013-03-18 12:45:09

estol
Member
Registered: 2011-03-04
Posts: 10

Re: [SOLVED] Can't start Apache with systemd

Base Reef wrote:

Considering the fact that I didn't have /run/httpd at all, this should help.

# systemctl stop httpd
# rm -r /run/httpd
# mkdir /run/httpd
# systemctl start httpd

Tried removing /run/httpd and then recreating the directory, No effect, same error message in the log, apache not starting.

Offline

#6 2013-03-18 12:53:21

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: [SOLVED] Can't start Apache with systemd

Is your /var/run symlinked to /run ?

Offline

#7 2013-03-18 14:14:28

estol
Member
Registered: 2011-03-04
Posts: 10

Re: [SOLVED] Can't start Apache with systemd

65kid wrote:

Is your /var/run symlinked to /run ?

No it wasn't.
Moved everything from /var/run to /run, then created /var/run as a symbolic link to /run, now httpd starts fine.

Thanks!

Last edited by estol (2013-03-18 14:15:03)

Offline

#8 2013-03-18 14:16:40

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: [SOLVED] Can't start Apache with systemd

estol wrote:
65kid wrote:

Is your /var/run symlinked to /run ?

No it wasn't.
Moved everything from /var/run to /run, then created /var/run as a symbolic link to /run, now httpd starts fine.

Thanks!

note that /var/lock must also link to /run/lock, in case you missed this as well. See the news from 9 months ago: https://www.archlinux.org/news/filesyst … equired-1/

Last edited by 65kid (2013-03-18 14:17:17)

Offline

#9 2013-03-18 14:20:55

estol
Member
Registered: 2011-03-04
Posts: 10

Re: [SOLVED] Can't start Apache with systemd

65kid wrote:
estol wrote:
65kid wrote:

Is your /var/run symlinked to /run ?

No it wasn't.
Moved everything from /var/run to /run, then created /var/run as a symbolic link to /run, now httpd starts fine.

Thanks!

note that /var/lock must also link to /run/lock, in case you missed this as well. See the news from 9 months ago: https://www.archlinux.org/news/filesyst … equired-1/

/var/lock is already a symbolic. Strange though, since the system was recently installed from the 12.01 installation media, because of the sysvinit deprecation.

Offline

Board footer

Powered by FluxBB