How to stop ubuntu pop-up "Daemons using outdated libraries" when using apt to install or update packages?
Aug 18
I have newly installed Ubuntu 22.04 LTS recently and I found that every time when I using apt to install or update packages, it will ask me about Which service should be restarted ?, I don't konw which should be restared and actually I don't want to restart any service when I'm using it.
This annoys me and I want to know how to disable this when using apt in Ubuntu 22?
1 answer
Accepted answer · original discussion
Aug 18
This is new in Ubuntu 22.04. The trouble in this case is with the needrestart command, which is part of the apt-get upgrade process in Ubuntu now. By default this is set to "interactive" mode which causes the interruption of scripts.
To change this behavior, we can edit the /etc/needrestart/needrestart.conf file, changing the line:
#$nrconf{restart} = 'i';
to
$nrconf{restart} = 'a'; (if we want to restart the services automatically) or $nrconf{restart} = 'l'; to simply list the services that need restart.
Source: https://askubuntu.com/questions/1367139/apt-get-upgrade-auto-restart-services
3 question comments
Use comments to ask for clarification. Post a solution as an answer.
Aug 29
NEEDRESTART_MODE=a environment variable to your command to restart the services automatically, e.g.: sudo NEEDRESTART_MODE=a apt-get dist-upgrade --yes