0

I'm facing an odd problem on a Buildroot environment for RPi3. I have this init.d service to start apache2 (version 2.4.57):

# cat /etc/init.d/S50apache 
#!/bin/sh

case "$1" in
  start|restart|graceful|graceful-stop|stop)
    apachectl -k $1
    ;;
  reload)
    apachectl -k restart
    ;;
  *)
    echo "Usage: $0 {start|restart|reload|graceful|graceful-stop|stop}"
    exit 1
esac

exit $?

Often, when I power up the RPi3 I notice the web server is not running. If I try to run the very same command, i.e.:

# apachectl -k start

I get:

httpd (pid 288) already running

but:

# ps aux | grep httpd
  477 root     grep httpd

and:

# ps aux | grep 288
  288 root     /usr/sbin/wpa_supplicant -u
  457 root     grep 288

It seems obvious (unless I'm missing something) that apache2 is not running and the PID 288 is about a completely different service.

In order to start the webserver I have to:

  1. apachectl -k stop -> this actually stops the wpa_supplicant service!
  2. restart the wpa_supplicant service
  3. now apachectl -k start works and the apache2 service runs

Of course this is not acceptable. Furthermore, the machine will be unattended hence I need to fix this issue.

But I first have to understand why it happens. How is it possible it thinks it has a different PID?

1 Answer 1

1

In older Apache servers, there was a bug

stale apache PID files can prevent process from starting #3553

Check under /var/run if there is such a PID file and delete it.

And upgrade your Apache.

3
  • Could you add the version which had this bug? Mine is 2.4.57 and it's quite recent. The last seems 2.4.58 and in the change log I don't see anything related. Commented Oct 25, 2023 at 7:59
  • Patch was released in 2018, so if your apache is recent, this bug should have been patched. Is there a stale PID? Commented Oct 25, 2023 at 8:05
  • I'll check next time it happens Commented Oct 25, 2023 at 8:07

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.