使用 apt Upgrade 或 dist-upgrade 時如何檢查是什麼破壞了自動更新核心?

使用 apt Upgrade 或 dist-upgrade 時如何檢查是什麼破壞了自動更新核心?

我目前的系統版本是18.04 LTS,核心4.15.0-45-generic。由於CVE-2019-11477,我想將核心更新到固定版本linux-image-4.15.0-52-generic。
我嘗試過sudo apt dist-upgrade,但什麼也沒發生。但是當我使用時apt search linux-image-4.15.0-52,這個核心存在於官方倉庫中。然後我手動安裝了。

根據Karel的回答,我在新的VPS上進行了測試,兩者都可以更新核心。如何檢查呢?

root@ubuntu:/home/username# uname -a
Linux ubuntu 4.15.0-45-generic #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
root@ubuntu:/home/username# apt update
Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease                                                               
Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]                                           
Hit:3 http://ppa.launchpad.net/ondrej/nginx-mainline/ubuntu bionic InRelease                                                   
Hit:4 https://deb.nodesource.com/node_10.x bionic InRelease                                                                    
Get:5 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]                                  
Get:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Fetched 252 kB in 2s (110 kB/s)    
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
root@ubuntu:/home/username# apt search linux-image-4.15.0-52
Sorting... Done
Full Text Search... Done
linux-image-4.15.0-52-generic/bionic-updates 4.15.0-52.56 amd64
  Signed kernel image generic

linux-image-4.15.0-52-lowlatency/bionic-updates 4.15.0-52.56 amd64
  Signed kernel image lowlatency
root@ubuntu:/home/username# apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@ubuntu:/home/username# apt dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

具有 18.04 LTS 的新 vps

Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-50-generic x86_64)

root@vultr:~# apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  linux-headers-4.15.0-52 linux-headers-4.15.0-52-generic linux-image-4.15.0-52-generic
  linux-modules-4.15.0-52-generic linux-modules-extra-4.15.0-52-generic
The following packages will be upgraded:


root@vultr:~# apt dist-upgrade 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  linux-headers-4.15.0-52 linux-headers-4.15.0-52-generic linux-image-4.15.0-52-generic
  linux-modules-4.15.0-52-generic linux-modules-extra-4.15.0-52-generic
The following packages will be upgraded:

apt-cache policy linux-image-generic

root@ubuntu:/home/username# apt-cache policy linux-image-generic
linux-image-generic:
  Installed: (none)
  Candidate: 4.15.0.52.54
  Version table:
     4.15.0.52.54 500
        500 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
     4.15.0.51.53 500
        500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
     4.15.0.20.23 500
        500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages

答案1

您在系統上執行的操作刪除了元包這使得這些升級“正常工作”。

和包linux-image-genericlinux-headers-generic追蹤您的系統最新發布的核心版本 - 4.15.0 - 您需要安裝它們才能收到升級提示。

sudo apt install linux-image-generic linux-headers-generic應該足以做到這一點。這也應該拉入您想要的核心包的版本,儘管您所在的任何鏡像似乎都沒有 -52.56 而是 -52.54。

答案2

Linux 核心 4.15.0-52 位於預設的 Ubuntu 18.04 儲存庫中。在Ubuntu 18.04更新軟體,會將核心更新到4.15.0-52。我就是這樣做的(我沒有使用sudo apt-get dist-upgrade)。

sudo apt update  
sudo apt upgrade   

apt policy linux-image-4.15.0-52-genericUbuntu 18.04 中更新軟體後的結果:

$apt 策略 linux-image-4.15.0-52-generic
linux-image-4.15.0-52-generic:
  安裝:4.15.0-52.56
  候選人:4.15.0-52.56
  版本表:
 *** 4.15.0-52.56 500

重新啟動 Ubuntu 以使用新安裝的核心進行啟動。然後結果uname -a將顯示Ubuntu 18.04正在使用最新安裝的核心版本。

相關內容