1

I've just upgrade my system from 16.04 to 18.04. Since then, apache2 is not starting, but not putting any error message anywhere (where I can find it).

Status immediately after boot:

# systemctl status apache2
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; static; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
       └─apache2-systemd.conf
   Active: inactive (dead)
 Docs: man:systemd-sysv-generator(8)

If I start apache2 manually again, it takes about 5 minutes, and then I get a timout error from systemd:

# systemctl status apache2
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; static; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: timeout) since Sun 2020-06-28 17:48:00 CEST; 1min 2s
     Docs: man:systemd-sysv-generator(8)
  Process: 1912 ExecStart=/etc/init.d/apache2 start (code=killed, signal=TERM)
    Tasks: 0 (limit: 4915)
   CGroup: /system.slice/apache2.service

Jun 28 17:43:00 server apache2[1912]:  * Starting Apache httpd web server apa
Jun 28 17:43:00 server apache2[1912]: Invoking 'systemctl start apache2'.
Jun 28 17:43:00 server apache2[1912]: Use 'systemctl status apache2' for more
Jun 28 17:48:00 server systemd[1]: apache2.service: Start operation timed out
Jun 28 17:48:00 server systemd[1]: apache2.service: Failed with result 'timeo
Jun 28 17:48:00 server systemd[1]: Failed to start LSB: Apache2 web server.
Jun 28 17:48:00 server apache2[1912]: Job for apache2.service failed because
Jun 28 17:48:00 server apache2[1912]: See "systemctl status apache2.service"
Jun 28 17:48:00 server apache2[1912]: Action 'start' failed.
Jun 28 17:48:00 server apache2[1912]: The Apache error log may have more info

No apache2 log is written to.

Config syntax still appears to be ok:

# apache2ctl -t
Syntax OK

Ports 80 and 443 are not occupied:

# netstat -tlpne | egrep ':(80|443)'
root@server:/var/www#

I tried Debug LogLevel, but that didn't change anything.

Finally, I tried strace, but the output doesn't really help me:

[lotsofstuffandthen]
[pid  3956] openat(AT_FDCWD, "/run/systemd/ask-password", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 6
[pid  3956] fstat(6, {st_mode=S_IFDIR|0755, st_size=40, ...}) = 0
[pid  3956] getdents(6, /* 2 entries */, 32768) = 48
[pid  3956] getdents(6, /* 0 entries */, 32768) = 0
[pid  3956] close(6)                    = 0
[pid  3956] poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}], 2, -1

And there it hangs for 5 mins, until:

