我经常使用 Synaptic 删除旧内核,只留下最新的两个条目。
我正在使用精确。但是,在我的 Grub“以前的 Linux 版本”菜单中,有很多条目标记为 2.6.8。我在 Synaptic 中找不到这些 linux 映像。
dpkg -l | grep linux-image
Run Code Online (Sandbox Code Playgroud)
给出:
rc linux-image-3.0.0-17-generic 3.0.0-17.30
Linux kernel image for version 3.0.0 on x86/x86_64
ii linux-image-3.2.0-27-generic 3.2.0-27.43
Linux kernel image for version 3.2.0 on 32 bit x86 SMP
ii linux-image-3.2.0-29-generic 3.2.0-29.46
Linux kernel image for version 3.2.0 on 32 bit x86 SMP
ii linux-image-3.4.0-030400-generic 3.4.0-030400.201205210521
Linux kernel image for version 3.4.0 on 32 bit x86 SMP
ii linux-image-generic 3.2.0.29.31
Generic Linux kernel image
Run Code Online (Sandbox Code Playgroud)
Sudo update-grub 给出:
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.4.0-030400-generic
Found initrd image: /boot/initrd.img-3.4.0-030400-generic
Found linux image: /boot/vmlinuz-3.2.0-29-generic
Found initrd image: /boot/initrd.img-3.2.0-29-generic
Found linux image: /boot/vmlinuz-3.2.0-27-generic
Found initrd image: /boot/initrd.img-3.2.0-27-generic
Found linux image: /boot/vmlinuz-2.6.38-11-generic
Found initrd image: /boot/initrd.img-2.6.38-11-generic
Found linux image: /boot/vmlinuz-2.6.38-10-generic
Found initrd image: /boot/initrd.img-2.6.38-10-generic
Found linux image: /boot/vmlinuz-2.6.38-8-generic
Found initrd image: /boot/initrd.img-2.6.38-8-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows Vista (loader) on /dev/sda1
Run Code Online (Sandbox Code Playgroud)
sudo apt-get remove linux-image-2.6.8-8-generic 给出:
E: Unable to locate package linux-image-2.6.8-8-generic
E: Couldn't find any package by regex 'linux-image-2.6.8-8-generic'
Run Code Online (Sandbox Code Playgroud)
我的启动文件夹包含以下内容:
abi-2.6.38-10-generic initrd.img-3.4.0-030400-generic abi-2.6.38-11-generic memtest86+.bin abi-2.6.38-8-generic memtest86+_multiboot.bin abi-3.2.0-27-generic System.map-2.6.38-10-generic abi-3.2.0-29-generic System.map-2.6.38-11-generic abi-3.4.0-030400-generic System.map-2.6.38-8-generic config-2.6.38-10-generic System.map-3.2.0-27-generic config-2.6.38-11-generic System.map-3.2.0-29-generic config-2.6.38-8-generic System.map-3.4.0-030400-generic config-3.2.0-27-generic vmcoreinfo-2.6.38-10-generic config-3.2.0-29-generic vmcoreinfo-2.6.38-11-generic config-3.4.0-030400-generic vmcoreinfo-2.6.38-8-generic extlinux vmlinuz-2.6.38-10-generic grub vmlinuz-2.6.38-11-generic initrd.img-2.6.38-10-generic vmlinuz-2.6.38-8-generic initrd.img-2.6.38-11-generic vmlinuz-3.2.0-27-generic initrd.img-2.6.38-8-generic vmlinuz-3.2.0-29-generic initrd.img-3.2.0-27-generic vmlinuz-3.4.0-030400-generic initrd.img-3.2.0-29-generic
和
ls -l /etc/grub.d产量:
共 56 个 -rwxr-xr-x 1 根根 6715 4 月 17 日 20:16 00_header -rwxr-xr-x 1 根 5522 2011 年 10 月 1 日 05_debian_theme -rwxr-xr-x 1 root root 7407 May 17 09:22 10_linux -rwxr-xr-x 1 根 6335 4 月 17 日 20:16 20_linux_xen -rwxr-xr-x 1 根 1588 2011 年 5 月 3 日 20_memtest86+ -rwxr-xr-x 1 根 7603 4 月 17 日 20:16 30_os-prober -rwxr-xr-x 1 根 214 Oct 1 2011 40_custom -rwxr-xr-x 1 根 2011 年 10 月 1 日 95 日 41_custom -rw-r--r-- 1 根 483 2011 年 10 月 1 日自述文件
gdisk -l /dev/sda
Run Code Online (Sandbox Code Playgroud)
产量:
分区表扫描: MBR:仅 MBR BSD:不存在 APM:不存在 GPT:不存在 ****************************************************** ************* 发现无效的 GPT 和有效的 MBR;将 MBR 转换为 GPT 格式。 ****************************************************** ************* 磁盘 /dev/sda:312581808 个扇区,149.1 GiB 逻辑扇区大小:512 字节 磁盘标识符 (GUID):F832A498-05E1-4615-B5B1-757ACB4A757A 分区表最多可容纳 128 个条目 第一个可用扇区是 34,最后一个可用扇区是 312581774 分区将在 2048 个扇区边界上对齐 总可用空间为 4183661 个扇区 (2.0 GiB) 编号开始(扇区)结束(扇区)大小代码名称 1 2048 61442047 29.3 GiB 0700 微软基本数据 3 163842048 169986047 2.9 GiB 8200 Linux 交换 4 169986048 312578047 68.0 GiB 0700 微软基本数据 5 61444096 159666175 46.8 GiB 8300 Linux 文件系统
请帮助从 Grub 中删除旧的和不存在的内核。
gre*_*een 58
打开一个终端(Ctrl+ Alt+ T)。
键入uname -r
。这将显示您当前使用的内核,因此您不想删除它。
运行以下命令:dpkg --list | grep linux-image
。这将显示已安装的所有内核。
记下要删除的所有内核的名称。
要删除的内核,运行:sudo apt-get purge linux-image-x.x.x.x-xyz
(用适当的更换内核名称)。
更新 GRUB: sudo update-grub2
而且,你已经完成了。
奖励:这是一个自动完成所有这些的小单行:
sudo apt-get purge $( dpkg --list | grep -P -o "linux-image-\d\S+" | grep -v $(uname -r | grep -P -o ".+\d") )
Run Code Online (Sandbox Code Playgroud)
To *_* Do 11
我发现这个问题是什么。
问题是,当我升级 Ubuntu 时,通过 liveUSB 安装而不是进行正常升级,它在 /boot 文件夹中留下了旧的内核文件。
现在我用同样的方法从12.10升级到13.04,遇到了同样的情况。
解决方法是手动删除 /boot 文件夹中所有与旧内核相关的文件并运行sudo update-grub
. 多余的条目消失了。
小智 6
试试这个命令。它是相同apt-get remove
命令的改进版本
sudo apt-get autoremove linux-image-3.2.0-23-generic-pae
Run Code Online (Sandbox Code Playgroud)
通过将remove替换为autoremove,删除过程会自动查找并删除剩余的其他依赖项,因此您将获得干净的卸载,而不必四处走动并删除剩余部分。
对其他旧内核也重复此过程。
之后,运行
sudo update-grub
Run Code Online (Sandbox Code Playgroud)
之后,您将只看到最新的内核。
归档时间: |
|
查看次数: |
97894 次 |
最近记录: |