删除旧内核以释放磁盘空间

删除旧内核以释放磁盘空间

我的系统有旧的 Ubuntu 内核,但我无法删除它们。我该如何删除旧内核以释放硬盘空间。以下是我尝试的一些命令的输出:

$ sudo apt-get remove --purge linux-image-3.13.0-29-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-3.13.0-29-generic* linux-image-extra-3.13.0-29-generic*
0 upgraded, 0 newly installed, 2 to remove and 265 not upgraded.
After this operation, 193 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 216178 files and directories currently installed.)
Removing linux-image-extra-3.13.0-29-generic (3.13.0-29.53) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-29-generic /boot/vmlinuz-3.13.0-29-generic
update-initramfs: Deleting /boot/initrd.img-3.13.0-29-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-29-generic /boot/vmlinuz-3.13.0-29-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.13.0-30-generic
Found initrd image: /boot/initrd.img-3.13.0-30-generic
Found linux image: /boot/vmlinuz-3.13.0-29-generic
Found linux image: /boot/vmlinuz-2.6.38-16-generic
Found initrd image: /boot/initrd.img-2.6.38-16-generic
Found linux image: /boot/vmlinuz-2.6.38-15-generic
Found initrd image: /boot/initrd.img-2.6.38-15-generic
Found linux image: /boot/vmlinuz-2.6.38-13-generic
Found initrd image: /boot/initrd.img-2.6.38-13-generic
Found linux image: /boot/vmlinuz-2.6.38-12-generic
Found initrd image: /boot/initrd.img-2.6.38-12-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+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 8 (loader) on /dev/sda1
done
The link /initrd.img.old is a damaged link
Removing symbolic link initrd.img.old 
 you may need to re-run your boot loader[grub]
Purging configuration files for linux-image-extra-3.13.0-29-generic (3.13.0-29.53) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-29-generic /boot/vmlinuz-3.13.0-29-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-29-generic /boot/vmlinuz-3.13.0-29-generic
Removing linux-image-3.13.0-29-generic (3.13.0-29.53) ...
Examining /etc/kernel/prerm.d.
run-parts: executing /etc/kernel/prerm.d/dkms 3.13.0-29-generic /boot/vmlinuz-3.13.0-29-generic
dkms: removing: bcmwl 6.30.223.141+bdcom (3.13.0-29-generic) (x86_64)

-------- Uninstall Beginning --------
Module:  bcmwl
Version: 6.30.223.141+bdcom
Kernel:  3.13.0-29-generic (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

wl.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.13.0-29-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

还,

$ depmod
DKMS: uninstall completed.
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-29-generic /boot/vmlinuz-3.13.0-29-generic
update-initramfs: Deleting /boot/initrd.img-3.13.0-29-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-29-generic /boot/vmlinuz-3.13.0-29-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.13.0-30-generic
Found initrd image: /boot/initrd.img-3.13.0-30-generic
Found linux image: /boot/vmlinuz-2.6.38-16-generic
Found initrd image: /boot/initrd.img-2.6.38-16-generic
Found linux image: /boot/vmlinuz-2.6.38-15-generic
Found initrd image: /boot/initrd.img-2.6.38-15-generic
Found linux image: /boot/vmlinuz-2.6.38-13-generic
Found initrd image: /boot/initrd.img-2.6.38-13-generic
Found linux image: /boot/vmlinuz-2.6.38-12-generic
Found initrd image: /boot/initrd.img-2.6.38-12-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+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 8 (loader) on /dev/sda1
done
The link /vmlinuz.old is a damaged link
Removing symbolic link vmlinuz.old 
 you may need to re-run your boot loader[grub]
Purging configuration files for linux-image-3.13.0-29-generic (3.13.0-29.53) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-29-generic /boot/vmlinuz-3.13.0-29-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-29-generic /boot/vmlinuz-3.13.0-29-generic

我试过

abhay@abhay-HP-Pavilion-dv5-Notebook-PC:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda7       7.7G  6.6G  776M  90% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            1.5G   12K  1.5G   1% /dev
tmpfs           295M  1.5M  293M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            1.5G  156K  1.5G   1% /run/shm
none            100M   40K  100M   1% /run/user

然后重试,

abhay@abhay-HP-Pavilion-dv5-Notebook-PC:~$ sudo apt-get remove --purge linux-image-2.6.38-8-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package linux-image-2.6.38-8-generic
E: Couldn't find any package by regex 'linux-image-2.6.38-8-generic'

还,

abhay@abhay-HP-Pavilion-dv5-Notebook-PC:~$ sudo apt-get remove --purge linux-image-2.6.38-10-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package linux-image-2.6.38-10-generic
E: Couldn't find any package by regex 'linux-image-2.6.38-10-generic'

和,

abhay@abhay-HP-Pavilion-dv5-Notebook-PC:~$ du -sh /var/tmp
4.0K    /var/tmp

答案1

ubuntu-调整对于初学者来说是更好的解决方案。

安装sudo apt-get install ubuntu-tweak

使用删除旧内核ubuntu-调整

  • 使用start janitorubuntu-tweak 窗口中的按钮
  • 点击old kernel复选框
  • 选择旧内核
  • 点击clean

在此处输入图片描述

相关内容