Ubuntu Server清理无用内核

Posted by Elton's Blog on December 25, 2012

随着系统的升级,无用内核也慢慢累积得越来越多,所以要定时清理,下面是清理的过程。

dpkg --get-selections|grep linux

libselinux1:amd64				install
linux-firmware					install
linux-generic					install
linux-headers-3.5.0-17				install
linux-headers-3.5.0-19-generic			install
linux-headers-3.5.0-17				install
linux-headers-3.5.0-19-generic			install
linux-headers-3.5.0-21				install
linux-headers-3.5.0-21-generic			install
linux-headers-generic				install
linux-image-3.5.0-17-generic			install
linux-image-3.5.0-19-generic			install
linux-image-3.5.0-21-generic			install
linux-image-extra-3.5.0-17-generic		install
linux-image-extra-3.5.0-19-generic		install
linux-image-extra-3.5.0-21-generic		install
linux-image-generic				install
linux-libc-dev:amd64				install
util-linux					install

需要分别清楚header和image,可以直接用apt-get remove来清除。

sudo apt-get remove linux-headers-3.5.0-17
sudo apt-get remove linux-headers-3.5.0-17-generic
sudo apt-get remove linux-headers-3.5.0-19
sudo apt-get remove linux-headers-3.5.0-19-generic
sudo apt-get remove linux-image-3.5.0-17-generic
sudo apt-get remove linux-image-3.5.0-19-generic

之后再执行

dpkg --get-selections|grep linux

libselinux1:amd64				install
linux-firmware					install
linux-generic					install
linux-headers-3.5.0-21				install
linux-headers-3.5.0-21-generic			install
linux-headers-generic				install
linux-image-3.5.0-17-generic			deinstall
linux-image-3.5.0-19-generic			deinstall
linux-image-3.5.0-21-generic			install
linux-image-extra-3.5.0-17-generic		deinstall
linux-image-extra-3.5.0-19-generic		deinstall
linux-image-extra-3.5.0-21-generic		install
linux-image-generic				install
linux-libc-dev:amd64				install
util-linux					install

清理完毕