Bug#895237: apache2: apachectl does not use systemd for restarts

2018-04-23 Thread Stefan Fritsch
On Sunday, 15 April 2018 21:50:57 CEST Jan Heitkötter wrote:
> The hooks in Let’s Encrypt’s conffile say “apachectl -k”; the manpage
> does not explain this option. Omitting -k makes things work:

options unknown to apachectl are passed to apache2 and apache2 -k start tells 
apache2 to do a normal start and go into the background. But this means that 
the systemd magic that apachectl does for "apachectl start" is not done for 
"apachectl -k start".

Not sure how to fix this. In general, it is not possible to map all options to 
systemd actions. For example, one could do

apachectl -DSOME_CONFIG_DEFINE -k start

to start apache with some special config options. Even worse, "-k start" is 
the default if no other action option (like -k, -t, -l, -L, ...) is given.



Bug#895237: apache2: apachectl does not use systemd for restarts

2018-04-15 Thread Jan Heitkötter
Hallo Stefan,

Am Samstag, den 14.04.2018, 11:50 +0200 schrieb Stefan Fritsch:
> Using apachectl stop / start / restart works fine for me with
> systemd. The 
> issue is somewhere else.

This is what happens here:

root@wolke:/# systemctl status --no-pager apache2
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor
preset: enabled)
   Active: active (running) since Sun 2018-04-15 21:42:42 CEST; 1s ago
  Process: 54785 ExecStop=/usr/sbin/apachectl stop (code=exited,
status=0/SUCCESS)
  Process: 52569 ExecReload=/usr/sbin/apachectl graceful (code=exited,
status=0/SUCCESS)
  Process: 54793 ExecStart=/usr/sbin/apachectl start (code=exited,
status=0/SUCCESS)
 Main PID: 54797 (apache2)
   CGroup: /system.slice/apache2.service
   ├─54797 /usr/sbin/apache2 -k start
   ├─54798 /usr/sbin/apache2 -k start
   ├─54799 /usr/sbin/apache2 -k start
   ├─54800 /usr/sbin/apache2 -k start
   ├─54801 /usr/sbin/apache2 -k start
   └─54802 /usr/sbin/apache2 -k start

Apr 15 21:42:42 wolke systemd[1]: Starting The Apache HTTP Server...
Apr 15 21:42:42 wolke systemd[1]: Started The Apache HTTP Server.
root@wolke:/# apachectl -k stop
root@wolke:/# apachectl -k start
root@wolke:/# systemctl status --no-pager apache2
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor
preset: enabled)
   Active: inactive (dead) since Sun 2018-04-15 21:42:49 CEST; 6s ago
  Process: 54807 ExecStop=/usr/sbin/apachectl stop (code=exited,
status=0/SUCCESS)
  Process: 52569 ExecReload=/usr/sbin/apachectl graceful (code=exited,
status=0/SUCCESS)
  Process: 54793 ExecStart=/usr/sbin/apachectl start (code=exited,
status=0/SUCCESS)
 Main PID: 54797 (code=exited, status=0/SUCCESS)

Apr 15 21:42:42 wolke systemd[1]: Starting The Apache HTTP Server...
Apr 15 21:42:42 wolke systemd[1]: Started The Apache HTTP Server.
Apr 15 21:42:49 wolke apachectl[54807]: httpd (no pid file) not running


The hooks in Let’s Encrypt’s conffile say “apachectl -k”; the manpage
does not explain this option. Omitting -k makes things work:

root@wolke:/# systemctl status --no-pager apache2
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor
preset: enabled)
   Active: active (running) since Sun 2018-04-15 21:46:49 CEST; 1s ago
  Process: 54831 ExecStop=/usr/sbin/apachectl stop (code=exited,
status=0/SUCCESS)
  Process: 52569 ExecReload=/usr/sbin/apachectl graceful (code=exited,
status=0/SUCCESS)
  Process: 54845 ExecStart=/usr/sbin/apachectl start (code=exited,
status=0/SUCCESS)
 Main PID: 54849 (apache2)
   CGroup: /system.slice/apache2.service
   ├─54849 /usr/sbin/apache2 -k start
   ├─54850 /usr/sbin/apache2 -k start
   ├─54851 /usr/sbin/apache2 -k start
   ├─54852 /usr/sbin/apache2 -k start
   ├─54853 /usr/sbin/apache2 -k start
   └─54854 /usr/sbin/apache2 -k start

