On Thu, Aug 16, 2007 at 20:38:12 +0100 (+0100), Adrian Bridgett wrote: > However, I still get some hangs (one I've seen before). In this case, > dpkg-preconfigure is sat in a waitpid(pidof /tmp/postfix.config...) > whilst postfix.config is sat reading STDIN (which is FD#8 from the > dpkg-preconfigure. There is a dpkg-preconfigure zombie process > between these two.
Well after several days of pouring over "ls -l /proc/$$/fd" output etc (and with very little actually understanding of how the DEBIAN_FRONTEND, DEBIAN_HAS_FRONTEND, DEBCONF_REDIR is supposed to be being used!), I have some workarounds which let me use puppet with a debian preseed to make a fully automated install. I've attached the three patches I'm using (on top of your debconf patch) which allow this to work. Mostly they involve checking if file descriptor #3 is actually open - if it's not then unset DEBCONF_REDIR (and possibly DEBIAN_HAS_FRONTEND - I only just saw that there is also DEBIAN_FRONTEND :-( ). BTW ClientConfModule.pm is the "Client/ConfModule.pm" file. It looks like apt-get is closing the FDs in ExecFork which does look at an APT::Keep-Fds option but I've not looked any further. Thanks, Adrian -- Email: [EMAIL PROTECTED] -*- GPG key available on public key servers Debian GNU/Linux - the maintainable distribution -*- www.debian.org
--- debconf/usr/share/perl5/Debconf/Client/ConfModule.pm 2007-07-25 14:59:58.000000000 +0100 +++ /tmp/ClientConfModule.pm 2007-08-22 08:53:13.000000000 +0100 @@ -86,7 +86,9 @@ # /usr/share/debconf/confmodule is loaded, and then this # perl module is used. In that case, this module needs to write # to fd #3, rather than stdout. See changelog 0.3.74. # apt-get is closing the FD without unsetting the ENV - if (exists $ENV{DEBCONF_REDIR} && $ENV{DEBCONF_REDIR}) { + if (exists $ENV{DEBCONF_REDIR} && $ENV{DEBCONF_REDIR} + && -e "/proc/$$/fd/3") { open(STDOUT,">&3"); } }
7a8,15 > # apt-get is closing the FDs without unsetting the ENV > if [ "$DEBCONF_REDIR" ]; then > if ! [ -e /proc/$$/fd/3 ]; then > unset DEBCONF_REDIR > unset DEBIAN_HAS_FRONTEND > fi > fi >
--- debconf/usr/sbin/dpkg-preconfigure 2007-07-25 14:59:59.000000000 +0100 +++ /tmp/dpkg-preconfigure 2007-08-22 08:51:34.000000000 +0100 @@ -35,6 +35,16 @@ @ARGV=(); my $have_tty=1; + # apt-get is closing the FD without unset the ENV + if ($ENV{DEBCONF_REDIR}) { + local (*TMP); + if (! open(TMP,"<&3")) { + delete $ENV{DEBCONF_REDIR}; + delete $ENV{DEBIAN_HAS_FRONTEND}; + } else { + close TMP; + } + } if ($apt) { while (<>) { @@ -100,6 +109,7 @@ exit; } my @buffer=<INFO>; +close INFO; if ($apt && @buffer) { print gettext("Preconfiguring packages ...\n"); }