Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 389965 - www-servers/apache-2.2.21 restart initscript issue
Summary: www-servers/apache-2.2.21 restart initscript issue
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal minor with 5 votes (vote)
Assignee: Apache Team - Bugzilla Reports
: 396173 (view as bug list)
Depends on:
Reported: 2011-11-09 14:04 UTC by Gerrit Helm
Modified: 2012-04-03 07:44 UTC (History)
11 users (show)

See Also:
Package list:
Runtime testing required: ---

emerge --info (emerge_info,4.16 KB, text/plain)
2011-11-09 14:04 UTC, Gerrit Helm
Diff for /etc/init.d/apache2 (apache-init.diff,408 bytes, patch)
2011-11-19 07:28 UTC, Sok Ann Yap
Details | Diff
Diff for apach2.initd (apache2.patch,458 bytes, patch)
2012-04-03 07:42 UTC, Oleg Muraviov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gerrit Helm 2011-11-09 14:04:58 UTC
Created attachment 292021 [details]
emerge --info


apache2.2.21 got an issue in its latest init.d script regarding the restart function.

server ~ # /etc/init.d/apache2 restart
 * Caching service dependencies ...                          [ ok ]
 * Stopping apache2 ...                                      [ ok ]
 * Starting apache2 ...
 * start-stop-daemon: /usr/sbin/apache2 is already running   [ ok ]

It boils down to this line in the initscript:

 78         start-stop-daemon --start -- ${APACHE2} ${APACHE2_OPTS} -k start

If I change it to '${APACHE2} ${APACHE2_OPTS} -k start' it works as expected.
Comment 1 Toei Rei 2011-11-17 06:41:24 UTC
confirmed. My workaround is stopping apache, waiting a second or two and then starting it...
Comment 2 Sok Ann Yap 2011-11-19 07:28:40 UTC
Created attachment 293073 [details, diff]
Diff for /etc/init.d/apache2

The while loop condition in stop() was wrong. The loop should continue as long as the PID file still exist, the apache2 PID is still running, and the timeout value hasn't been exceeded yet.
Comment 3 Marcel Partap 2011-11-22 19:20:19 UTC
(In reply to comment #2)
> Created attachment 293073 [details, diff] [details, diff]
> Diff for /etc/init.d/apache2
Comment 4 Steve Dibb (RETIRED) gentoo-dev 2011-12-02 19:34:19 UTC
We also have a workaround in bug 388009, but I'm honestly not sure which one is best to apply.
Comment 5 Adrian 2012-01-14 18:52:02 UTC
That bug is there for months now and there's still no fix for it in portage..
Comment 6 Gerrit Helm 2012-01-14 19:34:28 UTC
The fix from Sok Ann Yap is definately the right one.
Hey Apache Maintainers, please apply the Patch to Portage!

Thank you..
Comment 7 Gerald 2012-02-11 17:34:10 UTC
The fix from Sok Ann Yap works perfectly and changes only a single line by 2 characters. Given this complexity, I guess we can expect to get this patch through QA by 2014 at the latest and into portage by 2017.
Comment 8 Gerrit Helm 2012-03-06 09:21:21 UTC
Comment 9 Tomas Hofman 2012-03-06 11:33:21 UTC
Yes, patch from Sok Ann Yap is working perfectly. Apache Maintainers, please apply it into Portage! I think you have enough time to prove it in last 4 months...
Comment 10 William Waisse 2012-03-11 14:48:41 UTC
same problem here, same fix, initscript not working is an important problem, should have been fixed very fast, problem still here 3 months later . . .
Comment 11 Dustin C. Hatch 2012-03-13 04:44:49 UTC
+1 Had this problem, removed the ! on line 105, problem solved...
Comment 12 Ronny Multrus 2012-03-16 09:22:50 UTC
(In reply to comment #2)
> Created attachment 293073 [details, diff] [details, diff]
> Diff for /etc/init.d/apache2

The patch works great, thank you!

Why can't this small change be applied to portage?
Comment 13 Dirkjan Ochtman (RETIRED) gentoo-dev 2012-03-19 16:27:58 UTC
*** Bug 396173 has been marked as a duplicate of this bug. ***
Comment 14 Dirkjan Ochtman (RETIRED) gentoo-dev 2012-03-19 16:28:48 UTC
pva/apache maintainers, could this please get fixed? It's pretty annoying. Or just +1 and I'll just commit the patch to all init scripts for you.
Comment 15 Patrick Lauer gentoo-dev 2012-03-28 15:05:38 UTC
+  28 Mar 2012; Patrick Lauer <> +apache-2.2.22.ebuild:
+  Bump for #401761. init script fix for #389965
Comment 16 Oleg Muraviov 2012-04-03 07:42:18 UTC
Created attachment 307589 [details, diff]
Diff for apach2.initd

Still getting this problem.
"test -f "${PIDFILE}" is false but "pgrep -P ${PID} apache2" still shows some apache processes.
I think it's better to use only "pgrep -P ${PID} apache2" as condition in init.d/apache2:105

Here is my diff