ubuntu 删除多余内核kernel
操作命令
# 查看当前使用的内核
uname -r
# 查看内核
dpkg --get-selections | grep linux
# 显示
binutils-x86-64-linux-gnu install
console-setup-linux install
libselinux1:amd64 install
libselinux1-dev:amd64 install
linux-base install
linux-firmware install
linux-generic-hwe-20.04 install
linux-headers-5.11.0-38-generic install
linux-headers-generic-hwe-20.04 install
linux-hwe-5.11-headers-5.11.0-38 install
linux-image-5.11.0-38-generic install
linux-image-generic-hwe-20.04 install
linux-libc-dev:amd64 install
linux-modules-5.11.0-38-generic install
linux-modules-extra-5.11.0-38-generic install
linux-modules-nvidia-470-5.11.0-38-generic install
linux-modules-nvidia-470-generic-hwe-20.04 install
linux-objects-nvidia-470-5.11.0-38-generic install
linux-signatures-nvidia-5.11.0-38-generic install
linux-sound-base install
linuxqq install
pptp-linux install
util-linux install
# 删除内核
_VER=5.11.0-34
dpkg --get-selections | grep $_VER | awk '{print $1}' | xargs apt remove -y
# 移除 deinstall 标识的信息
dpkg --get-selections | grep linux | grep deinstall | awk '{print $1}' | xargs dpkg -P