1

My system has old Ubuntu kernels but I am unable to remove them. How can I remove my old kernel to free my hard disk. Here are some outputs of commands I tried:

$ 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.

Also,

$ 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

I tried

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

Then on retrying,

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'

Also,

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'

And,

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

ubuntu-tweak is the better solution for a beginner.

installation: sudo apt-get install ubuntu-tweak

removing old kernel using ubuntu-tweak :

  • use the start janitor button in the ubuntu-tweak window
  • click on old kernel check box
  • select the old kernels
  • click clean

enter image description here

1
  • That is simply the best answer for someone new to Ubuntu Nov 4 '14 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.