Linux under the lack of boot space solution


In the process of installing linux, I like to hang the boot hang separate partition, generally set 500M, with the Linux upgrade, often will smash several kernels, one day the system will prompt Your upgrade failed and there is not enough space.

Since I already know that the boot space is insufficient, first of all, let's see that there are gods and horses inside! !
BASICranger@ranger:~$ ls /boot

abi-2.6.35-25-generic memtest86+.bin

abi-2.6.35-27-generic memtest86+_multiboot.bin


config-2.6.35-25-generic< Br>


config-2.6.35-28-generic vmcoreinfo-2.6.35-25-generic< Br>

grub vmcoreinfo-2.6.35-27-generic

initrd.img-2.6.35-25-generic vmcoreinfo-2.6.35-28-generic

initrd.img -2.6.35-27-generic vmlinuz-2.6.35-25-generic

initrd.img-2.6.35-28-generic vmlinuz-2.6.35-27-generic

lost +found vmlinuz-2.6.35-28-generic

We can see that there are some kernel startup files. Obviously, some of them are not needed. In fact, I have already uninstalled the two older kernels. The situation, no discussion, no need to deal with garbage.

First, please use uname -a to see which kernel you are currently booting.
BASICranger@ranger:~$ uname -a

Linux expired 2.6.35-28-generic #49-Ubuntu SMP Tue Mar 1 14:39:03 UTC 2011 x86_64 GNU/Linux

From You can see that I started with 2.6.35-28-generic at the moment, and then use the dpkg command to see which kernel files are on your machine.
BASICranger@ranger:~$ dpkg -get-selections | Grep linux-image

linux-image-2.6.35-22-generic deinstall

linux-image-2.6.35-24-generic deinstall

linux-image-2.6.35 -25-generic install

linux-image-2.6.35-27-generic install

linux-image-2.6.35-28-generic install

linux-image -generic install

A lot, in theory, except for the ones that are being used, you can delete them, but the things you just upgraded may be unstable. For the sake of insurance, keep 1-2 previous versions.

Run the apt-get remove command to unload unwanted kernels.
BASICranger@ranger:~$ sudo apt-get remove linux-image-2.6.35-25-generic

The following packages will be REMOVED:

linux-image-2.6.35-25 -generic

0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.

After this operation, 139MB disk space will be freed.

Do you want to Continue [Y/n]? y

The above prompt appears asking if you want to continue, press y or press Enter to continue. Upon completion, you will get the following prompt:

DKMS: uninstall Completed.

Examining /etc/kernel/postrm.d .

run-parts: executing /etc/kernel/Postrm.d/initramfs-tools 2.6.35-25-generic /boot/vmlinuz-2.6.35-25-generic

run-parts: executing /etc/kernel/postrm.d/zz-update- Grub 2.6.35-25-generic /boot/vmlinuz-2.6.35-25-generic

Generating grub.cfg …

Found linux image: /boot/vmlinuz-2.6.35 -28-generic

Found initrd image: /boot/initrd.img-2.6.35-28-generic

Found linux image: /boot/vmlinuz-2.6.35-27-generic

Found initrd image: /boot/initrd.img-2.6.35-27-generic

Found memtest86+ image: /memtest86+.bin

Found Windows< Br> 7 (loader) on /dev/sda1

Found Windows Vista (loader) on /dev/sda4


The current ubuntu will automatically rebuild the boot menu grub .cfg, so one step is in place. After uninstalling, you can use the df command to see the space usage of the boot partition.
BASICranger@ranger:~$ df

Filesystem 1K-blocks Used Available Use% Mounted on

/dev/sda9 19223252 9429624 8817144 52% /

/dev/sda7 93207 53279 35116 61% /boot

ok, has freed up 35m of space, now you can run sudo apt-get upgrade to upgrade.

Use dpkg to see what's left.
BASICranger@ranger:~$ dpkg -get-selections |  Grep linux-image

linux-image-2.6.35-25-generic deinstall

linux-image-2.6.35-27-generic install

linux-image-2.6.35 -28-generic install

linux-image-generic install

linux-image-2.6.35-25-generic shows deinstall, indicating that it has been deleted, maybe you think it is not good to keep this. , then restart and run the uninstall command again:
BASICranger@ranger:~$apt-get remove linux-image-2.6.35-25-generic

Copyright © Windows knowledge All Rights Reserved