遇到了Linux新的内核启动卡死,老内核正常运行,索性就启动不了内核进行删除。

1. 查看当前运行的内核

在终端运行以下命令:

uname -r

会得到下面这样的信息:

5.15.0-97-generic

2. 列出所有安装的内核

列出所有已安装的内核:

dpkg --list | grep linux-image

这个命令将显示所有已安装的Linux内核包,如下所示:

rc  linux-image-5.15.0-100-generic                5.15.0-100.110~20.04.1                      amd64        Signed kernel image generic
rc  linux-image-5.15.0-101-generic                5.15.0-101.111~20.04.1                      amd64        Signed kernel image generic
rc  linux-image-5.15.0-102-generic                5.15.0-102.112~20.04.1                      amd64        Signed kernel image generic
ii  linux-image-5.15.0-105-generic                5.15.0-105.115~20.04.1                      amd64        Signed kernel image generic
rc  linux-image-5.15.0-67-generic                 5.15.0-67.74~20.04.1                        amd64        Signed kernel image generic
rc  linux-image-5.15.0-84-generic                 5.15.0-84.93~20.04.1                        amd64        Signed kernel image generic
rc  linux-image-5.15.0-86-generic                 5.15.0-86.96~20.04.1                        amd64        Signed kernel image generic
rc  linux-image-5.15.0-87-generic                 5.15.0-87.97~20.04.1                        amd64        Signed kernel image generic
rc  linux-image-5.15.0-88-generic                 5.15.0-88.98~20.04.1                        amd64        Signed kernel image generic
rc  linux-image-5.15.0-89-generic                 5.15.0-89.99~20.04.1                        amd64        Signed kernel image generic
rc  linux-image-5.15.0-91-generic                 5.15.0-91.101~20.04.1                       amd64        Signed kernel image generic
rc  linux-image-5.15.0-92-generic                 5.15.0-92.102~20.04.1                       amd64        Signed kernel image generic
rc  linux-image-5.15.0-94-generic                 5.15.0-94.104~20.04.1                       amd64        Signed kernel image generic
ii  linux-image-5.15.0-97-generic                 5.15.0-97.107~20.04.1                       amd64        Signed kernel image generic
ii  linux-image-generic-hwe-20.04                 5.15.0.105.115~20.04.1                      amd64        Generic Linux kernel image

3. 删除内核

使用apt-getapt命令删除不需要的内核。比如 linux-image-5.15.0-105-generic的内核,可以使用:

sudo apt-get purge linux-image-5.15.0-105-generic

4. 更新引导加载器

完成内核的删除后,更新GRUB配置以确保启动加载器的菜单被更新:

sudo update-grub

5. 重启系统

最后,重启系统以确认更改:

sudo reboot