apache2 apache-htcacheclean do not source /etc/default/apache-htcacheclean

Bug #1691495 reported by Baptiste Lafontaine on 2017-05-17
This bug affects 2 people
Affects Status Importance Assigned to Milestone
apache2 (Ubuntu)

Bug Description


On ubuntu 16.04.2, with 2.4.18-2ubuntu3.2

Apache2 apache-htcache clean service init script define some config values:

# Default values. Edit /etc/default/apache-htcacheclean to change these

But the file /etc/default/apache-htcacheclean is not sourced in the file, so any change to the default configuration is not possible.

Adding ". /etc/default/apache-htcacheclean" just before allows to change the values.

Joshua Powers (powersj) wrote :

Hi and thanks for the bug report.

Can you state more clearly what files you are editing? I am not sure I followed each step you took; for example, where did you add ". /etc/default/apache-htcacheclean" to?

If I look at /etc/cron.daily/apache2 it has that command already.

Changed in apache2 (Ubuntu):
status: New → Incomplete
Baptiste Lafontaine (magnetik) wrote :

Sorry it was indeed not clear.

It is the file /etc/init.d/apache-htaccess that should (IMO) source the /etc/default/apache-htcacheclean file.

Joshua Powers (powersj) wrote :

Thanks for the clarification!

Changed in apache2 (Ubuntu):
status: Incomplete → Confirmed
importance: Undecided → High
Rene Fragoso (ctrlrsf) wrote :

Actually what looks to be happening is that /etc/default/apache-htcacheclean is being included/sourced after DAEMON_ARGS has already been set. The init script sets some HTCACHECLEAN_* variables, then DAEMON_ARGS, and then eventually /etc/default/apache-htcacheclean is sourced. However, DAEMON_ARGS is never reset using the newly sourced ENV vars so they're never used (see bash -x debug output below).

As a workaround, instead of changing init script, you can also add DAEMON_ARGS to bottom of your /etc/default/apache-htcacheclean. Here's my DAEMON_ARGS, which I took directly from the init script:

    -P$PIDFILE -i \

Snippet of bash -x /etc/init.d/apache-htcacheclean start:
+++ HTCACHECLEAN_PATH=/var/cache/apache2/mod_cache_disk
+++ PIDDIR=/var/run/apache2/www-data
+++ PIDFILE=/var/run/apache2/www-data/apache-htcacheclean.pid
+++ DAEMON_ARGS='-n -d120 -P/var/run/apache2/www-data/apache-htcacheclean.pid -i -p/var/cache/apache2/mod_cache_disk -l300M'
++ NAME=apache-htcacheclean
++ DESC='Apache htcacheclean'
++ '[' none = /var/run/apache2/www-data/apache-htcacheclean.pid ']'
++ '[' -z /var/run/apache2/www-data/apache-htcacheclean.pid ']'
++ '[' none '!=' /usr/bin/htcacheclean ']'
++ '[' '!' -x /usr/bin/htcacheclean ']'
++ '[' -r /etc/default/apache-htcacheclean ']'
++ . /etc/default/apache-htcacheclean
+++ HTCACHECLEAN_PATH=/dev/shm/htcache
++ . /lib/init/vars.sh
++ echo ' * Starting Apache htcacheclean' apache-htcacheclean
 * Starting Apache htcacheclean apache-htcacheclean
++ COL=
++ call do_start_cmd
++ cmd=do_start_cmd
++ shift
++ is_call_implemented do_start_cmd_override
++ command -V do_start_cmd_override
++ do_start_cmd_override
++ start-stop-daemon --start --quiet --pidfile /var/run/apache2/www-data/apache-htcacheclean.pid -u www-data --startas /usr/bin/htcacheclean --name htcacheclean --test

(DAEMON_ARGS is never changed and it has the arguments to start the daemon)

$ dpkg -l | grep apache2
ii apache2 2.4.18-2ubuntu3.4 amd64 Apache HTTP Server
ii apache2-bin 2.4.18-2ubuntu3.4 amd64 Apache HTTP Server (modules and other binary files)
ii apache2-data 2.4.18-2ubuntu3.4 all Apache HTTP Server (common files)
ii apache2-utils 2.4.18-2ubuntu3.4 amd64 Apache HTTP Server (utility programs for web servers)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers