Package: collectd
Version: 5.1.0-2
Severity: normal

Hello there,

collectd fails to upgrade when it is disabled by /etc/default/collectd,
see the following abridged transcript:

$ grep ^DISABLE /etc/default/collectd 
DISABLE=1
# aptitude # using the TUI
[...]
Preparing to replace collectd-core 5.1.0-1 (using 
.../collectd-core_5.1.0-2_amd64.deb) ...
Stopping statistics collection and monitoring daemon: collectd.
Unpacking replacement collectd-core ...
Preparing to replace collectd 5.1.0-1 (using .../collectd_5.1.0-2_amd64.deb) ...
Unpacking replacement collectd ...
Preparing to replace collectd-dev 5.1.0-1 (using 
.../collectd-dev_5.1.0-2_all.deb) ...
Unpacking replacement collectd-dev ...
Preparing to replace libcollectdclient0 5.1.0-1 (using 
.../libcollectdclient0_5.1.0-2_amd64.deb) ...
Unpacking replacement libcollectdclient0 ...
Preparing to replace collectd-utils 5.1.0-1 (using 
.../collectd-utils_5.1.0-2_amd64.deb) ...
Unpacking replacement collectd-utils ...
[...]
Setting up collectd-core (5.1.0-2) ...
Installing new version of config file /etc/init.d/collectd ...
[warn] Not starting statistics collection and monitoring daemon, disabled by 
/etc/default/collectd. ... (warning).
Setting up libcollectdclient0 (5.1.0-2) ...
Setting up collectd-utils (5.1.0-2) ...
[...]
Setting up collectd (5.1.0-2) ...
[....] Restarting statistics collection and monitoring daemon: collectd 
disabled by /etc/default/collectdinvoke-rc.d: initscript collectd, action 
"restart" failed.
dpkg: error processing collectd (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up collectd-dev (5.1.0-2) ...
[...]
Errors were encountered while processing:
 collectd
E: Sub-process /usr/bin/dpkg returned an error code (1)                         
                                                           
A package failed to install.  Trying to recover:
Setting up collectd (5.1.0-2) ...
[....] Restarting statistics collection and monitoring daemon: collectd 
disabled by /etc/default/collectdinvoke-rc.d: initscript collectd, action 
"restart" failed.
dpkg: error processing collectd (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 collectd
Press Return to continue.

This is due to its postinst calling invoke-rc.d with restart, but the
initscript doesn't special case "restart" as it does with "start", see
the following excerpts from the initscripts (nl -ba /etc/init.d/collectd):

    53  if test "$DISABLE" != 0 -a "$1" == "start"; then
    54          log_warning_msg "Not starting $DESC, disabled by 
/etc/default/$NAME."
    55          exit 0
    56  fi
    57  
    58  if test ! -e "$CONFIGFILE" -a "$1" == "start"; then
    59          log_warning_msg "Not starting $DESC, no configuration 
($CONFIGFILE) found."
    60          exit 0
    61  fi

Instead, "restart" triggers

    79  d_start() {
    80          if test "$DISABLE" != 0; then
    81                  # we get here during restart
    82                  log_progress_msg "disabled by /etc/default/$NAME"
    83                  return 2
    84          fi
    85
    86          if test ! -e "$CONFIGFILE"; then
    87                  # we get here during restart
    88                  log_progress_msg "disabled, no configuration 
($CONFIGFILE) found"
    89                  return 2
    90          fi
   [...]
   108  }
via
   164          restart|force-reload)
   165                  log_daemon_msg "Restarting $DESC" "$NAME"
   166                  check_config
   167                  rc="$?"
   168                  if test "$rc" -eq 1; then
   169                          log_progress_msg "not restarting, configuration 
error"
   170                          log_end_msg 1
   171                          exit 1
   172                  fi
   173                  d_stop
   174                  rc="$?"
   175                  case "$rc" in
   176                          0|1)
   177                                  sleep 1
   178                                  d_start
   179                                  rc2="$?"
   180                                  case "$rc2" in
   181                                          0) log_end_msg 0 ;;
   182                                          *) log_end_msg 1 ;;
   183                                  esac
   184                                  ;;
   185                          *)
   186                                  log_end_msg 1
   187                                  ;;
   188                  esac
   189                  ;;

and consequently fails with "log_end_msg 1" due to the "return 2" in d_start.

For now I temporarily patched line 53 to special case "restart" instead
and finished package installation via "dpkg --configure -a", but this or
just adding "restart" and "force-reload" OR'ed to the test won't do as a
general solution.

Hmm, the initscript already acknowledges that "restart" might encounter
the "return 2" in lines 80-90. I feel like I'm filing to grasp some
intention here, so I'm at a loss at how to best fix this ...

I was tempted to file this bug at a higher severity (due to breaking
package upgrade), but somehow couldn't find a corresponding policy
paragraph to quote, so just filing at normal now. FWIW, it just affects
a most probably not-so-common usecase of carrying around a disabled
program.

Cheers,
Flo

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing'), (50, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages collectd depends on:
ii  collectd-core  5.1.0-2
ii  iptables       1.4.14-2
ii  libc6          2.13-33
ii  librrd4        1.4.7-1

Versions of packages collectd recommends:
ii  libc6               2.13-33
ii  libcurl3-gnutls     7.26.0-1
ii  libdbi1             0.8.4-6
ii  libdbus-1-3         1.6.0-1
pn  libesmtp6           <none>
ii  libgcrypt11         1.5.0-3
ii  libgdk-pixbuf2.0-0  2.26.1-1
ii  libglib2.0-0        2.32.3-1
pn  libhal1             <none>
ii  libmemcached10      1.0.8-1
pn  libmodbus5          <none>
ii  libmysqlclient18    5.5.24+dfsg-4
ii  libnotify4          0.7.5-1
ii  libopenipmi0        2.0.16-1.3
pn  liboping0           <none>
ii  libpcap0.8          1.3.0-1
ii  libperl5.14         5.14.2-12
ii  libpq5              9.1.4-2
pn  libprotobuf-c0      <none>
ii  libpython2.7        2.7.3~rc2-2.1
pn  librabbitmq0        <none>
ii  librrd4             1.4.7-1
ii  libsensors4         1:3.3.2-2
ii  libsnmp15           5.4.3~dfsg-2.5
ii  libssl1.0.0         1.0.1c-3
pn  libtokyotyrant3     <none>
pn  libupsclient1       <none>
pn  libvarnishapi1      <none>
ii  libvirt0            0.9.12-3
ii  libxml2             2.8.0+dfsg1-4
ii  libyajl2            2.0.4-2

collectd suggests no packages.

-- no debconf information

Attachment: signature.asc
Description: Digital signature

Reply via email to