Kernel/Removal

This article describes the Article description::removal of old s.

Removing kernel sources
After a new kernel is installed and if it works satisfactorily, the old kernel can be removed. To remove the old kernel sources, emerge's --depclean option (short form -c) can be used to remove all old or unused versions of a slotted package, e.g. for.

Be sure to verify that it is not removing the sources for the currently running kernel (See article on how to upgrade.)

Protecting kernel sources
If newer kernel sources has been merged and is run before switching to the newer sources, the current sources will be removed. To stay with the current sources, this removal is not wanted, because the sources may be needed e.g. for updating external kernel modules. It's therefore good practice to add the specific kernel version to the world file to protect it from  operations.

Using eclean-kernel
is a simple tool for old kernel cleanup/removal. It removes both built kernel files and build directories if they're no longer reference by any preserved kernel.

See post-installation for usage instructions:

For example, to keep three newest kernels around:

Manual removal
Portage however only removes the files it installed - the files generated during the kernel build and installation remain. They can be safely removed.


 * When a kernel is built in the source directory, files generated during the build process remain, and are not removed by Portage:




 * During kernel setup, the kernel modules are copied to a sub directory of :




 * The old files in can also be removed:




 * Lastly, remove all leftover entries from the bootloader's config file.