[Pkg-puppet-devel] Bug#709417: mcollective: MCollective daemon inherits dpkg environment when restarted in postinst

Zdenek Crha zdenek.crha at gmail.com
Thu May 23 07:18:33 UTC 2013


Package: mcollective
Version: 2.0.0+dfsg-2
Severity: normal

When mcollective daemon is configured to start automatically, it is restarted
on each
package upgrade or reconfiguration. During this restart, it inherits dpkg and
debconf
internal variables in environment:

root at zcrha:~# dpkg-reconfigure mcollective
root at zcrha:~# ps -ef | grep mcoll
root     30700     1  0 08:59 ?        00:00:00 ruby /usr/sbin/mcollectived
--config=/etc/mcollective/server.cfg --pid=/var/run/mcollective.pid
root     30706 22582  0 08:59 pts/14   00:00:00 grep mcoll
root at zcrha:~# cat /proc/30700/environ
MAIL=/var/mail/root
USER=root
LANGUAGE=en_US:en
SHLVL=1
HOME=/root
XDG_SESSION_COOKIE=cf7dc7a267ea309208ab8047509b5dd0-1369289678.605759-127222237
DEBCONF_RECONFIGURE=1
DPKG_MAINTSCRIPT_ARCH=all
LOGNAME=root
_=/usr/sbin/dpkg-reconfigure
DPKG_MAINTSCRIPT_NAME=postinst
TERM=xterm
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DISPLAY=:0.0
LANG=en_US.UTF-8
DPKG_MAINTSCRIPT_PACKAGE=mcollective
XAUTHORITY=/home/zcrha/.Xauthority
DEBCONF_REDIR=1
SHELL=/bin/bash
DEBIAN_HAS_FRONTEND=1
PWD=/root

When mcollective is used for package installation (using custom agent) later
on, it fails in the
debconf /usr/share/debconf/confmodule:22:

22 if [ -z "$DEBCONF_REDIR" ]; then
 23         # Redirect standard output to standard error. This prevents common
 24         # mistakes by making all the output of the postinst or whatever
 25         # script is using this library not be parsed as confmodule
commands.
 26         #
 27         # To actually send something to standard output, send it to fd 3.
 28         exec 3>&1
 29         if [ "$DEBCONF_USE_CDEBCONF" ]; then
 30                 exec 1>&5
 31         else
 32                 exec 1>&2
 33         fi
 34         DEBCONF_REDIR=1
 35         export DEBCONF_REDIR
 36 fi

The cause is that DEBCONF_REDIR is already set to 1 due to environment
inherited when restarting daemon in mcollective postinst.

Resetting environment in the mcollective init script solves this issue.




-- System Information:
Debian Release: 7.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-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 mcollective depends on:
ii  debconf [debconf-2.0]         1.5.49
ii  mcollective-common            2.2.3.20130502-1
ii  ruby                          1:1.9.3
ii  ruby1.8 [ruby-interpreter]    1.8.7.358-7
ii  ruby1.9.1 [ruby-interpreter]  1.9.3.194-8.1

Versions of packages mcollective recommends:
ii  mcollective-client  2.2.3.20130502-1

Versions of packages mcollective suggests:
pn  activemq  <none>

-- Configuration Files:
/etc/default/mcollective changed:
RUN=yes


-- debconf information:
* mcollective/start_on_boot: true



More information about the Pkg-puppet-devel mailing list