[备忘]Ubuntu升级后删除旧内核
作者:互联网
1. 查询正在使用内核版本
think@think-ubuntu:~$ uname -r
5.11.0-43-generic
2. 查询当前系统内有多少个内核
think@think-ubuntu:~$ dpkg --list|grep linux-image
rc linux-image-5.11.0-27-generic 5.11.0-27.29~20.04.1 amd64 Signed kernel image generic
rc linux-image-5.11.0-36-generic 5.11.0-36.40~20.04.1 amd64 Signed kernel image generic
ii linux-image-5.11.0-37-generic 5.11.0-37.41~20.04.2 amd64 Signed kernel image generic
rc linux-image-5.11.0-40-generic 5.11.0-40.44~20.04.2 amd64 Signed kernel image generic
ii linux-image-5.11.0-41-generic 5.11.0-41.45~20.04.1 amd64 Signed kernel image generic
ii linux-image-5.11.0-43-generic 5.11.0-43.47~20.04.2 amd64 Signed kernel image generic
rc linux-image-5.4.0-42-generic 5.4.0-42.46 amd64 Signed kernel image generic
rc linux-image-5.4.0-56-generic 5.4.0-56.62 amd64 Signed kernel image generic
rc linux-image-5.4.0-58-generic 5.4.0-58.64 amd64 Signed kernel image generic
rc linux-image-5.8.0-38-generic 5.8.0-38.43~20.04.1 amd64 Signed kernel image generic
rc linux-image-5.8.0-40-generic 5.8.0-40.45~20.04.1 amd64 Signed kernel image generic
rc linux-image-5.8.0-41-generic 5.8.0-41.46~20.04.1 amd64 Signed kernel image generic
rc linux-image-5.8.0-43-generic 5.8.0-43.49~20.04.1 amd64 Signed kernel image generic
rc linux-image-5.8.0-44-generic 5.8.0-44.50~20.04.1 amd64 Signed kernel image generic
rc linux-image-5.8.0-48-generic 5.8.0-48.54~20.04.1 amd64 Signed kernel image generic
rc linux-image-5.8.0-49-generic 5.8.0-49.55~20.04.1 amd64 Signed kernel image generic
rc linux-image-5.8.0-50-generic 5.8.0-50.56~20.04.1 amd64 Signed kernel image generic
rc linux-image-5.8.0-53-generic 5.8.0-53.60~20.04.1 amd64 Signed kernel image generic
rc linux-image-5.8.0-55-generic 5.8.0-55.62~20.04.1 amd64 Signed kernel image generic
rc linux-image-5.8.0-59-generic 5.8.0-59.66~20.04.1 amd64 Signed kernel image generic
rc linux-image-5.8.0-63-generic 5.8.0-63.71~20.04.1 amd64 Signed kernel image generic
ii linux-image-generic-hwe-20.04 5.11.0.43.47~20.04.21 amd64 Generic Linux kernel image
3. 删除不必要的内核版本,如 5.4.0-42.46
think@think-ubuntu:~$ sudo apt-get purge linux-image-5.4.0-42-generic
[sudo] think 的密码:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列软件包是自动安装的并且现在不需要了:
dctrl-tools dkms libnvidia-cfg1-460 libnvidia-common-460 libnvidia-compute-460 libnvidia-compute-460:i386 libnvidia-decode-460 libnvidia-decode-460:i386 libnvidia-encode-460 libnvidia-encode-460:i386
libnvidia-extra-460 libnvidia-fbc1-460 libnvidia-fbc1-460:i386 libnvidia-gl-460 libnvidia-gl-460:i386 libnvidia-ifr1-460 libnvidia-ifr1-460:i386 nvidia-compute-utils-460 nvidia-dkms-460 nvidia-utils-460
xserver-xorg-video-nvidia-460
使用'sudo apt autoremove'来卸载它(它们)。
下列软件包将被【卸载】:
linux-image-5.4.0-42-generic*
升级了 0 个软件包,新安装了 0 个软件包,要卸载 1 个软件包,有 3 个软件包未被升级。
解压缩后会消耗 0 B 的额外空间。
您希望继续执行吗? [Y/n] y
(正在读取数据库 ... 系统当前共安装有 276207 个文件和目录。)
正在清除 linux-image-5.4.0-42-generic (5.4.0-42.46) 的配置文件 ...
4. 删除第3步中显示的不必要的内核关联文件,建议不要使用autoremove,而用remove + 包名的方式。
think@think-ubuntu:~$ sudo apt-get remove dctrl-tools dkms libnvidia-cfg1-460 libnvidia-common-460 libnvidia-compute-460 libnvidia-compute-460:i386
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列软件包是自动安装的并且现在不需要了:
libnvidia-decode-460 libnvidia-decode-460:i386 libnvidia-encode-460 libnvidia-encode-460:i386 libnvidia-extra-460 libnvidia-fbc1-460 libnvidia-fbc1-460:i386 libnvidia-gl-460 libnvidia-gl-460:i386
libnvidia-ifr1-460 libnvidia-ifr1-460:i386 nvidia-compute-utils-460 nvidia-dkms-460 nvidia-utils-460 xserver-xorg-video-nvidia-460
使用'sudo apt autoremove'来卸载它(它们)。
下列软件包将被【卸载】:
dctrl-tools dkms libnvidia-cfg1-460 libnvidia-common-460 libnvidia-compute-460 libnvidia-compute-460:i386
升级了 0 个软件包,新安装了 0 个软件包,要卸载 6 个软件包,有 3 个软件包未被升级。
解压缩后将会空出 681 kB 的空间。
您希望继续执行吗? [Y/n] y
(正在读取数据库 ... 系统当前共安装有 276207 个文件和目录。)
正在卸载 dkms (2.8.1-5ubuntu2) ...
正在卸载 dctrl-tools (2.24-3) ...
正在卸载 libnvidia-cfg1-460:amd64 (470.103.01-0ubuntu0.20.04.1) ...
正在卸载 libnvidia-common-460 (470.103.01-0ubuntu0.20.04.1) ...
正在卸载 libnvidia-compute-460:amd64 (470.103.01-0ubuntu0.20.04.1) ...
正在卸载 libnvidia-compute-460:i386 (470.103.01-0ubuntu0.20.04.1) ...
正在处理用于 man-db (2.9.1-1) 的触发器 ...
标签:amd64,generic,image,linux,460,备忘,内核,Ubuntu,libnvidia 来源: https://blog.csdn.net/LateLinux/article/details/122819301