[pid  3956] poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}], 2, -1 <unfinished ...>
[pid  3954] <... ppoll resumed> )       = 1 ([{fd=3, revents=POLLIN}])
[pid  3954] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\4\1\1\251\2\0\0\n\0\0\0\276\0\0\0\1\1o\0000\0\0\0", iov_len=24}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 24
[pid  3954] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="/org/freedesktop/systemd1/unit/a"..., iov_len=865}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 865
[pid  3954] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\4\1\1L\3\0\0\v\0\0\0\276\0\0\0\1\1o\0000\0\0\0", iov_len=24}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 24
[pid  3954] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="/org/freedesktop/systemd1/unit/a"..., iov_len=1028}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 1028
[pid  3954] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\4\1\1L\0\0\0\f\0\0\0\246\0\0\0\1\1o\0\31\0\0\0", iov_len=24}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 24
[pid  3954] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="/org/freedesktop/systemd1\0\0\0\0\0\0\0"..., iov_len=236}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 236
[pid  3954] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\4\1\1K\0\0\0\r\0\0\0\242\0\0\0\1\1o\0\31\0\0\0", iov_len=24}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 24
[pid  3954] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="/org/freedesktop/systemd1\0\0\0\0\0\0\0"..., iov_len=235}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 235
[pid  3954] sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\1\4\0013\0\0\0\4\0\0\0\250\0\0\0\1\1o\0000\0\0\0/org/fre"..., iov_len=184}, {iov_base=" \0\0\0org.freedesktop.systemd1.Ser"..., iov_len=51}], msg_iovlen=2, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 235
[pid  3954] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\4\1\1\251\2\0\0\16\0\0\0\276\0\0\0\1\1o\0000\0\0\0", iov_len=24}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 24
[pid  3954] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="/org/freedesktop/systemd1/unit/a"..., iov_len=865}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 865
[pid  3954] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\4\1\1\34\3\0\0\17\0\0\0\276\0\0\0\1\1o\0000\0\0\0", iov_len=24}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 24
[pid  3954] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="/org/freedesktop/systemd1/unit/a"..., iov_len=980}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 980
[pid  3954] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\2\1\1\20\0\0\0\20\0\0\0007\0\0\0\5\1u\0\4\0\0\0", iov_len=24}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 24
[pid  3954] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\7\1s\0\30\0\0\0org.freedesktop.systemd1"..., iov_len=64}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_NOSIGNAL|MSG_CMSG_CLOEXEC) = 64
[pid  3954] writev(2, [{iov_base="Job for apache2.service failed b"..., iov_len=62}, {iov_base="\n", iov_len=1}], 2Job for apache2.service failed because a timeout was exceeded.
) = 63
[pid  3954] writev(2, [{iov_base="See \"systemctl status apache2.se"..., iov_len=72}, {iov_base="\n", iov_len=1}], 2See "systemctl status apache2.service" and "journalctl -xe" for details.
) = 73
[pid  3954] close(3)                    = 0
[pid  3954] kill(3956, SIGTERM <unfinished ...>
[pid  3956] <... poll resumed> )        = 1 ([{fd=5, revents=POLLIN}])
[pid  3954] <... kill resumed> )        = 0
[pid  3956] close(3 <unfinished ...>
[pid  3954] kill(3956, SIGCONT <unfinished ...>
[pid  3956] <... close resumed> )       = 0
[pid  3954] <... kill resumed> )        = 0
[pid  3956] --- SIGCONT {si_signo=SIGCONT, si_code=SI_USER, si_pid=3954, si_uid=0} ---
[pid  3954] waitid(P_PID, 3956,  <unfinished ...>
[pid  3956] close(5)                    = 0
[pid  3956] close(4)                    = 0
[pid  3956] exit_group(0)               = ?
[pid  3956] +++ exited with 0 +++
[pid  3954] <... waitid resumed> {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3956, si_uid=0, si_status=0, si_utime=0, si_stime=0}, WEXITED, NULL) = 0
[pid  3954] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3956, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
[pid  3954] exit_group(1)               = ?
[pid  3954] +++ exited with 1 +++
<... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 3954
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3954, si_uid=0, si_status=1, si_utime=0, si_stime=0} ---
rt_sigreturn({mask=[]})                 = 3954
write(1, "Action 'start' failed.\n", 23Action 'start' failed.
) = 23
write(1, "The Apache error log may have mo"..., 48The Apache error log may have more information.
) = 48
exit_group(1)                           = ?
+++ exited with 1 +++

Any hints on how I could approach debugging why apache isn't starting would be highly appreciated.

Edit: Disabling all my sites in the configuration doesn't help. Neither does it to purge and reinstall apache2.

2
  • 1
    Do you have hard disk encryption or SSL certificate passphrases in your system?
    – FedKad
    Jun 28, 2020 at 16:32
  • No disk encryption, and the certificates that apache is meant to use are from letsencrypt, no passphrases.
    – i3i5i7
    Jun 29, 2020 at 5:54

1 Answer 1

0

The mistake is that the apache2.service is not completely removed from systemd. The upgrade assumes that this is not necessary. Ubuntu 16.04 showed this :

[email protected]:~# systemctl -a | grep apache2
  apache2.service                                                               
loaded    active   running   LSB: Apache HTTP Server
[email protected]:~#

On a fresh installed Ubuntu 18.04 I instead got this :

[email protected]:~# systemctl -a | grep apache2
  apache2.service                                                               
loaded    active   running   The Apache HTTP Server                             
[email protected]:~# 

So if you have thrown away all the apache2 packages you should not forget to discard the old apache2.service service file as well.

This goes as follows:

How to remove systemd services Jul 6 '15 https://superuser.com/questions/513159/how-to-remove-systemd-services

"My recipe for service obliteration (be careful with the rm statements!)"

systemctl stop [servicename]
systemctl disable [servicename]
rm /etc/systemd/system/[servicename]
rm /etc/systemd/system/[servicename] # and symlinks that might be related
rm /usr/lib/systemd/system/[servicename] 
rm /usr/lib/systemd/system/[servicename] # and symlinks that might be related
systemctl daemon-reload
systemctl reset-failed

"It is possible that the systemd service 'wraps' the old style scripts in etc/init.d, so you may want to clean that up too, but that is not where systemd services live."

After removal of apache2.service from systemd, you can just run : apt install apache2 , which finishes succesfully with

[email protected]:~# systemctl -a | grep apache2
  apache2.service                                                               
loaded    active   running   The Apache HTTP Server                             
[email protected]:~# 

and the welcome index.html page

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .