Removing old kernel entries in Grub
- by To Do
I regularly delete old kernels leaving only the latest two entries using Synaptic.
I'm using Precise. However in my Grub "previous Linux version" menu there are quite a few entries labelled 2.6.8. I cannot find these linux-images in Synaptic.
dpkg -l | grep linux-image
Gives:
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
Sudo update-grub gives:
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
sudo apt-get remove linux-image-2.6.8-8-generic gives:
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'
My boot folder contains the following:
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
and ls -l /etc/grub.d yields:
total 56
-rwxr-xr-x 1 root root 6715 Apr 17 20:16 00_header
-rwxr-xr-x 1 root root 5522 Oct 1 2011 05_debian_theme
-rwxr-xr-x 1 root root 7407 May 17 09:22 10_linux
-rwxr-xr-x 1 root root 6335 Apr 17 20:16 20_linux_xen
-rwxr-xr-x 1 root root 1588 May 3 2011 20_memtest86+
-rwxr-xr-x 1 root root 7603 Apr 17 20:16 30_os-prober
-rwxr-xr-x 1 root root 214 Oct 1 2011 40_custom
-rwxr-xr-x 1 root root 95 Oct 1 2011 41_custom
-rw-r--r-- 1 root root 483 Oct 1 2011 README
gdisk -l /dev/sda
yields:
Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present
***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format.
***************************************************************
Disk /dev/sda: 312581808 sectors, 149.1 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): F832A498-05E1-4615-B5B1-757ACB4A757A
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 312581774
Partitions will be aligned on 2048-sector boundaries
Total free space is 4183661 sectors (2.0 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 61442047 29.3 GiB 0700 Microsoft basic data
3 163842048 169986047 2.9 GiB 8200 Linux swap
4 169986048 312578047 68.0 GiB 0700 Microsoft basic data
5 61444096 159666175 46.8 GiB 8300 Linux filesystem
Please help with removing the old and inexistent kernels from Grub.