liske / needrestart

Restart daemons after library updates.
GNU General Public License v2.0
420 stars 67 forks source link

Default notifications with unattended-upgrades repeat twice per minute #243

Open Zocker1999NET opened 2 years ago

Zocker1999NET commented 2 years ago

Without modifying needrestart's notify configuration, needrestart is really annoying. I installed needrestart because when I update / install packages manually, it then asks me in the terminal which services would I want to restart and which should I restart myself. However, lately, needrestart gained the ability to notify me on my desktop and now I'm getting 2 to 3 notifications per minute (see screenshots). Because the notifications are marked as critical, KDE displays them over all applications and I need to dismiss them, one by one, manually … unattended-upgrades is currently running on my system and I suspect it triggers needrestart on each package it updates.

Screenshots ![image](https://user-images.githubusercontent.com/1645646/170861470-4d1ace88-b11e-4724-8144-0f3f02aa02dc.png) ![image](https://user-images.githubusercontent.com/1645646/170861488-75fc31c1-b111-408b-a33d-44e1b76456be.png) ![image](https://user-images.githubusercontent.com/1645646/170861495-7ce5bfc4-d387-4346-8bdd-cc40a968a94e.png) and it goes on and on …

I have a desktop system with KDE Plasma 5 as desktop. My system is running Debian testing/sid with needrestart version 3.6-1 and unattended-upgrades version 2.8 (both installed from Debian repository). I did not change any configuration of needrestart.

If someone has the same problem as I do and needs a fast workaround, edit /etc/needrestart/notify.conf and add (or remove # before) following line:

NR_NOTIFYD_DISABLE_NOTIFY_SEND='1'

To prevent such annoyance per default so users in the future might not need to rant about needrestart (because I still think this tool is a great addition) and might not uninstall it right away, please think about implementing at least one of the following proposals:

  1. Do not send multiple notifications but overwrite your old ones. This might require you to cache the id of the last notification sent so you can instruct the notification daemon to overwrite this notification.
  2. Do not mark these notifications as critical, only define that the notification should not timeout by default (possible by declaring expire_timeout=0). The Desktop Notifications Specification lists as an example for a critical notification "Your computer is on fire". This is not the case if a service will not be restarted right away after a few of its libraries got updated. At least on my system with unattended-upgrades installed, the only major problems I ran into was after Firefox was updated (sometimes requires Firefox to be restarted, but it will notify the user by itself) and when nvidia-driver was updated (applications using library version != kernel module version results into crashes, solved by disabling nvidia-driver upgrades by unattended-upgrades).
  3. Try to solve that unattended-upgrades only triggers a notification after it completed installing all upgrades. This might require changing unattended-upgrades as well but I think it would be worth it.
liske commented 1 year ago

Thanks for the idea 1) + 2).

3) Sadly this is out of control of needrestart. When the NEEDRESTART_SUSPEND env variable is set than needrestart's apt-get hook won't trigger. So yes, this might be implemented in unattended-upgrades.