![无人值守升级:找出起源模式](https://linux22.com/image/1199623/%E6%97%A0%E4%BA%BA%E5%80%BC%E5%AE%88%E5%8D%87%E7%BA%A7%EF%BC%9A%E6%89%BE%E5%87%BA%E8%B5%B7%E6%BA%90%E6%A8%A1%E5%BC%8F.png)
在设置 Ubuntu 服务器时,我安装了 ZeroTier,并unattended-upgrades
像往常一样进行配置。ZeroTier 在无人值守升级方面是个问题,因为所有原始数据都只是发行版名称的重复,即:
500 http://download.zerotier.com/debian/mantic mantic/main amd64 Packages
release o=mantic mantic,a=mantic,n=mantic,l=mantic mantic,c=main,b=amd64
origin download.zerotier.com
Origin: mantic mantic
Label: mantic mantic
Suite: mantic
Codename: mantic
Date: Mon, 30 Oct 2023 18:45:47 UTC
Architectures: amd64 arm64 armhf i386 ppc64el s390x
Components: main
Description: Generated by aptly
这显然没什么用。在我的所有 Debian 机器上,以下条目都可以正常工作50unattended-upgrades
:
"site=download.zerotier.com,n=${distro_codename}";
虽然不是最理想的,但它确实有效。然而,在这个 Ubuntu 服务器上,它不起作用,失败了:
Traceback (most recent call last):
File "/usr/bin/unattended-upgrades", line 2522, in <module>
sys.exit(main(options))
^^^^^^^^^^^^^
File "/usr/bin/unattended-upgrades", line 1993, in main
res = run(options, rootdir, mem_log, logfile_dpkg,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/bin/unattended-upgrades", line 2134, in run
cache = UnattendedUpgradesCache(rootdir=rootdir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/bin/unattended-upgrades", line 156, in __init__
self.allowed_origins = get_allowed_origins()
^^^^^^^^^^^^^^^^^^^^^
File "/usr/bin/unattended-upgrades", line 793, in get_allowed_origins
allowed_origins = get_allowed_origins_legacy()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/bin/unattended-upgrades", line 772, in get_allowed_origins_legacy
(distro_id, distro_codename) = s.split()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 1)
这让我很惊讶,因为我没有意识到 Ubuntu 和 Debian 之间的差距会大到让无人值守升级失败。注释掉源代码行可以让无人值守升级再次正常工作,所以这肯定是问题所在。
考虑到我掌握的原始信息,对于导致此条目失败的原因,有什么建议吗?