91Linux - headers
type: channel
link: https://91linux.org/tag/headers/
items: Ubuntu系统删除旧内核

Ubuntu系统删除旧内核
type: item
date: 2020-04-13T13:40:00+08:00
description: 警告删内核前请保存好您的数据信息随着每次升级 Ubuntu 系统，占用空间都会增大，虽然我们可以通过命令sudo apt-get autoclean sudo apt-get autoremove 来删除一些不必要的资源，但是系统内核还残留在硬盘里，而这些都是无用的，直到最近，boot 启动盘空间已满，导致系统出现bug，那么删除无用的内核势在必行。查看内核uname -a 查看当前系统内核信息：jp@jp-INST ~> uname -a Linux jp-INST 4.4.0-42-generic #62-Ubuntu SMP Fri Oct 7 23:11:45 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux 那么如何查看已经存在的内核呢，下面命令可以dpkg --get-selections| grep linux 我的系统如下：[jp-INST:~] [jp]% dpkg --get-selections| grep linux console-setup-linux install libselinux1:amd64 install libselinux1:i386 install linux-base install linux-firmware install linux-generic install linux-headers-4.4.0-22 install linux-headers-4.4.0-22-generic install linux-headers-4.4.0-24 install linux-headers-4.4.0-24-generic install linux-headers-4.4.0-28 install linux-headers-4.4.0-28-generic install linux-headers-4.4.0-31 install linux-headers-4.4.0-31-generic install linux-headers-4.4.0-34 install linux-headers-4.4.0-34-generic install linux-headers-4.4.0-36 install linux-headers-4.4.0-36-generic install linux-headers-4.4.0-38 install linux-headers-4.4.0-38-generic install linux-headers-4.4.0-42 install linux-headers-4.4.0-42-generic install linux-headers-generic install linux-image-4.2.0-21-generic deinstall linux-image-4.2.0-22-generic deinstall linux-image-4.4.0-31-generic deinstall linux-image-4.4.0-34-generic install linux-image-4.4.0-36-generic install linux-image-4.4.0-38-generic install linux-image-4.4.0-42-generic install linux-image-extra-4.2.0-21-generic deinstall linux-image-extra-4.4.0-31-generic deinstall linux-image-extra-4.4.0-34-generic deinstall linux-image-extra-4.4.0-36-generic deinstall linux-image-extra-4.4.0-38-generic install linux-image-extra-4.4.0-42-generic install linux-image-generic install linux-libc-dev:amd64 install linux-sound-base install pptp-linux install syslinux install syslinux-common install syslinux-legacy install util-linux install 卸载内核可以看到系统已经安装了多个内核版本，包括 headers 和 image ，可以删除这些来卸载旧的内核，比如删除 4.4.0-22 内核，我们看到上面只有 headers，因此可以这样：[jp-INST:~] …