Hi. I have used certbot for a few years now.
The issue is that after certbot runs, Apache does not restart for me.
I used a band-aid a few years ago with some setting that would ALWAYS restart Apache immediately after getting shut down - I don't remember where that settings was, though.
A few weeks ago, I updated certbot. Now the issue is back - Apache shuts down sometimes after certbot runs, but it does not come back up.
So far, I have not found a reason for this.
Syslog shows Certbot starting, Apache stopping, and Apache starting.
Letsencrypt log shows it running "systemctl start apache2"
Apache Error log shows SIGTERM, then Apache starting, then immediately another SIGTERM at the same time that Certbot is still working on stuff.
My environment is with Digital Ocean and running Debian 9.6.
I noticed that the letsencrypt logs are owned by root and not accessible by my regular user - is it possible that I installed it wrong and that this could be the issue?
Here are the logs for the time frame:
syslog:
May 18 10:13:05 myserver systemd[1]: Starting Certbot...
May 18 10:13:07 myserver systemd[1]: Stopping The Apache HTTP Server...
May 18 10:13:07 myserver systemd[1]: Stopped The Apache HTTP Server.
May 18 10:13:12 myserver systemd[1]: Starting The Apache HTTP Server...
May 18 10:13:12 myserver apachectl[19772]: httpd (pid 19769) already running
May 18 10:13:12 myserver systemd[1]: Started The Apache HTTP Server.
May 18 10:13:13 myserver systemd[1]: Started Certbot.
May 18 10:13:13 myserver systemd[1]: certbot.timer: Adding 9h 31min 31.742731s random time.
May 18 10:13:13 myserver systemd[1]: certbot.timer: Adding 3h 40min 47.792668s random time.
apache2/error.log:
[Tue May 18 10:13:07.499235 2021] [mpm_prefork:notice] [pid 11519] AH00169: caught SIGTERM, shutting down
[Tue May 18 10:13:12.774131 2021] [mpm_prefork:notice] [pid 19769] AH00163: Apache/2.4.25 (Debian) OpenSSL/1.0.2u configured -- resuming normal operations
[Tue May 18 10:13:12.774224 2021] [core:notice] [pid 19769] AH00094: Command line: '/usr/sbin/apache2'
[Tue May 18 10:13:12.971035 2021] [mpm_prefork:notice] [pid 19769] AH00169: caught SIGTERM, shutting down
letsencrypt.log:
2021-05-18 10:13:12,533:DEBUG:certbot.plugins.storage:Plugin storage file /etc/letsencrypt/.pluginstorage.json was empty, no values loaded
2021-05-18 10:13:12,701:DEBUG:certbot.plugins.selection:Requested authenticator standalone and installer apache
2021-05-18 10:13:12,702:DEBUG:certbot.plugins.selection:Selecting plugin: * apache
Description: Apache Web Server plugin - Beta
Interfaces: IAuthenticator, IInstaller, IPlugin
Entry point: apache = certbot_apache.entrypoint:ENTRYPOINT
Initialized: <certbot_apache.override_debian.DebianConfigurator object at 0x7fdcf6dcf5f8>
Prep: True
2021-05-18 10:13:12,714:INFO:certbot.renewal:Cert not yet due for renewal
2021-05-18 10:13:12,715:DEBUG:certbot.plugins.selection:Requested authenticator standalone and installer apache
2021-05-18 10:13:12,720:DEBUG:certbot.plugins.selection:Selecting plugin: * apache
Description: Apache Web Server plugin - Beta
Interfaces: IAuthenticator, IInstaller, IPlugin
Entry point: apache = certbot_apache.entrypoint:ENTRYPOINT
Initialized: <certbot_apache.override_debian.DebianConfigurator object at 0x7fdcfb2906d8>
2021-05-18 10:13:12,720:DEBUG:certbot.plugins.storage:Plugin storage file /etc/letsencrypt/.pluginstorage.json was empty, no values loaded
2021-05-18 10:13:12,729:INFO:certbot.renewal:Cert not yet due for renewal
2021-05-18 10:13:12,730:DEBUG:certbot.plugins.selection:Requested authenticator standalone and installer apache
2021-05-18 10:13:12,730:DEBUG:certbot.plugins.selection:Selecting plugin: * apache
Description: Apache Web Server plugin - Beta
Interfaces: IAuthenticator, IInstaller, IPlugin
Entry point: apache = certbot_apache.entrypoint:ENTRYPOINT
Initialized: <certbot_apache.override_debian.DebianConfigurator object at 0x7fdcf6de8470>
2021-05-18 10:13:12,730:DEBUG:certbot.plugins.storage:Plugin storage file /etc/letsencrypt/.pluginstorage.json was empty, no values loaded
2021-05-18 10:13:12,730:DEBUG:certbot.renewal:no renewal failures
2021-05-18 10:13:12,731:INFO:certbot.hooks:Running post-hook command: systemctl start apache2
Based on a similar post here that doesn't show a solution ( Certbot causing apache shutdown on debian 9 stretch (SIGTERM) - #7 by Osiris ), I'm adding more data:
crontab -l only shows two unrelated jobs.
sudo crontab -l is empty
systemctl list-timers shows the following timers:
- phpsessionclean.timer
- certbot.timer
- systemd-tmpfiles-clean-timer
- apt-daily.timer
- apt-daily-upgrade.timer
Thanks for any advice you can give me!
EDIT: I found how I force-restart Apache (which doesn't seem to work as planned):
/lib/systemd/system/apache2.service
Restart=on-abort
I may have to set it to "always" if I can't get a hold of this issue.