kexec

allows the system to boot directly into a new kernel without going

TLDR

Load a new kernel
$ kexec -l [path/to/kernel] --initrd=[path/to/initrd] --command-line=[arguments]
Load kernel with current boot parameters
$ kexec -l [path/to/kernel] --initrd=[path/to/initrd] --reuse-cmdline
Execute the loaded kernel
$ kexec -e
Unload current kexec target kernel
$ kexec -u

SYNOPSIS

kexec [options]

DESCRIPTION

kexec allows the system to boot directly into a new kernel without going through the BIOS/UEFI and bootloader. This enables faster reboots and is essential for kdump (kernel crash dumping).The process involves loading a kernel into memory with -l, then executing it with -e. This bypasses hardware initialization, significantly reducing reboot time.

PARAMETERS

-l, --load KERNEL

Load a new kernel into memory
-e, --exec
Execute the currently loaded kernel
-u, --unload
Unload the loaded kernel
--initrd FILE
Specify initramfs/initrd image
--command-line ARGS
Kernel command line arguments
--reuse-cmdline
Use current kernel's command line
-p, --load-panic
Load kernel for crash dump (kdump)

INSTALL

sudo apt install kexec-tools
sudo dnf install kexec-tools
sudo pacman -S kexec-tools
sudo apk add kexec-tools
sudo zypper install kexec-tools
nix profile install nixpkgs#kexec-tools

CAVEATS

Requires CONFIG_KEXEC in the kernel. Some hardware may not work correctly after kexec due to missing initialization. Not all drivers handle kexec transitions properly.

HISTORY

kexec was developed to enable fast reboots and kernel crash dumping. It was merged into the Linux kernel in version 2.6.13 (2005) and has become essential for kdump functionality.

SEE ALSO

systemctl(1), reboot(8)