jeudi 1 septembre 2022

prevent apt to stop updates in Ubuntu 22.04

 In Ubuntu 22.04, the needrestart command, which is part of the apt-get upgrade process in Ubuntu, 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.

Another trick:

To disable "Pending kernel upgrade" via command line:

sudo vim /etc/needrestart/needrestart.conf

then uncomment this line

#$nrconf{kernelhints} = -1;