2

I have just updated Ubuntu to 16.04 version and when I boot, grub shows the kernels from the previous Ubuntu version. How can I delete them? (not only in the grub list but to actually free that space in the disc).

Please, this is not duplicated from How do I remove old kernel versions to clean up the boot menu? The answers there do not work when you change Ubuntu version. dpkg is not a solution!

System: Dell Studio 1557, i7-720QM@1.60GHz, 4 GB RAM. Legacy boot.

When I do sudo update-grub I get:

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-22-generic
Found initrd image: /boot/initrd.img-4.4.0-22-generic
Found linux image: /boot/vmlinuz-4.4.0-21-generic
Found initrd image: /boot/initrd.img-4.4.0-21-generic
Found linux image: /boot/vmlinuz-3.13.0-86-generic
Found initrd image: /boot/initrd.img-3.13.0-86-generic
Found linux image: /boot/vmlinuz-3.13.0-85-generic
Found initrd image: /boot/initrd.img-3.13.0-85-generic
Found linux image: /boot/vmlinuz-3.13.0-83-generic
Found initrd image: /boot/initrd.img-3.13.0-83-generic
Found linux image: /boot/vmlinuz-3.13.0-79-generic
Found initrd image: /boot/initrd.img-3.13.0-79-generic
Found linux image: /boot/vmlinuz-3.13.0-77-generic
Found initrd image: /boot/initrd.img-3.13.0-77-generic
Found linux image: /boot/vmlinuz-3.13.0-76-generic
Found initrd image: /boot/initrd.img-3.13.0-76-generic
Found linux image: /boot/vmlinuz-3.13.0-74-generic
Found initrd image: /boot/initrd.img-3.13.0-74-generic
Found linux image: /boot/vmlinuz-3.13.0-73-generic
Found initrd image: /boot/initrd.img-3.13.0-73-generic
Found linux image: /boot/vmlinuz-3.11.0-26-generic
Found initrd image: /boot/initrd.img-3.11.0-26-generic
Found linux image: /boot/vmlinuz-3.11.0-24-generic
Found initrd image: /boot/initrd.img-3.11.0-24-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda3
done

But when I do dpkg -l | grep linux-image I only get:

ii  linux-image-4.4.0-21-generic                4.4.0-21.37                                         amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-22-generic                4.4.0-22.39                                         amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-21-generic          4.4.0-21.37                                         amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-22-generic          4.4.0-22.39                                         amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-generic                         4.4.0.22.23                                         amd64        Generic Linux kernel image

and all the one-liner code I found in other threads to solve this rely on dpkg, they do not work.

The content of boot is:

abi-3.11.0-24-generic
abi-3.11.0-26-generic
abi-3.13.0-73-generic
abi-3.13.0-74-generic
abi-3.13.0-76-generic
abi-3.13.0-77-generic
abi-3.13.0-79-generic
abi-3.13.0-83-generic
abi-3.13.0-85-generic
abi-3.13.0-86-generic
abi-4.4.0-21-generic
abi-4.4.0-22-generic
config-3.11.0-24-generic
config-3.11.0-26-generic
config-3.13.0-73-generic
config-3.13.0-74-generic
config-3.13.0-76-generic
config-3.13.0-77-generic
config-3.13.0-79-generic
config-3.13.0-83-generic
config-3.13.0-85-generic
config-3.13.0-86-generic
config-4.4.0-21-generic
config-4.4.0-22-generic
grub
initrd.img-3.11.0-24-generic
initrd.img-3.11.0-26-generic
initrd.img-3.13.0-73-generic
initrd.img-3.13.0-74-generic
initrd.img-3.13.0-76-generic
initrd.img-3.13.0-77-generic
initrd.img-3.13.0-79-generic
initrd.img-3.13.0-83-generic
initrd.img-3.13.0-85-generic
initrd.img-3.13.0-86-generic
initrd.img-4.4.0-21-generic
initrd.img-4.4.0-22-generic
memtest86+.bin
memtest86+.elf
memtest86+_multiboot.bin
System.map-3.11.0-24-generic
System.map-3.11.0-26-generic
System.map-3.13.0-73-generic
System.map-3.13.0-74-generic
System.map-3.13.0-76-generic
System.map-3.13.0-77-generic
System.map-3.13.0-79-generic
System.map-3.13.0-83-generic
System.map-3.13.0-85-generic
System.map-3.13.0-86-generic
System.map-4.4.0-21-generic
System.map-4.4.0-22-generic
vmlinuz-3.11.0-24-generic
vmlinuz-3.11.0-26-generic
vmlinuz-3.13.0-73-generic
vmlinuz-3.13.0-74-generic
vmlinuz-3.13.0-76-generic
vmlinuz-3.13.0-77-generic
vmlinuz-3.13.0-79-generic
vmlinuz-3.13.0-83-generic
vmlinuz-3.13.0-85-generic
vmlinuz-3.13.0-86-generic
vmlinuz-4.4.0-21-generic
vmlinuz-4.4.0-22-generic

But the old kernels do not appear in Synaptic, so please do not suggest that, and booting with the old kernels does not make them appear in synaptic nor available for dpkg.

sudo apt-get autoremove also does nothing:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

The same for sudo apt-get autoremove linux-headers-3.11.0-24-generic

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package linux-headers-3.11.0-24-generic
E: Couldn't find any package by glob 'linux-headers-3.11.0-24-generic'
E: Couldn't find any package by regex 'linux-headers-3.11.0-24-generic'

sudo apt-get remove linux-image-3.11.0-24-generic also does nothing:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package linux-image-3.11.0-24-generic
E: Couldn't find any package by glob 'linux-image-3.11.0-24-generic'
E: Couldn't find any package by regex 'linux-image-3.11.0-24-generic'

sudo apt-get purge linux-image-3.11.0-24-generic also does nothing:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package linux-image-3.11.0-24-generic
E: Couldn't find any package by glob 'linux-image-3.11.0-24-generic'
E: Couldn't find any package by regex 'linux-image-3.11.0-24-generic'

Please do not suggest me to use "ubuntu-tweak", the links take you to a weird site in Chinese.

sudo apt-get autoclean and sudo apt-get clean also do nothing.

As you can see I am not an expert, I tried everything I found, should I delete those files straight away? is there something else I should delete? The old kernels do not show up in /lib/firmware/ or /lib/modules/.

hbond
  • 21

1 Answers1

0

Since none of the kernels are recognized as installed by apt/dpkg you can safely delete them as @oldfred states. In case you havent already, issue:

  1. mount /boot && cd /boot
  2. rm -v abi-* && rm -v config-* && rm -v initrd* && rm -v System* && rm -v vmlinuz*
  3. sudo apt-get install linux-image
  4. sudo update-grub
  5. Reboot
eyoung100
  • 975