De-installing a self-compiled ubuntu kernel

Discussion in 'Kernel Questions' started by tdebruin, Dec 12, 2006.

  1. tdebruin

    tdebruin New Member

    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:
    Code:
    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
    Code:
    uname -r
    Then I went to the /boot/ directory and removed the different files:
    Code:
    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:
    Code:
    cd /usr/src/
    sudo rm -rf linux-headers-2.6.19-custom
    And then do a
    Code:
    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.
     
  2. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Try
    Code:
    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.
     
  3. tdebruin

    tdebruin New Member

    apt-get remove indeed

    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.
     

Share This Page