Ubuntu 20.04 升级最新内核
Canonical宣布“Livepatch Services”上线,在为Linux Kernel安装更新之后并不需要重新启动计算机。自Linux 4.0分支开始用户就能在不重新启动的情况下更新内核包,不过Ubuntu是首个提供这项功能的发行版本。
运行更新命令
下载ubuntu-mainline-kernel脚本
wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh
将脚本放在可执行路径中
sudo install ubuntu-mainline-kernel.sh /usr/local/bin/
检查最新的可用内核版本
ubuntu-mainline-kernel.sh -c
获得最新版本并确认这就是您想要安装在系统上的版本之后,运行
sudo ubuntu-mainline-kernel.sh -i
重新启动系统并检查内核版本
uname -rs
卸载最新的Linux Kernel
sudo ubuntu-mainline-kernel.sh -u
首先重启系统,然后运行以下命令:
uname -rs
安装指定内核版本
还是上文的安装脚本:
例如安装
# ubuntu-mainline-kernel.sh --help
Usage: /usr/local/bin/ubuntu-mainline-kernel.sh -c|-l|-r|-u
Download & install the latest kernel available from kernel.ubuntu.com
Arguments:
-c Check if a newer kernel version is available
-i [VERSION] Install kernel VERSION, see -l for list. You don't have to prefix
with v. E.g. -i 4.9 is the same as -i v4.9. If version is
omitted the latest available version will be installed
-l [SEARCH] List locally installed kernel versions. If an argument to this
option is supplied it will search for that
-r [SEARCH] List available kernel versions. If an argument to this option
is supplied it will search for that
-u [VERSION] Uninstall the specified kernel version. If version is omitted,
a list of max 10 installed kernel versions is displayed
-h Show this message
Optional:
-s, --signed Only install signed kernel packages (not implemented)
-p, --path DIR The working directory, .deb files will be downloaded into
this folder. If omitted, the folder /tmp/ubuntu-mainline-kernel.sh/
is used. Path is relative from $PWD
-ll, --low-latency Use the low-latency version of the kernel, only for amd64 & i386
-lpae, --lpae Use the Large Physical Address Extension kernel, only for armhf
--snapdragon Use the Snapdragon kernel, only for arm64
-do, --download-only Only download the deb files, do not install them
-ns, --no-signature Do not check the gpg signature of the checksums file
-nc, --no-checksum Do not check the sha checksums of the .deb files
-d, --debug Show debug information, all internal command's echo their output
--rc Also include release candidates
--yes Assume yes on all questions (use with caution!)
1234567891011121314151617181920212223242526272829303132
# ubuntu-mainline-kernel.sh -i v5.8.0
Downloading index from kernel.ubuntu.com
Will download 6 files from kernel.ubuntu.com:
Downloading amd64/linux-headers-5.8.0-050800-generic_5.8.0-050800.202008022230_amd64.deb: 100%
Downloading amd64/linux-headers-5.8.0-050800_5.8.0-050800.202008022230_all.deb: 100%
Downloading amd64/linux-image-unsigned-5.8.0-050800-generic_5.8.0-050800.202008022230_amd64.deb: 100%
Downloading amd64/linux-modules-5.8.0-050800-generic_5.8.0-050800.202008022230_amd64.deb: 100%
Downloading amd64/CHECKSUMS: 100%
Downloading amd64/CHECKSUMS.gpg: 100%
Importing kernel-ppa gpg key ok
Signature of checksum file has been successfully verified
Checksums of deb files have been successfully verified with sha256sum
Installing 4 packages
Cleaning up work folder
1234567891011121314
重新启动系统并检查内核版本
# uname -rs
Linux 5.8.0-050800-generic
12
前面的是Linux内核官方发布的内核版本,连字符后面的是Ubuntu内核定制小组的对应发行版内核修订号。