Removing kernel in Sabayon 10


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 sys-kernel/gentoo-sources.

root # emerge --ask --depclean gentoo-sources

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

Protecting kernel sources

If newer kernel sources has been merged and you run –depclean before switching to the newer sources, the current sources will be removed. But if you want to stay with the current sources, this removal is not wanted, because you may need the sources e.g. for updating external kernel modules. It’s therefore good practice to add the specific kernel version to your world file to protect it from –depclean operations.

root # emerge --ask --noreplace gentoo-sources:3.3.8

Note the slot notation, using a colon instead of a dash. Every kernel version is its own slot.

Remove kernel leftovers

Using eclean-kernel

app-portage/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.

For example, to keep three newest kernels around:

root # eclean-kernel -n 3

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:
root # rm -r /usr/src/linux-3.X.Y
  • During kernel setup, the kernel modules are copied to a sub directory of /lib/modules/:
root # rm -r /lib/modules/3.X.Y
  • The old files in /boot can also be removed:
root # rm /boot/kernel-3.X.Y
root # rm /boot/System.map-3.X.Y
root # rm /boot/config-3.X.Y
  • Lastly, remove all leftover entries from your bootloader’s config file.

About pacesettergraam

A good and realistic person

Posted on January 9, 2013, in linux, Sabayon and tagged , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: