`unattended-upgrades` 似乎无法首先执行 `apt-get update`

`unattended-upgrades` 似乎无法首先执行 `apt-get update`

我有unattended-upgrades一个不会升级的。已经过去整整一个月了,它的日志还是空的。

因此我手动检查以确认它认为没有什么可升级的。

# unattended-upgrades --dry-run --debug
Initial blacklist : 
Initial whitelist: 
Starting unattended upgrades script
Allowed origins are: origin=Debian,codename=buster-updates, origin=Debian,codename=buster-proposed-updates, origin=Debian,codename=buster,label=Debian, origin=Debian,codename=buster,label=Debian-Security
Using (^linux-image-[0-9]+\.[0-9\.]+-.*|^linux-headers-[0-9]+\.[0-9\.]+-.*|^linux-image-extra-[0-9]+\.[0-9\.]+-.*|^linux-modules-[0-9]+\.[0-9\.]+-.*|^linux-modules-extra-[0-9]+\.[0-9\.]+-.*|^linux-signed-image-[0-9]+\.[0-9\.]+-.*|^linux-image-unsigned-[0-9]+\.[0-9\.]+-.*|^kfreebsd-image-[0-9]+\.[0-9\.]+-.*|^kfreebsd-headers-[0-9]+\.[0-9\.]+-.*|^gnumach-image-[0-9]+\.[0-9\.]+-.*|^.*-modules-[0-9]+\.[0-9\.]+-.*|^.*-kernel-[0-9]+\.[0-9\.]+-.*|^linux-backports-modules-.*-[0-9]+\.[0-9\.]+-.*|^linux-modules-.*-[0-9]+\.[0-9\.]+-.*|^linux-tools-[0-9]+\.[0-9\.]+-.*|^linux-cloud-tools-[0-9]+\.[0-9\.]+-.*|^linux-buildinfo-[0-9]+\.[0-9\.]+-.*|^linux-source-[0-9]+\.[0-9\.]+-.*) regexp to find kernel packages
Using (^linux-image-4\.19\.0\-10\-amd64$|^linux-headers-4\.19\.0\-10\-amd64$|^linux-image-extra-4\.19\.0\-10\-amd64$|^linux-modules-4\.19\.0\-10\-amd64$|^linux-modules-extra-4\.19\.0\-10\-amd64$|^linux-signed-image-4\.19\.0\-10\-amd64$|^linux-image-unsigned-4\.19\.0\-10\-amd64$|^kfreebsd-image-4\.19\.0\-10\-amd64$|^kfreebsd-headers-4\.19\.0\-10\-amd64$|^gnumach-image-4\.19\.0\-10\-amd64$|^.*-modules-4\.19\.0\-10\-amd64$|^.*-kernel-4\.19\.0\-10\-amd64$|^linux-backports-modules-.*-4\.19\.0\-10\-amd64$|^linux-modules-.*-4\.19\.0\-10\-amd64$|^linux-tools-4\.19\.0\-10\-amd64$|^linux-cloud-tools-4\.19\.0\-10\-amd64$|^linux-buildinfo-4\.19\.0\-10\-amd64$|^linux-source-4\.19\.0\-10\-amd64$) regexp to find running kernel packages
Checking: nginx ([<Origin component:'nginx' archive:'stable' origin:'nginx' label:'nginx' site:'nginx.org' isTrusted:True>])
adjusting candidate version: nginx=1.14.2-2+deb10u2
pkgs that look like they should be upgraded: 
Fetched 0 B in 0s (0 B/s)                                                                                                                                                                                                                  
fetch.run() result: 0
blacklist: []
whitelist: []
No packages found that can be upgraded unattended and no pending auto-removals
# apt-get upgrade --dry-run
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  nginx
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Inst nginx [1.16.1-1~buster] (1.18.0-1~buster nginx:10.0/stable [amd64])
Conf nginx (1.18.0-1~buster nginx:10.0/stable [amd64])

运行之后我再次尝试apt-get update,结果却不一样。

# unattended-upgrades --dry-run --debug
Checking: bind9-host ([<Origin component:'main' archive:'stable' origin:'Debian' label:'Debian-Security' site:'security.debian.org' isTrusted:True>])
Checking: dnsutils ([<Origin component:'main' archive:'stable' origin:'Debian' label:'Debian-Security' site:'security.debian.org' isTrusted:True>])
Checking: libbind9-161 ([<Origin component:'main' archive:'stable' origin:'Debian' label:'Debian-Security' site:'security.debian.org' isTrusted:True>])
Checking: libdns-export1104 ([<Origin component:'main' archive:'stable' origin:'Debian' label:'Debian-Security' site:'security.debian.org' isTrusted:True>])
Checking: libdns1104 ([<Origin component:'main' archive:'stable' origin:'Debian' label:'Debian-Security' site:'security.debian.org' isTrusted:True>])
Checking: libirs161 ([<Origin component:'main' archive:'stable' origin:'Debian' label:'Debian-Security' site:'security.debian.org' isTrusted:True>])
Checking: libisc-export1100 ([<Origin component:'main' archive:'stable' origin:'Debian' label:'Debian-Security' site:'security.debian.org' isTrusted:True>])
Checking: libisc1100 ([<Origin component:'main' archive:'stable' origin:'Debian' label:'Debian-Security' site:'security.debian.org' isTrusted:True>])
Checking: libisccc161 ([<Origin component:'main' archive:'stable' origin:'Debian' label:'Debian-Security' site:'security.debian.org' isTrusted:True>])
Checking: libisccfg163 ([<Origin component:'main' archive:'stable' origin:'Debian' label:'Debian-Security' site:'security.debian.org' isTrusted:True>])
Checking: liblwres161 ([<Origin component:'main' archive:'stable' origin:'Debian' label:'Debian-Security' site:'security.debian.org' isTrusted:True>])
Checking: nginx ([<Origin component:'nginx' archive:'stable' origin:'nginx' label:'nginx' site:'nginx.org' isTrusted:True>])
adjusting candidate version: nginx=1.14.2-2+deb10u3
pkgs that look like they should be upgraded: bind9-host
dnsutils
libbind9-161
libdns-export1104
libdns1104
libirs161
libisc-export1100
libisc1100
libisccc161
libisccfg163
liblwres161
Option --dry-run given, *not* performing real actions
Packages that will be upgraded: bind9-host dnsutils libbind9-161 libdns-export1104 libdns1104 libirs161 libisc-export1100 libisc1100 libisccc161 libisccfg163 liblwres161
All upgrades installed
InstCount=0 DelCount=0 BrokenCount=0
# apt-get upgrade --dry-run
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  bind9-host dnsutils libbind9-161 libdns-export1104 libdns1104 libirs161 libisc-export1100 libisc1100 libisccc161 libisccfg163 liblwres161 nginx
12 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Inst dnsutils [1:9.11.5.P4+dfsg-5.1+deb10u1] (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64]) []
Inst bind9-host [1:9.11.5.P4+dfsg-5.1+deb10u1] (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64]) []
Inst libbind9-161 [1:9.11.5.P4+dfsg-5.1+deb10u1] (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64]) []
Inst libisccfg163 [1:9.11.5.P4+dfsg-5.1+deb10u1] (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64]) []
Inst libisccc161 [1:9.11.5.P4+dfsg-5.1+deb10u1] (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64]) []
Inst libirs161 [1:9.11.5.P4+dfsg-5.1+deb10u1] (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64]) []
Inst libdns1104 [1:9.11.5.P4+dfsg-5.1+deb10u1] (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64]) []
Inst libisc1100 [1:9.11.5.P4+dfsg-5.1+deb10u1] (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64]) []
Inst liblwres161 [1:9.11.5.P4+dfsg-5.1+deb10u1] (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64])
Inst libisc-export1100 [1:9.11.5.P4+dfsg-5.1+deb10u1] (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64])
Inst libdns-export1104 [1:9.11.5.P4+dfsg-5.1+deb10u1] (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64])
Inst nginx [1.16.1-1~buster] (1.18.0-1~buster nginx:10.0/stable [amd64])
Conf dnsutils (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64])
Conf bind9-host (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64])
Conf libbind9-161 (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64])
Conf libisccfg163 (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64])
Conf libisccc161 (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64])
Conf libirs161 (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64])
Conf libdns1104 (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64])
Conf libisc1100 (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64])
Conf liblwres161 (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64])
Conf libisc-export1100 (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64])
Conf libdns-export1104 (1:9.11.5.P4+dfsg-5.1+deb10u2 Debian-Security:10/stable [amd64])
Conf nginx (1.18.0-1~buster nginx:10.0/stable [amd64])

我认为在计算升级之前更新软件包列表是理所当然的,应该自动进行。我是否忽略了一些显而易见的事情?我阅读的教程只提到apt-get update在安装之前unattended-upgrades,并且专门搜索没什么帮助。

答案1

要更新软件包列表,您需要在 apt 配置中进行设置:

APT::Periodic::Update-Package-Lists "1";

Debian 维基建议创建一个文件/etc/apt/apt.conf.d/20auto-upgrades来激活无人值守升级,其中包含:

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

相关内容