LinuxCommandLibrary

eselect-kernel

Select active bootable Linux kernel

TLDR

List available kernel symlink targets with their numbers

$ eselect kernel list
copy

Set the /usr/src/linux symlink by name or number from the list command
$ eselect kernel set [name|number]
copy

Show what the current kernel symlink points to
$ eselect kernel show
copy

Set the kernel symlink to the currently running kernel
$ eselect kernel update
copy

SYNOPSIS

eselect kernel action [options] [kernel]

PARAMETERS

list [--all | --installed | --no-kgenv]
    List available kernel sources, installed ones, or exclude kernel-gen symlinks.

list-profiles kernel
    List available profiles for a specific kernel source.

enable kernel [--force]
    Enable a kernel source, creating symlinks; --force overwrites existing.

disable kernel
    Disable a kernel source by removing symlinks.

set kernel
    Set the default kernel symlink.

env-list
    List configured kernel environments.

env-enable env
    Enable a specific kernel environment.

env-update
    Update kernel environment variables and regenerate configs.

clean
    Remove stale symlinks and environments.

--help
    Show usage information.

--version
    Display version.

DESCRIPTION

Eselect-kernel is a module of the eselect utility in Gentoo Linux, designed to simplify the management of multiple kernel sources and configurations. It allows users to list available kernels, enable or disable specific kernel profiles, update kernel environment variables, and maintain symlinks for bootloaders like GRUB.

This tool is essential in Gentoo's source-based distribution model, where users compile custom kernels from source. By enabling a kernel, eselect-kernel creates necessary symlinks in /usr/src and updates /etc/kernel/env. The env-update action regenerates environment variables and post-install hooks. It integrates with Portage for seamless kernel package handling, supporting features like ABI management and pre-built kernel flavors.

Primarily used post-emerge of kernel sources, it streamlines switching between stable, testing, or custom kernels without manual symlink juggling.

CAVEATS

Gentoo-specific; requires root for symlink changes. May conflict with manual /usr/src management. Always run env-update after changes and regenerate initramfs/bootloader.

EXAMPLES

eselect kernel list
eselect kernel enable gentoo
eselect kernel env-update

FILES

Configs in /etc/kernel/preinst.d, /etc/kernel/postinst.d; symlinks in /usr/src/linux-<version>.

HISTORY

Developed as part of Gentoo's eselect framework around 2004-2005 to address kernel management needs in a multi-kernel setup. Evolved with Gentoo's kernel ecosystem, adding ABI and env support in later versions (e.g., eselect 1.4+). Maintained in Gentoo's app-eselect category.

SEE ALSO

Copied to clipboard