[Ubuntu 22.04.2] Running kernel seems to be up-to-date. Restarting services Daemons using outdated

1. 问题现象

  安装ubuntu 22.04.2版本后,安装软件时,总是提示:Running kernel seems to be up-to-date. Restarting services... Daemons using outdated libraries

root@ubuntu-pattern:/home/david# apt install -y net-tools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  net-tools
0 upgraded, 1 newly installed, 0 to remove and 92 not upgraded.
Need to get 204 kB of archives.
After this operation, 819 kB of additional disk space will be used.
Get:1 http://cn.archive.ubuntu.com/ubuntu jammy/main amd64 net-tools amd64 1.60+git20181103.0eebece-1ubuntu5 [204 kB]
Fetched 204 kB in 2s (107 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package net-tools.
(Reading database ... 66539 files and directories currently installed.)
Preparing to unpack .../net-tools_1.60+git20181103.0eebece-1ubuntu5_amd64.deb ...
Unpacking net-tools (1.60+git20181103.0eebece-1ubuntu5) ...
Setting up net-tools (1.60+git20181103.0eebece-1ubuntu5) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 78.)
debconf: falling back to frontend: Readline
Scanning processes...
Scanning candidates...
Scanning linux images...

Running kernel seems to be up-to-date.

Restarting services...
Daemons using outdated libraries
--------------------------------

  1. networkd-dispatcher.service  2. unattended-upgrades.service

(Enter the items or ranges you want to select, separated by spaces.)

Which services should be restarted?

2. 问题分析

  根据因为提示,大致意思是说本地安装的networkd-dispatcher.service, unattended-upgrades.service这两个服务版本太旧,问我们是否需要更新这两个服务。(其实潜台词就是我们再安装程序的时候,ubuntu自动下载了这连个服务的新版本)

  这种设计确实还是有点烦人的,特别是再执行脚本的时候,如果还有这种交互流程,那就非常不方便了。

  网上搜索了一下,主要看来有三种解决方案:1、自动重启服务 2、列出需要重启的服务,用户自行决定是否需要重新服务 3、删除每次通过apt/apt-get安装软件时自动更新程序

3. 解决方案

  这三种解决方案,选择其中的一种即可,不需要都设置。

3.1. 每次自动重启更新的服务

sudo sed -i 's/#$nrconf{restart} = '"'"'i'"'"';/$nrconf{restart} = '"'"'a'"'"';/g' /etc/needrestart/needrestart.conf

3.2. 列出自动更新的服务,由用户自行决定是否需要重启服务

sudo sed -i 's/#$nrconf{restart} = '"'"'i'"'"';/$nrconf{restart} = '"'"'l'"'"';/g' /etc/needrestart/needrestart.conf

3.3. 移除自动更新服务的程序

sudo apt-get remove needrestart

4. 参考文献

1、apt-get upgrade auto restart services

2、How to stop ubuntu pop-up “Daemons using outdated libraries” when using apt to install or update packages?

你可能感兴趣的:(Linux,ubuntu,linux,22.04,apt,apt-get)