我运行了以下命令:
dpkg -l | grep linux-image-
并得到这个列表
rc linux-image-3.13.0-51-generic 3.13.0-51.84
rc linux-image-3.13.0-52-generic 3.13.0-52.86 rc linux-image-3.13.0-53-generic 3.13.0-53.89
rc linux-image-3.13.0-54-generic 3.13.0-54.91
rc linux-image-3.13.0-55-generic 3.13.0-55.94 rc linux-image-3.13.0-57-generic 3.13.0-57.95 rc linux-image-3.13.0-58-generic 3.13.0-58.97
rc linux-image-3.13.0-59-generic 3.13.0-59.98
rc linux-image-3.13.0-61-generic 3.13.0-61.100
ii linux-image-3.13.0-62-generic 3.13.0-62.102
rc linux-image-extra-3.13.0-30-generic 3.13.0-30.55 rc linux-image-extra-3.13.0-46-generic 3.13.0-46.79
rc linux-image-extra-3.13.0-49-generic 3.13.0-49.83
rc linux-image-extra-3.13.0-51-generic 3.13.0-51.84
rc linux-image-extra-3.13.0-52-generic 3.13.0-52.86 rc linux-image-extra-3.13.0-53-generic 3.13.0-53.89
rc linux-image-extra-3.13.0-54-generic 3.13.0-54.91
rc linux-image-extra-3.13.0-55-generic 3.13.0-55.94
rc linux-image-extra-3.13.0-57-generic 3.13.0-57.95
rc linux-image-extra-3.13.0-58-generic 3.13.0-58.97
rc linux-image-extra-3.13.0-59-generic 3.13.0-59.98
rc linux-image-extra-3.13.0-61-generic 3.13.0-61.100
ii linux-image-extra-3.13.0-62-generic 3.13.0-62.102
ii linux-image-generic 3.13.0.62.69
于是我运行:
sudo apt-get autoremove linux-image-3.13.0-51-generic
并得到这个:
Reading package lists... Done Building dependency tree
Reading state information... Done Package 'linux-image-3.13.0-51-generic' is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
那么我的系统上是否有未使用的旧内核以及我应该如何删除它们?
答案1
在生成的内核列表的前两列中,dpkg -l
您将找到有关该软件包的信息,如下所示:
列(所需操作):
u = Unknown i = Install h = Hold r = Remove p = Purge
列(包裹状态):
n = Not-installed c = Config-files H = Half-installed U = Unpacked F = Half-configured W = Triggers-awaiting t = Triggers-pending i = Installed
对于您的第一个例子
rc linux-image-3.13.0-51-generic 3.13.0-51.84
因此它会告诉我们软件包已被删除 ( r
),但配置文件仍然存在 ( c
)。只有那些标记的内核ii
才会真正安装在您的系统上。Autoremove 只会删除过时的内核,但会保留配置文件。
要删除这些,我们必须清除已安装的包(sudo apt-get purge <package>
),但保留它们不会造成任何损害,而且它们不需要太多的硬盘空间。
答案2
根据您的输出,所有旧内核已被删除。
您仅安装了内核 3.13.0-62。
答案3
sudo apt-get autoremove linux-image-3.13.0-51-generic
过去我曾成功做过以下事情:
sudo apt-get purge linux-image-3.13.0-51-generic
如果这不起作用,请尝试阅读这篇精彩的文章:
http://tuxtweaks.com/2010/10/remove-old-kernels-in-ubuntu-with-one-command/
答案4
首先删除标题。查看ls /usr/src | grep linux-headers
标题,然后使用清除:
sudo apt-get purge linux-headers-xxx
进而
sudo apt-get purge linux-image-xxx