如何关闭Ubuntu内核自动更新

环境:Ubuntu 20.04.1 TLS

查看当前已有内核

dpkg --list|grep linux-image
dpkg --list|grep linux-headers

查看当前使用的内核版本

uname -r

卸载内核

sudo apt purge linux-image-xxx # xxx表示上图中后面的数字
sudo apt purge linux-headers-xxx
sudo apt autoremove # 自动删除不用的安装包

卸载完内核后需要执行下列命令更新grub

sudo update-grub

关闭内核的自动更新

sudo apt-mark hold linux-image-xx.x.x-xx-generic
sudo apt-mark hold linux-headers-xx.x.x-xx-generic
sudo apt-mark hold linux-modules-extra-xx.x.x-xx-generic

重新启用内核更新

sudo apt-mark unhold linux-image-xx.x.x-xx-generic
sudo apt-mark hold linux-headers-xx.x.x-xx-generic
sudo apt-mark hold linux-modules-extra-xx.x.x-xx-generic

参考文章:
http://www.mlzhilu.com/archives/ubuntu%E5%85%B3%E9%97%AD%E5%86%85%E6%A0%B8%E8%87%AA%E5%8A%A8%E6%9B%B4%E6%96%B0

如何将Ubuntu 18.04升级到Ubuntu 20.04?

执行系统更新

首先将Ubuntu 18.04系统软件包更新和升级到最新版本。

sudo apt update
sudo apt upgrade

您还可以执行完整的系统升级。

sudo apt full-upgrade

由 man 8 apt, full-upgrade 执行升级功能,但是如果需要升级整个系统,请删除当前安装的软件包。

删除不再需要的软件包。

sudo apt autoremove

升级完成后,重新启动系统。

sudo systemctl reboot

将Ubuntu 18.04升级到Ubuntu 20.04

Ubuntu随附以下命令实用程序: do-release-upgrade 用于将Ubuntu操作系统升级到最新版本。默认情况下已安装此实用程序。如果由于某种原因未安装,则只需安装 update-manager-core 做事提供。

sudo apt install update-manager-core

然后,您可以简单地将系统升级到新发行版本。

do-release-upgrade

该实用程序支持许多命令行选项。检查 do-release-upgrade -h。例如,如果您使用的是Ubuntu 18.04桌面版本,则可以运行以下命令以执行桌面升级到新版本:

sudo do-release-upgrade -m desktop

执行常规服务器版本升级

sudo do-release-upgrade -m server

的 do-release-upgrade 命令通常仅在主要LTS发行版的第一点发行之后发布。 在这种情况下,此命令仅在Ubuntu 20.04.1可用后才有效

好吧,一旦获得输出, There is no development version of an LTS available,是 Ubuntu 20.04.1 尚不可用。

因此,由于我们正在处理测试版本,因此我们只需要将Ubuntu 18.04系统升级到Ubuntu 20.04的开发发行版。通行证 -d 或 --devel-release 选件 do-release-upgrade 命令

sudo do-release-upgrade -m desktop -d

输入上面的命令并按Enter键后,将开始对Ubuntu 20.04开发版本进行系统升级。

Checking for a new Ubuntu release
Get:1 Upgrade tool signature [1,554 B]                                         
Get:2 Upgrade tool [1,335 kB]                                                  
Fetched 1,337 kB in 0s (0 B/s)                                                 
authenticate 'focal.tar.gz' against 'focal.tar.gz.gpg' 
extracting 'focal.tar.gz'

Reading cache

Checking package manager
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Hit http://ke.archive.ubuntu.com/ubuntu bionic InRelease                       
Hit http://ke.archive.ubuntu.com/ubuntu bionic-updates InRelease               
Hit http://ke.archive.ubuntu.com/ubuntu bionic-backports InRelease             
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]    
Fetched 88.7 kB in 0s (0 B/s)                                                  
Reading package lists... Done    
Building dependency tree          
Reading state information... Done

Checking for installed snaps
...

回答升级过程中出现的问题。

...
Do you want to start the upgrade? 


36 installed packages are no longer supported by Canonical. You can 
still get support from the community. 

13 packages are going to be removed. 246 new packages are going to be 
installed. 1256 packages are going to be upgraded. 

You have to download a total of 810 M. This download will take about 
11 minutes with your connection. 

Installing the upgrade can take several hours. Once the download has 
finished, the process cannot be canceled. 

 Continue [yN]  Details [d] y

接受升级,然后按Enter键继续。

在升级过程中,您将看到更改,例如桌面版本背景。

当提示您删除旧软件包时,接受并按Enter继续。

...
Searching for obsolete software
Reading state information... Done

Remove obsolete packages? 


86 packages are going to be removed. 

 Continue [yN]  Details [d]y

系统升级完成后,请重新启动系统。

...
System upgrade is complete.

Restart required 

To finish the upgrade, a restart is required. 
If you select 'y' the system will be restarted. 

Continue [yN] y

您已成功将Ubuntu 18.04系统升级到Ubuntu 20.04。

到此结束了有关如何将Ubuntu 18.04升级到Ubuntu 20.04的教程。

文章来源:https://zh.codepre.com/how-to-4279.html