Hi Stephen,

On Fri, Jan 22, 2016 at 11:44:30AM -0700, Stephen Dowdy wrote:
> I believe the Felix is saying that 'needrestart' appears to be unaware of
> the common explicit DEBIAN_FRONTEND=noninteractive setting used to indicate
> that package management should be non-interactive (and if not, then *I* am)
> 
> I will often use 'pdsh' to run forced package updates like so:
> 
> $ cut -d: -f1 vulnerable.log | WCOLL=- pdsh -lroot 'aptitude update -q=2;
> DEBIAN_FRONTEND=noninteractive aptitude -q=2 safe-upgrade --assume-yes -o
> Dpkg::Options::="--force-confold" </dev/null'
> 
> Unfortunately, 'needrestart's 'isatty' style checks are insufficient for my
> needs here, as STDERR/STDOUT are attached to a pty associated with the
> 'ssh' hitting all the systems i am updating...  I have no way of then
> telling 'needrestart' to not restart services
> 
> So, i unexpectedly got a bunch of systemctl restart invocations, and i find
> that often borks things badly.
> 
> If 'needrestart' could also check ${DEBIAN_FRONTEND}, that would be awesome.
> 
> Otherwise, i suppose i will have to cfengine out a "Default No"
> needrestart.conf configuration to all my systems.

you could try to put something like

cat <<EOF
# Switch to list mode if debconf is running noninteractive 
$nrconf{restart} = (exists($ENV{DEBIAN_FRONTEND}) &&
$ENV{DEBIAN_FRONTEND} eq 'noninteractive' ? 'l' : 'i');

1;
EOF

into /etc/needrestart/conf.d/noninteractive.conf. If it works we might
should add it upstream...


> So, indeed 'unattended-upgrades' runs are also triggering needrestart to
> believe it is running interactively, and thus it restarts things.
> 'unattended-upgrade' appears to buy into the "DEBIAN_FRONTEND" notion of
> noninteractivity as well:
> 
> # grep -i interactive /usr/bin/unattended-upgrade
>     # set debconf to NON_INTERACTIVE, redirect output
>     os.putenv("DEBIAN_FRONTEND", "noninteractive")
>             env["DEBIAN_FRONTEND"] = "noninteractive"

So the fix should work for unattended-upgrades, too.


Thx & HTH,
Thomas

--

    ::  WWW:                        https://fiasko-nw.net/~thomas/  ::
   :::  Jabber:                   xmpp:tho...@jabber.fiasko-nw.net  :::
    ::  flickr:             https://www.flickr.com/photos/laugufe/  ::

Reply via email to