Apr 15 21:46:49 wolke systemd[1]: Starting The Apache HTTP Server...
Apr 15 21:46:49 wolke systemd[1]: Started The Apache HTTP Server.
root@wolke:/# apachectl stop
root@wolke:/# apachectl start
Invoking 'systemctl start apache2'.
Use 'systemctl status apache2' for more info.
root@wolke:/# systemctl status --no-pager apache2
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor
preset: enabled)
   Active: active (running) since Sun 2018-04-15 21:47:00 CEST; 2s ago
  Process: 54859 ExecStop=/usr/sbin/apachectl stop (code=exited,
status=0/SUCCESS)
  Process: 52569 ExecReload=/usr/sbin/apachectl graceful (code=exited,
status=0/SUCCESS)
  Process: 54870 ExecStart=/usr/sbin/apachectl start (code=exited,
status=0/SUCCESS)
 Main PID: 54874 (apache2)
   CGroup: /system.slice/apache2.service
   ├─54874 /usr/sbin/apache2 -k start
   ├─54875 /usr/sbin/apache2 -k start
   ├─54876 /usr/sbin/apache2 -k start
   ├─54877 /usr/sbin/apache2 -k start
   ├─54878 /usr/sbin/apache2 -k start
   └─54879 /usr/sbin/apache2 -k start

Apr 15 21:47:00 wolke systemd[1]: Starting The Apache HTTP Server...
Apr 15 21:47:00 wolke systemd[1]: Started The Apache HTTP Server.


For the time being I will remove -k from the hooks.

Regards

Jan



Bug#895237: apache2: apachectl does not use systemd for restarts

2018-04-14 Thread Axel Beckert
Hi Stefan,

Stefan Fritsch wrote:
> But I wonder why certbot needs to do stop+start? Would an "apachectl 
> graceful" 
> not be the better option?

Just a guess here:

At least in the past, "apache2ctl graceful" did not work well for me,
if bigger changes with regards to certificates were made, like the old
certificates have been continued to be used.

Usually "service apache2 restart" fixed that well. So I can
understand, why certbot prefers restart over the graceful
configuration reload.

Regards, Axel
-- 
 ,''`.  |  Axel Beckert , https://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-|  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE



Bug#895237: apache2: apachectl does not use systemd for restarts

2018-04-14 Thread Stefan Fritsch
On Thursday, 12 April 2018 11:56:04 CEST Axel Beckert wrote:
> Jan Heitkötter wrote:
> > Default behaviour is do stop/start Apache using apachectl which fails in
> > installations running systemd. Apache will stop, but not start again.

Using apachectl stop / start / restart works fine for me with systemd. The 
issue is somewhere else.

To debug this, error output would be useful. Like what happens when you try to 
start apache again? what does systemctl status apache2.service say afterwards? 
Is there anything in the apache error log? Maybe change apache2ctl to do "set 
-x" at the beginning and show the output.


Harlan Lieberman-Berg wrote:
> Hm, looks like this is actually a bug over in apache-land.  We do the right
> thing for `apachectl start` in terms of wrapping to use systemd, but we
> don't do that during `apachectl restart`.

This is correct behavior: apachectl restart is different from stop+start. 
"apachectl restart" only restarts the child processes, the parent process 
keeps running.
This is different from what init scripts do for "restart", but nobody claims 
that apachectl works the same as init scripts.

But I wonder why certbot needs to do stop+start? Would an "apachectl graceful" 
not be the better option?

> Apache folx, can we potentially just turn restart into a shim that calls
> `apachectl stop` and `apachectl start`?  That will solve the problem with
> the least amount of fuss.



Bug#895237: apache2: apachectl does not use systemd for restarts

2018-04-12 Thread Axel Beckert
Control: retitle -1 apache2: apachectl restarts don't work properly with all 
init systems (namely not with systemd)

Hi,

Jan Heitkötter wrote:
> Default behaviour is do stop/start Apache using apachectl which fails in 
> installations running systemd. Apache will stop, but not start again.

While this is definitely an issue, ...

> Fix: use systemctl to start/stop Apache.

... this is _not_ the solution.

Debian has not only systemd as init system (but at least also
sysvinit, openrc and runit, maybe more) and such actions need to stay
init-system-agnostic, e.g. either use the Debian-specific invoke-rc.d
command or the init-system- and distribution-agnostic "service"
command. Retitling the bug report accordingly.

Regards, Axel
-- 
 ,''`.  |  Axel Beckert , https://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-|  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE



Processed: Re: Bug#895237: apache2: apachectl does not use systemd for restarts

2018-04-12 Thread Debian Bug Tracking System
Processing control commands:

> retitle -1 apache2: apachectl restarts don't work properly with all init 
> systems (namely not with systemd)
Bug #895237 [apache2] apache2: apachectl does not use systemd for restarts
Changed Bug title to 'apache2: apachectl restarts don't work properly with all 
init systems (namely not with systemd)' from 'apache2: apachectl does not use 
systemd for restarts'.

-- 
895237: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895237
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems