Package: needrestart
Version: 3.11-1
Severity: important
Tags: patch
Control: affects -1 3.6-4+deb12u3

Dear Maintainer,

Occasionally when installing new packages via apt(1) or aptitude(1), the
installation process would hang just before the end.  There would be no
error message; the terminal would simple stall for a bit and the install
would complete successfully.  The hang would happen at the time of the
blank line in the following output (tail of the output of an interactive
aptitude(1) session):

[[[
User sessions running outdated binaries:
 daniel @ session #18: cinnamon-sessio[18987]

No VM guests are running outdated hypervisor (qemu) binaries on this host.
Press Return to continue, 'q' followed by Return to quit.
]]]

ps(1) output at the time of the hang:

[[[
root      471874  0.0  0.0   2672  1780 pts/5    S+   02:31   0:00 sh -c -- 
test -x /usr/lib/needrestart/apt-pinvoke && /usr/lib/needrestart/apt-pinvoke || 
true
root      471875  0.4  0.1  31636 23340 pts/5    S+   02:31   0:00 
/usr/bin/perl /usr/share/debconf/frontend /usr/sbin/needrestart
root      471888  0.7  0.1  30632 23704 pts/5    S+   02:31   0:00 
/usr/bin/perl /usr/sbin/needrestart
root      471903  0.0  0.0   2672  1844 pts/5    S+   02:31   0:00 /bin/sh 
/etc/needrestart/notify.d/400-notify-send
root      471913  0.0  0.0  12340  4540 pts/5    S+   02:31   0:00 runuser -p 
-u daniel -- /usr/bin/notify-send -a needrestart -u critical -i dialog-warning 
Relogin or restarts required! Your session is running obsolete binaries or 
libraries as listed below. <i><b>Please consider a relogin or restart of the 
affected processes!</b></i>\ncinnamon-sessio[18987]
daniel    471914  0.0  0.0 170976  6736 pts/5    Sl+  02:31   0:00 
/usr/bin/notify-send -a needrestart -u critical -i dialog-warning Relogin or 
restarts required! Your session is running obsolete binaries or libraries as 
listed below. <i><b>Please consider a relogin or restart of the affected 
processes!</b></i>\ncinnamon-sessio[18987]
]]]

This does not seem to have been reported yet: while #826044[1] and
#1002732[2] also concern hangs, my ps(1) output is different to theirs.

The issue went away once I edited /etc/needrestart/notify.d/400-notify-send
to export DBUS_SESSION_BUS_ADDRESS, as in the attached patch.  With that
patch, installs complete without delays and the notify-send(1) notification
does show up at the corner of the screen.

Thanks for maintaining the needrestart package,

Daniel

[1] #826044 - needrestart: Hangs in apt hook with a zombie

[2] #1002732 - needrestart stalled in background when performing update
with KDE Discover

P.S.  The patch is against the latest version in debsnap(1), 3.11-1, as
debcheckout(1) errored out.
diff -ru needrestart-3.11/ex/notify.d/400-notify-send needrestart-3.11/ex/notify.d/400-notify-send
--- needrestart-3.11/ex/notify.d/400-notify-send
+++ needrestart-3.11/ex/notify.d/400-notify-send
@@ -50,6 +50,7 @@
     MSGBODY=$(gettext 'Your session is running obsolete binaries or libraries as listed below.
 <i><b>Please consider a relogin or restart of the affected processes!</b></i>')'\n'$(cat)
 
+    if [ -n "$DBUS_SESSION_BUS_ADDRESS" ] ; then export DBUS_SESSION_BUS_ADDRESS ; fi
     runuser -p -u "$NR_USERNAME" -- "$NSEND" -a needrestart -u critical -i dialog-warning "$MSGTITLE" "$MSGBODY"
     ;;
   *)

Reply via email to