Silent Message Printing After Apt Install or Upgrade on Ubuntu 22.04

I've been using Ubuntu 22.04 lately rather than Ubuntu 18.04, every time I install a package it's always printing a message like:

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.

Although it's a fresh new minimal install of Ubuntu 22.04, it's always printing a message like that. How to solve it?

How to solve:

That verbose message comes from the needrestart package where installed on Ubuntu 22.04. This is new in Ubuntu 22.04.

needrestart checks which daemons need to be restarted after library upgrades. Ubuntu manpage

In order to silent/quiet this message we need to edit /etc/needrestart/needrestart.conf file open it with your favorite editor:

nano /etc/needrestart/needrestart.conf

And then add a line:

$nrconf{verbosity} = 0;

to make the needrestart package message verbose quietly.

You can also to make always restart the services automatically without using the 'interactive' restart service mode which is default of Ubuntu 22.04 system by adding:

$nrconf{restart} = 'a';

I hope it helps.

Thanks for reading 😄