Can't restart Apache after droplet reboot

October 31, 2019 142 views
Apache

Forgive me if I am missing something obvious - I set my site up a year ago, and have not touched it for nearly 9 months. I’ll admit I’m struggling a bit to remember how everything works.

DigitalOcean emailed me to say my droplet had been rebooted. I checked my website and could not load it. I could not even connect to the server via SSH, so I power cycled the droplet. This fixed my terminal access issue, but now that I’m in there, I can’t get Apache to restart. I’ve checked the logs, as the system suggested (see below), but I’m still at a loss to what the actual issue is.

To the best of my knowledge, the site was working properly prior to the reboot. No other changes have been made. Has anyone else had this issue? If so, how did you resolve it? Thanks!

xx@enorugby:~$ sudo systemctl restart apache2
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.

xx@enorugby:~$ systemctl status apache2.service
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Thu 2019-10-31 20:55:19 UTC; 27s ago
  Process: 2865 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

xx@enorugby:~$ journalctl -xe
Hint: You are currently not seeing messages from other users and the system.
      Users in groups 'adm', 'systemd-journal' can see all messages.
      Pass -q to turn off this notice.
--
-- Unit UNIT has finished starting up.
--
-- The start-up result is RESULT.
Oct 31 20:44:15 enorugby.com systemd[1600]: Reached target Basic System.
-- Subject: Unit UNIT has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit UNIT has finished starting up.
--
-- The start-up result is RESULT.
Oct 31 20:44:15 enorugby.com systemd[1600]: Reached target Default.
-- Subject: Unit UNIT has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit UNIT has finished starting up.
--
-- The start-up result is RESULT.
Oct 31 20:44:15 enorugby.com systemd[1600]: Startup finished in 71ms.
-- Subject: User manager start-up is now complete
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The user manager instance for user 1000 has been started. All services queued for starting have been started. Note that other services might still be starting up or be started at any later time.
--
-- Startup of the manager took 71934 microseconds.
2 Answers

TL;DR - For anyone who has this issue in the future, I resolved it by stopping nginx. I do not know why it was running in the first place, as I do not use it, but perhaps it started up automatically when my droplet was rebooted.

@KDSys - thank you for your response! I tried your suggestion, but it did not recognize “fullstatus”. I am using Ubuntu 18.04. (I tried with and without “sudo”, just in case…)

xx@enorugby:~$ sudo systemctl fullstatus apache2.service
Unknown operation fullstatus.

I tried to restart Apache again today, to see if it would magically work… It did not work, but it did give me a different error in the status this time:

xx@enorugby:~$ sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Sat 2019-11-02 01:49:11 UTC; 4min 34s ago
  Process: 27472 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Nov 02 01:49:10 enorugby.com systemd[1]: Starting The Apache HTTP Server...
Nov 02 01:49:11 enorugby.com apachectl[27472]: (98)Address already in use: AH00072: make_sock: could not bind to address 142.93.205.0:80
Nov 02 01:49:11 enorugby.com apachectl[27472]: no listening sockets available, shutting down
Nov 02 01:49:11 enorugby.com apachectl[27472]: AH00015: Unable to open logs
Nov 02 01:49:11 enorugby.com apachectl[27472]: Action 'start' failed.
Nov 02 01:49:11 enorugby.com apachectl[27472]: The Apache error log may have more information.
Nov 02 01:49:11 enorugby.com systemd[1]: apache2.service: Control process exited, code=exited status=1
Nov 02 01:49:11 enorugby.com systemd[1]: apache2.service: Failed with result 'exit-code'.
Nov 02 01:49:11 enorugby.com systemd[1]: Failed to start The Apache HTTP Server.

I googled “(98)Address already in use: …” and that led me to this thread: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80 - error

I stopped Nginx (“sudo systemctl stop nginx”), and then I was able to start Apache with no issues.

  • Hi @boredomisagift,

    I see, thank you for sharing the output.

    If you are not going to use Nginx though, I’ll recommend you to remove it as another reboot will lead to the same thing.

Hi @boredomisagift,

Unfortunately, the journalctl output you’ve provided doesn’t actually say anything about Apache.

Can you please try and execute

systemctl fullstatus apache2.service

It should show more information about why it failed to start.

As for the information in journal, when you run

journalctl -xe

It opens a windows such as after using the less command,meaning if you type

/apache2

It should find for you the apache2 lines which will let you see the exact error.

Regards,
KDSys

Have another answer? Share your knowledge.