PDA

View Full Version : De-installing a self-compiled ubuntu kernel


tdebruin
12th December 2006, 15:03
After succefully compiling a new Ubuntu Kernel thanks to the tutorial at http://www.howtoforge.com/kernel_compilation_ubuntu,
I wanted to remove that kernel for some reason (forgot to compile some option I needed).
In the past I had compiled kernel in the old-school debian way, but now that I had installed the kernel via the make-kpkg and dpkg -i commands I thought I could remove it the same way:
dpkg -r linux-image-2.6.19-custom.deb

But I had to discover that dpkg does not work this way. So my humble question is: is it just simply safe to remove manually the files corresponding to my self-compiled kernel? First I ensured I am now using another kernel with uname -r

Then I went to the /boot/ directory and removed the different files:
cd /boot/
sudo rm initrd.img-2.6.19-custom
sudo rm System.map-2.6.19-custom
sudo rm vmlinuz-2.6.19-custom

Then I also removed the .deb package in /usr/src, as well as the kernel headers:
cd /usr/src/
sudo rm -rf linux-headers-2.6.19-custom
And then do a sudo update-grub to make sure Grub knows this kernel doesn't exist anymore.

I'm asking the question because I sense that some people may end up with several useless kernel-images laying around on their hard drive not knowing how to remove them safely.

falko
13th December 2006, 14:44
Try apt-get remove linux-image-2.6.19-custom
But you can simply compile a new kernel (use custom1 instead of custom) and install that one so that linux-image-2.6.19-custom won't be used anymore.

tdebruin
14th December 2006, 00:56
Aha, apt-get remove did indeed clean my disk in a more elegant way than manually deleting things here and there.

I'd already made another kernel, but I wanted to make sure that this was the safe way to clean up my HD, thinking that more people like me otherwise maybe keep all sorts of different stale kernels on their HD by fear of not removing them in the proper way.

Thx for the quick answer.