Linux Ubuntu 20.04 LTS 更新到最新长期支持内核 v5.10.9 home 编辑时间 2021/01/20 ![](/api/file/getImage?fileId=60079f4816199b501c01ba2d) <br><br> ## 前言 新内核一般会支持更多新特性,对新硬件支持也会更好,例如如果要用 `RTX30` 系显卡,或 `AMD 4800H` 的核显,那就必须用新内核 缺点是可能资源负载略高于老内核,更推荐使用长期支持版的内核 <br> `Linux Ubuntu 20.04` 的默认内核是 `5.4.x` 目前推荐的版本是 `5.10.9` 本文会简单概述如何更新内核,如果删除旧内核 <br><br> ## 动手 进入链接 [https://kernel.ubuntu.com/~kernel-ppa/mainline/?C=N;O=D](https://kernel.ubuntu.com/~kernel-ppa/mainline/?C=N;O=D) 找到 `5.10.9` <br> 根据电脑64位处理器 选择 AMD64 ```shell Test amd64/build succeeded (rc=0, on=amd64, time=0:18:33, log=amd64/log) amd64/linux-headers-5.10.9-051009-generic_5.10.9-051009.202101191835_amd64.deb amd64/linux-headers-5.10.9-051009-lowlatency_5.10.9-051009.202101191835_amd64.deb amd64/linux-headers-5.10.9-051009_5.10.9-051009.202101191835_all.deb amd64/linux-image-unsigned-5.10.9-051009-generic_5.10.9-051009.202101191835_amd64.deb amd64/linux-image-unsigned-5.10.9-051009-lowlatency_5.10.9-051009.202101191835_amd64.deb amd64/linux-modules-5.10.9-051009-generic_5.10.9-051009.202101191835_amd64.deb amd64/linux-modules-5.10.9-051009-lowlatency_5.10.9-051009.202101191835_amd64.deb ``` <br> 这里里面还分了 `generic` 和 `lowlatency` 所以这里面的 `*_all.deb` 是必选,其他都是2选1 ```shell amd64/linux-headers-5.10.9-051009_5.10.9-051009.202101191835_all.deb ``` <br> 推荐选 `generic` ,那么最终下载的就是下面这4个 ```shell amd64/linux-headers-5.10.9-051009-generic_5.10.9-051009.202101191835_amd64.deb amd64/linux-headers-5.10.9-051009_5.10.9-051009.202101191835_all.deb amd64/linux-image-unsigned-5.10.9-051009-generic_5.10.9-051009.202101191835_amd64.deb amd64/linux-modules-5.10.9-051009-generic_5.10.9-051009.202101191835_amd64.deb ``` 然后新建一个文件夹,把这4个文件放进去,cd到目录,执行安装命令 ```shell sudo dpkg -i *.deb ``` <br> 装完重启 <br> 然后再试试内核版本有没有变 ```shell uname -a ``` <br> 返回这样就正确了 ```shell Linux ubuntu 5.10.9-051009-generic ``` <br> 接下来是删除未被用到的内核来节约硬盘空间,这一步是可选的,毕竟老内核可以留着备用,万一哪天新内核炸了,切换老内核还有抢救的余地。所以见仁见智,这里只提一下方法。 <br> 首先用命令 看下一共装了哪些内核 ```shell sudo dpkg --get-selections |grep linux- ``` 返回 ```shell linux-base install linux-firmware install linux-generic-hwe-20.04 install linux-headers-5.10.9-051009 install linux-headers-5.10.9-051009-generic install linux-headers-5.8.0-36-generic install linux-headers-5.8.0-38-generic install linux-headers-5.9.12-050912 install linux-headers-5.9.12-050912-generic install linux-headers-5.9.12-050912-lowlatency install linux-headers-generic-hwe-20.04 install linux-hwe-5.8-headers-5.8.0-36 install linux-hwe-5.8-headers-5.8.0-38 install linux-image-5.4.0-42-generic deinstall linux-image-5.8.0-32-generic deinstall linux-image-5.8.0-34-generic deinstall linux-image-5.8.0-36-generic install linux-image-5.8.0-38-generic install linux-image-generic-hwe-20.04 install linux-image-unsigned-5.10.9-051009-generic install linux-image-unsigned-5.9.12-050912-generic install linux-image-unsigned-5.9.12-050912-lowlatency install linux-libc-dev:amd64 install linux-modules-5.10.9-051009-generic install linux-modules-5.4.0-42-generic deinstall linux-modules-5.8.0-32-generic deinstall linux-modules-5.8.0-34-generic deinstall linux-modules-5.8.0-36-generic install linux-modules-5.8.0-38-generic install linux-modules-5.9.12-050912-generic install linux-modules-5.9.12-050912-lowlatency install linux-modules-extra-5.4.0-42-generic deinstall linux-modules-extra-5.8.0-32-generic deinstall linux-modules-extra-5.8.0-34-generic deinstall linux-modules-extra-5.8.0-36-generic install linux-modules-extra-5.8.0-38-generic install linux-sound-base install ``` <br> 这里面重点关心 `linux-header-*` `linux-image-*` `linux-modules-*` 我这里会选择保留5.8和5.10,删掉之前装的5.9.x <br> 这里有2个状态 **`deinstall`** 属于装过 现在已删除,只是一条记录,理论上留着也没事,但强迫症一定要删记录可以用这个命令 ```shell # 注意只针对 deinstall 的用这个命令 sudo dpkg -P linux-modules-extra-5.4.0-42-generic ``` **`install`** 属于已安装 现在还在硬盘 需要删除用这个命令 ```shell sudo apt-get remove linux-modules-5.9.12-050912-generic # 如果要更彻底删除并清理配置文件,加一个--purge sudo apt-get remove --purge linux-modules-5.9.12-050912-generic # 结束以后再清理以下 sudo apt autoremove # 建议也重启一下 ``` <br> 我这里最终效果如下 ```shell # 查看命令 sudo dpkg --get-selections |grep linux- # 返回结果 binutils-x86-64-linux-gnu install linux-base install linux-firmware install linux-generic-hwe-20.04 install linux-headers-5.10.9-051009 install linux-headers-5.10.9-051009-generic install linux-headers-5.8.0-36-generic install linux-headers-5.8.0-38-generic install linux-headers-generic-hwe-20.04 install linux-hwe-5.8-headers-5.8.0-36 install linux-hwe-5.8-headers-5.8.0-38 install linux-image-5.8.0-36-generic install linux-image-5.8.0-38-generic install linux-image-generic-hwe-20.04 install linux-image-unsigned-5.10.9-051009-generic install linux-libc-dev:amd64 install linux-modules-5.10.9-051009-generic install linux-modules-5.8.0-36-generic install linux-modules-5.8.0-38-generic install linux-modules-extra-5.8.0-36-generic install linux-modules-extra-5.8.0-38-generic install linux-sound-base install ``` 大约是减少了1G左右的磁盘占用 ## END 送人玫瑰,手留余香 赞赏 Wechat Pay Alipay Vue Cli3 SPA 项目 SEO 终极方案 Rendertron 后端渲染 Linux Ubuntu 20.04 LTS Docker 安装 微信 QQ