Ubuntu
為什麼 update-notifier 會說出與無人值守升級不同的內容?
當我登錄時,我有一條“每日消息”,它似乎來自文件 /var/lib/update-notifier/updates-available:
root@ls:~# cat /var/lib/update-notifier/updates-available 95 updates can be applied immediately. 1 of these updates is a standard security update. To see these additional updates run: apt list --upgradable
但是,當我執行無人值守升級時,它說沒有可用的安全更新:
root@ls:~# unattended-upgrades --dry-run -v Initial blacklisted packages: Initial whitelisted packages: Starting unattended upgrades script Allowed origins are: o=Ubuntu,a=bionic, o=Ubuntu,a=bionic-security, o=UbuntuESM,a=bionic No packages found that can be upgraded unattended and no pending auto-removals
以防萬一,這是我的 sources.list 文件:
deb http://archive.ubuntu.com/ubuntu bionic main restricted deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted deb http://archive.ubuntu.com/ubuntu bionic universe deb http://archive.ubuntu.com/ubuntu bionic-updates universe deb http://archive.ubuntu.com/ubuntu bionic multiverse deb http://archive.ubuntu.com/ubuntu bionic-updates multiverse deb http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu bionic-security main restricted deb http://archive.ubuntu.com/ubuntu bionic-security universe deb http://archive.ubuntu.com/ubuntu bionic-security multiverse
編輯 1: apt list-upgradable 的輸出
Listing... Done apt/bionic-updates 1.6.14 amd64 [upgradable from: 1.6.12ubuntu0.2] apt-utils/bionic-updates 1.6.14 amd64 [upgradable from: 1.6.12ubuntu0.2] base-files/bionic-updates 10.1ubuntu2.11 amd64 [upgradable from: 10.1ubuntu2.8] bcache-tools/bionic-updates 1.0.8-2ubuntu0.18.04.1 amd64 [upgradable from: 1.0.8-2build1] cloud-init/bionic-updates 21.4-0ubuntu1~18.04.1 all [upgradable from: 19.4-33-gbb4131a2-0ubuntu1~18.04.1] cryptsetup/bionic-updates 2:2.0.2-1ubuntu1.2 amd64 [upgradable from: 2:2.0.2-1ubuntu1.1] cryptsetup-bin/bionic-updates 2:2.0.2-1ubuntu1.2 amd64 [upgradable from: 2:2.0.2-1ubuntu1.1] dirmngr/bionic-updates 2.2.4-1ubuntu1.4 amd64 [upgradable from: 2.2.4-1ubuntu1.3] dmeventd/bionic-updates 2:1.02.145-4.1ubuntu3.18.04.3 amd64 [upgradable from: 2:1.02.145-4.1ubuntu3.18.04.2] dmsetup/bionic-updates 2:1.02.145-4.1ubuntu3.18.04.3 amd64 [upgradable from: 2:1.02.145-4.1ubuntu3.18.04.2] dnsmasq-base/bionic-updates 2.79-1ubuntu0.5 amd64 [upgradable from: 2.79-1ubuntu0.4] friendly-recovery/bionic-updates 0.2.38ubuntu1.2 all [upgradable from: 0.2.38ubuntu1.1] gnupg/bionic-updates 2.2.4-1ubuntu1.4 amd64 [upgradable from: 2.2.4-1ubuntu1.3] gnupg-l10n/bionic-updates 2.2.4-1ubuntu1.4 all [upgradable from: 2.2.4-1ubuntu1.3] gnupg-utils/bionic-updates 2.2.4-1ubuntu1.4 amd64 [upgradable from: 2.2.4-1ubuntu1.3] gpg/bionic-updates 2.2.4-1ubuntu1.4 amd64 [upgradable from: 2.2.4-1ubuntu1.3] gpg-agent/bionic-updates 2.2.4-1ubuntu1.4 amd64 [upgradable from: 2.2.4-1ubuntu1.3] gpg-wks-client/bionic-updates 2.2.4-1ubuntu1.4 amd64 [upgradable from: 2.2.4-1ubuntu1.3] gpg-wks-server/bionic-updates 2.2.4-1ubuntu1.4 amd64 [upgradable from: 2.2.4-1ubuntu1.3] gpgconf/bionic-updates 2.2.4-1ubuntu1.4 amd64 [upgradable from: 2.2.4-1ubuntu1.3] gpgsm/bionic-updates 2.2.4-1ubuntu1.4 amd64 [upgradable from: 2.2.4-1ubuntu1.3] gpgv/bionic-updates 2.2.4-1ubuntu1.4 amd64 [upgradable from: 2.2.4-1ubuntu1.3] gzip/bionic-updates 1.6-5ubuntu1.1 amd64 [upgradable from: 1.6-5ubuntu1] initramfs-tools/bionic-updates 0.130ubuntu3.13 all [upgradable from: 0.130ubuntu3.9] initramfs-tools-bin/bionic-updates 0.130ubuntu3.13 amd64 [upgradable from: 0.130ubuntu3.9] initramfs-tools-core/bionic-updates 0.130ubuntu3.13 all [upgradable from: 0.130ubuntu3.9] iproute2/bionic-updates 4.15.0-2ubuntu1.3 amd64 [upgradable from: 4.15.0-2ubuntu1.1] kmod/bionic-updates 24-1ubuntu3.5 amd64 [upgradable from: 24-1ubuntu3.2] landscape-common/bionic-updates 18.01-0ubuntu3.5 amd64 [upgradable from: 18.01-0ubuntu3.4] libapt-inst2.0/bionic-updates 1.6.14 amd64 [upgradable from: 1.6.12ubuntu0.2] libapt-pkg5.0/bionic-updates 1.6.14 amd64 [upgradable from: 1.6.12ubuntu0.2] libaudit-common/bionic-updates 1:2.8.2-1ubuntu1.1 all [upgradable from: 1:2.8.2-1ubuntu1] libaudit1/bionic-updates 1:2.8.2-1ubuntu1.1 amd64 [upgradable from: 1:2.8.2-1ubuntu1] libc-bin/bionic-updates 2.27-3ubuntu1.4 amd64 [upgradable from: 2.27-3ubuntu1.2] libc6/bionic-updates 2.27-3ubuntu1.4 amd64 [upgradable from: 2.27-3ubuntu1.2] libcryptsetup12/bionic-updates 2:2.0.2-1ubuntu1.2 amd64 [upgradable from: 2:2.0.2-1ubuntu1.1] libdevmapper-event1.02.1/bionic-updates 2:1.02.145-4.1ubuntu3.18.04.3 amd64 [upgradable from: 2:1.02.145-4.1ubuntu3.18.04.2] libdevmapper1.02.1/bionic-updates 2:1.02.145-4.1ubuntu3.18.04.3 amd64 [upgradable from: 2:1.02.145-4.1ubuntu3.18.04.2] libdrm-common/bionic-updates 2.4.101-2~18.04.1 all [upgradable from: 2.4.99-1ubuntu1~18.04.2] libdrm2/bionic-updates 2.4.101-2~18.04.1 amd64 [upgradable from: 2.4.99-1ubuntu1~18.04.2] libgnutls30/bionic-updates 3.5.18-1ubuntu1.5 amd64 [upgradable from: 3.5.18-1ubuntu1.3] libkmod2/bionic-updates 24-1ubuntu3.5 amd64 [upgradable from: 24-1ubuntu3.2] liblvm2app2.2/bionic-updates 2.02.176-4.1ubuntu3.18.04.3 amd64 [upgradable from: 2.02.176-4.1ubuntu3.18.04.2] liblvm2cmd2.02/bionic-updates 2.02.176-4.1ubuntu3.18.04.3 amd64 [upgradable from: 2.02.176-4.1ubuntu3.18.04.2] libnss-systemd/bionic-updates 237-3ubuntu10.53 amd64 [upgradable from: 237-3ubuntu10.50] libpam-modules/bionic-updates 1.1.8-3.6ubuntu2.18.04.3 amd64 [upgradable from: 1.1.8-3.6ubuntu2.18.04.1] libpam-modules-bin/bionic-updates 1.1.8-3.6ubuntu2.18.04.3 amd64 [upgradable from: 1.1.8-3.6ubuntu2.18.04.1] libpam-runtime/bionic-updates 1.1.8-3.6ubuntu2.18.04.3 all [upgradable from: 1.1.8-3.6ubuntu2.18.04.1] libpam-systemd/bionic-updates 237-3ubuntu10.53 amd64 [upgradable from: 237-3ubuntu10.50] libpam0g/bionic-updates 1.1.8-3.6ubuntu2.18.04.3 amd64 [upgradable from: 1.1.8-3.6ubuntu2.18.04.1] libpcap0.8/bionic-updates 1.8.1-6ubuntu1.18.04.2 amd64 [upgradable from: 1.8.1-6ubuntu1.18.04.1] libssl1.1/bionic-updates 1.1.1-1ubuntu2.1~18.04.14 amd64 [upgradable from: 1.1.1-1ubuntu2.1~18.04.13] libsystemd0/bionic-updates 237-3ubuntu10.53 amd64 [upgradable from: 237-3ubuntu10.50] libudev1/bionic-updates 237-3ubuntu10.53 amd64 [upgradable from: 237-3ubuntu10.50] libxau6/bionic-updates 1:1.0.8-1ubuntu1 amd64 [upgradable from: 1:1.0.8-1] linux-base/bionic-updates 4.5ubuntu1.7 all [upgradable from: 4.5ubuntu1.2] linux-firmware/bionic-updates 1.173.20 all [upgradable from: 1.173.18] locales/bionic-updates 2.27-3ubuntu1.4 all [upgradable from: 2.27-3ubuntu1.2] lshw/bionic-updates 02.18-0.1ubuntu6.18.04.2 amd64 [upgradable from: 02.18-0.1ubuntu6.18.04.1] lvm2/bionic-updates 2.02.176-4.1ubuntu3.18.04.3 amd64 [upgradable from: 2.02.176-4.1ubuntu3.18.04.2] lxcfs/bionic-updates 3.0.3-0ubuntu1~18.04.2 amd64 [upgradable from: 3.0.3-0ubuntu1~18.04.1] multiarch-support/bionic-updates 2.27-3ubuntu1.4 amd64 [upgradable from: 2.27-3ubuntu1.2] netplan.io/bionic-updates 0.99-0ubuntu3~18.04.5 amd64 [upgradable from: 0.98-0ubuntu1~18.04.1] nplan/bionic-updates 0.99-0ubuntu3~18.04.5 all [upgradable from: 0.98-0ubuntu1~18.04.1] open-iscsi/bionic-updates 2.0.874-5ubuntu2.10 amd64 [upgradable from: 2.0.874-5ubuntu2.7] open-vm-tools/bionic-updates 2:11.0.5-4ubuntu0.18.04.1 amd64 [upgradable from: 2:11.0.1-2ubuntu0.18.04.2] openssl/bionic-updates 1.1.1-1ubuntu2.1~18.04.14 amd64 [upgradable from: 1.1.1-1ubuntu2.1~18.04.13] pollinate/bionic-updates 4.33-0ubuntu1~18.04.2 all [upgradable from: 4.33-0ubuntu1~18.04.1] python-apt-common/bionic-updates 1.6.5ubuntu0.7 all [upgradable from: 1.6.5ubuntu0.5] python3-apt/bionic-updates 1.6.5ubuntu0.7 amd64 [upgradable from: 1.6.5ubuntu0.5] python3-distupgrade/bionic-updates 1:18.04.45 all [upgradable from: 1:18.04.37] python3-httplib2/bionic-updates 0.9.2+dfsg-1ubuntu0.3 all [upgradable from: 0.9.2+dfsg-1ubuntu0.2] python3-software-properties/bionic-updates 0.96.24.32.18 all [upgradable from: 0.96.24.32.14] python3-update-manager/bionic-updates 1:18.04.11.13 all [upgradable from: 1:18.04.11.10] rsync/bionic-updates 3.1.2-2.1ubuntu1.2 amd64 [upgradable from: 3.1.2-2.1ubuntu1.1] snapd/bionic-updates 2.51.1+18.04 amd64 [upgradable from: 2.48.3+18.04] software-properties-common/bionic-updates 0.96.24.32.18 all [upgradable from: 0.96.24.32.14] sosreport/bionic-updates 4.1-1ubuntu0.18.04.3 amd64 [upgradable from: 3.6-1ubuntu0.18.04.4] systemd/bionic-updates 237-3ubuntu10.53 amd64 [upgradable from: 237-3ubuntu10.50] systemd-sysv/bionic-updates 237-3ubuntu10.53 amd64 [upgradable from: 237-3ubuntu10.50] ubuntu-advantage-tools/bionic-updates 27.5~18.04.1 all [upgradable from: 17] ubuntu-keyring/bionic-updates 2018.09.18.1~18.04.2 all [upgradable from: 2018.09.18.1~18.04.0] ubuntu-minimal/bionic-updates 1.417.5 amd64 [upgradable from: 1.417.4] ubuntu-release-upgrader-core/bionic-updates 1:18.04.45 all [upgradable from: 1:18.04.37] ubuntu-server/bionic-updates 1.417.5 amd64 [upgradable from: 1.417.4] ubuntu-standard/bionic-updates 1.417.5 amd64 [upgradable from: 1.417.4] udev/bionic-updates 237-3ubuntu10.53 amd64 [upgradable from: 237-3ubuntu10.50] ufw/bionic-updates 0.36-0ubuntu0.18.04.2 all [upgradable from: 0.36-0ubuntu0.18.04.1] unattended-upgrades/bionic-updates 1.1ubuntu1.18.04.14 all [upgradable from: 1.1ubuntu1.18.04.13] update-manager-core/bionic-updates 1:18.04.11.13 all [upgradable from: 1:18.04.11.10]
那麼誰在說真話,update-notifier-common 還是 unattended-upgrades? 編輯 2:我想知道“其中一個更新是標準安全更新”在哪裡。來自?如何獲取此類更新的包名稱?
如果執行,我什麼也得不到:
apt-get upgrade -s | grep ^Inst | grep -i security
不同之處在於無人值守升級依賴於“升級”(如何獲取所有待處理安全更新的列表?),但更新通知器依賴於“dist-upgrade”。
可以驗證執行:
apt-get --dry-run upgrade -V | grep ^[0-9] 85 upgraded, 0 newly installed, 0 to remove and 5 not upgraded. apt-get --dry-run upgrade -V | grep "^Inst.*security.*$" | wc -l 0 apt-get --dry-run dist-upgrade -V | grep ^[0-9] 90 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
所以,90 + 5 = 95
並且“其中一個更新是標準的安全更新”。來自:
apt-get --dry-run dist-upgrade -V | grep "^Inst.*security.*$" Inst distro-info (0.18ubuntu0.18.04.1 Ubuntu:18.04/bionic-updates, Ubuntu:18.04/bionic-security [amd64])