1

I have installed two kernel version 3.10.48 and 3.17.6 for project. As I am not requiring 3.10.48 any more, I wanted to remove that version as it is taking up almost 10GB of my disk space. How should I go about it?

  • You can refer the url to remove the kernal. http://askubuntu.com/questions/564227/right-way-to-completely-clean-up-old-kernels-in-terminal/565225#565225 – BDRSuite Dec 30 '14 at 07:20
  • 3
    In what world does a kernel binary take 10 GB? O.o – muru Dec 30 '14 at 08:20
  • 1
    I would recommend leaving it, in case something goes wrong, you have a fall back. – Mitch Dec 30 '14 at 08:23
  • I am totally agree with @Mitch. Instead of removing it, see here to find which files and folders are consuming your disk space. As Muru said, kernal will not consume 10 GB of space. – g_p Dec 30 '14 at 09:04
  • 1
    @priyanka-naik Do you mean that you have pulled the kernel sources from repositories and those are occupying that much of your disk space? Clarifying this will help people to answer to your "problem". – Ahti Komu Dec 30 '14 at 10:20

2 Answers2

-1

First boot the Kernel which you want to retain. Then use the below command to remove Kernel from your machine permanently,

sudo apt-get remove --purge $(dpkg -l 'linux-image-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')

Hope this helps.

BDRSuite
  • 3,156
  • 1
  • 12
  • 11
-1

I think the 10Gb is for compiling you can clean it just by : 1. you should open the directory where you compile the source of kernel: example: cd /usr/src/linux after that use his command to clean all files genarated in the compiling process:

make clean

or in the case that you compile the kernel with make-kpkg you should clean it by:

make-kpkg clean 

or you should try one of those processes :

1. For uninstalling the kernel run:

sudo apt-get remove linux-image-version_number*

sudo apt-get remove linux-headers-version_number*

sudo apt-get remove linux-image-extra-version_number*     (if applicable)

or simply uninstall them from synaptic/software center.

2. For uninstalling the kernel installed from source, run:

sudo rm -rf /lib/modules/kernel_version

sudo rm -f /boot/vmlinuz-kernel_version*

sudo rm -f /boot/initrd.img-kernel_version*

sudo rm -f /boot/config-kernel_version*

sudo rm -f /boot/System.map-kernel_version*

Finally, after uninstalling the kernel by either one of the processes above, run:

sudo update-grub

to clean the grub menu.