installkernel
Install a new kernel and related files
SYNOPSIS
installkernel is primarily an internal helper script, making a universal, user-invoked synopsis impractical. Its invocation pattern is highly distribution and implementation specific.
Conceptually, when used as a script (e.g., /usr/sbin/installkernel on Debian/Ubuntu), it often follows a pattern similar to:
installkernel KERNEL_VERSION KERNEL_IMAGE [INITRAMFS_PATH] [MAP_FILE]...
This pattern reflects the core information needed for installation, but actual usage involves context-specific arguments and environment variables.
PARAMETERS
KERNEL_VERSION
The full version string of the kernel being installed (e.g., 6.5.0-14-generic). This is crucial for naming files and bootloader entries.
KERNEL_IMAGE
The absolute path to the kernel image file (e.g., /usr/src/linux-headers-6.5.0-14/vmlinuz or an already built vmlinuz).
INITRAMFS_PATH
(Optional, highly dependent on script) The path to the pre-built initial RAM filesystem image. If not provided, the script might generate one.
MAP_FILE
(Optional) The path to the System.map file corresponding to the kernel image, used for debugging and symbol resolution.
Other positional arguments/environment variables
Depending on the distribution's implementation, additional arguments or environment variables may be used to specify architecture, module paths, or control specific behaviors (e.g., update bootloader, clean old kernels). These are rarely documented for end-user invocation.
DESCRIPTION
installkernel is not a single, universally standardized Linux command with a dedicated man page. Instead, it refers to a helper script or a collection of scripts used by Linux distributions, typically during kernel package installation or upgrades. Its primary purpose is to automate the process of installing a new Linux kernel image (vmlinuz), its corresponding initial RAM filesystem (initramfs or initrd), and updating the bootloader configuration.
When a new kernel version is installed via a package manager (e.g., apt on Debian/Ubuntu, dnf on Fedora), installkernel is commonly invoked by the package manager's post-installation scripts. It handles critical tasks such as:
- Copying the kernel image and initramfs to the appropriate boot partition (usually /boot).
- Creating or updating symbolic links (e.g., /vmlinuz, /initrd.img).
- Generating the initramfs if not already provided.
- Triggering bootloader updates (e.g., update-grub or grub-mkconfig) to ensure the new kernel is added to the boot menu.
- Managing old kernel versions, sometimes removing them to free up space.
Because its implementation varies significantly between distributions (e.g., using scripts like /usr/sbin/installkernel on Debian/Ubuntu or being part of the kernel-install framework on Fedora/RHEL), direct manual invocation with common parameters is rare. It primarily acts as an internal utility for automated kernel management.
CAVEATS
Distribution Specificity: The behavior, arguments, and even existence of an installkernel script vary drastically across Linux distributions. What works on Debian/Ubuntu will likely differ from Fedora/RHEL or Arch Linux.
Internal Utility: It is primarily an internal script called by package managers (e.g., APT, DNF) during kernel package installation or by bootloader configuration tools. Direct manual invocation by end-users is uncommon and generally not recommended, as it can bypass critical pre-checks and post-installation steps handled by the package manager.
Debugging Complexity: If a kernel installation fails, debugging often requires examining the specific installkernel script and related hooks on the system, as its logic is not standardized. Issues are frequently related to the kernel build process, initramfs generation, or bootloader configuration rather than the installkernel script itself.
ROLE IN INITRAMFS GENERATION
A crucial function of installkernel (or its equivalent) is to ensure that an appropriate initramfs (initial RAM filesystem) is generated or copied for the new kernel. The initramfs contains essential modules and scripts needed to mount the root filesystem and prepare the system for the full boot process. Incorrect or missing initramfs can lead to a non-bootable system.
BOOTLOADER INTEGRATION
After placing the kernel image and initramfs in /boot, the installkernel process is responsible for updating the bootloader's configuration. This typically involves invoking a bootloader-specific command (e.g., update-grub for GRUB, bootctl for systemd-boot) to add the new kernel to the boot menu and set it as the default, if desired.
KERNEL VERSION MANAGEMENT
Beyond installing the new kernel, these scripts often handle the removal of older kernel versions to free up disk space in the /boot partition. They typically keep a few recent stable kernels as a fallback option in case the newest kernel encounters issues, preventing a system from becoming unbootable due to a single faulty update.
HISTORY
The concept behind installkernel emerged from the necessity to automate the complex and error-prone process of updating Linux kernels. In the early days of Linux, installing a new kernel often involved manual steps such as compiling the kernel, copying the vmlinuz and System.map files to the /boot directory, generating an initial RAM disk (initrd), and then manually editing bootloader configuration files (like lilo.conf or grub.conf).
As Linux distributions matured and package managers became sophisticated, the need for automated kernel installation routines became paramount. installkernel scripts were developed by various distributions to encapsulate these steps, allowing package managers (like Debian's APT or Red Hat's RPM/DNF) to reliably upgrade kernels without user intervention. These scripts abstract away the details of copying files, updating symbolic links, generating initramfs images (often using tools like mkinitramfs or dracut), and invoking bootloader update commands (like update-grub).
While the name installkernel might refer to a specific script in some distributions (e.g., /usr/sbin/installkernel on Debian/Ubuntu), other distributions have evolved more formalized frameworks, such as Fedora's kernel-install utility, which manages a directory of hook scripts (/usr/lib/kernel/install.d/) that perform the various kernel installation steps. Regardless of the specific implementation, the underlying goal remains the same: to provide a robust, automated mechanism for integrating new kernel versions into a running system.
SEE ALSO
update-grub(8), grub-mkconfig(8), mkinitramfs(8), dracut(8), kernel-install(8), apt(8), dnf(8)