Using Kexec for Faster Reboots
Kexec boots a new Linux kernel directly from a running kernel, bypassing firmware initialization and the boot loader. A normal reboot runs these steps before the new kernel starts, which takes time, especially on servers. With Kexec, you can skip both steps and reduce server downtime during routine kernel updates. This article explains when a Kexec reboot is useful, when you still need a full reboot and how to reboot with Kexec on SUSE Linux Enterprise Server for NVIDIA.
Prerequisites
The kexec-tools and update-bootloader packages, which are installed by default
1 What is Kexec? #
Kexec is a Linux kernel mechanism that starts a new kernel directly from the running kernel, without going through the firmware and the boot loader. A reboot with Kexec is therefore faster than a normal reboot.
The kexec command from the kexec-tools package loads
the new kernel into memory through the kexec system call. The running
kernel then hands control to the new kernel.
1.1 When to reboot with Kexec #
Faster reboots. Skipping the firmware and the boot loader saves time, which matters if you reboot a system often, for example, after kernel updates.
Booting another kernel once. You can load any kernel image with the kernel options you choose, without changing the boot loader configuration.
1.2 When to use a full reboot #
Use a full reboot when you need the firmware or the boot loader to run:
Firmware updates. Changes to the firmware take effect only when the firmware runs during a full reboot.
Selecting an entry in the boot menu. A Kexec reboot does not show the boot menu, so you cannot select another boot entry or an older snapshot there.
Devices that do not work after a Kexec reboot. A full reboot lets the firmware reset and initialize the hardware.
If a kernel is already loaded for Kexec, unload it before a full reboot. Otherwise,
systemctl reboot also reboots with Kexec. See
Section 2, “Rebooting a system with Kexec”.
2 Rebooting a system with Kexec #
Rebooting with Kexec is a two-step process: loading a target kernel and its initrd
into memory, either automatically from the default boot loader entry or manually with
custom parameters, and triggering the reboot with systemctl kexec.
The kexec-tools package provides the kexec command.
kexec-bootloader, which loads the default boot entry, is part of the
update-bootloader package. Both packages are installed by default. To
confirm that they are present:
> rpm -q kexec-tools update-bootloader
kexec-bootloader loads the default boot entry with the kernel options
that are currently set in the boot loader configuration. These options include changes in
/etc/default/grub that you have not applied yet.
Make sure no important services are running and no users other than yourself are logged in, since a Kexec reboot restarts the system immediately once triggered.
Optional: Check which kernel, initrd and kernel options will be loaded, without loading anything:
>sudokexec-bootloader --dry-run -DLoad the default boot entry into memory:
>sudokexec-bootloaderOptional: To do a full reboot after all, for example, for a pending firmware update, unload the kernel:
>sudokexec -uAs long as a kernel is loaded, every reboot uses Kexec, including a reboot with
systemctl reboot. After unloading, reboot withsystemctl rebootinstead of continuing with the next step.Reboot with Kexec:
>sudosystemctl kexecsystemctl kexecshuts down the system cleanly and then starts the loaded kernel. If no kernel is loaded, the command tries to find one itself. Automatic loading only works on systems that boot with UEFI and use boot entries that follow the Boot Loader Specification. Otherwise, the command fails withNo kexec kernel loaded and autodetection failed.In that case, load the kernel first withkexec-bootloader.Once the system is back, check the kernel messages of the current boot for warnings:
>sudojournalctl -k -p warning -bThen confirm that the system is running the expected kernel:
>uname -r
2.1 Loading a kernel manually #
To start a kernel other than the default boot entry, or a kernel with different options,
load it with kexec -l and name the kernel, initrd and kernel options
yourself:
>sudokexec -l KERNEL_IMAGE --initrd=INITRD_IMAGE --append="KERNEL_OPTIONS"
On SLE for NVIDIA, kernel images are in
/usr/lib/modules/KERNEL_VERSION/, and
initrds are in /boot/initrd-KERNEL_VERSION.
The kernel image file is named
Image.
To reuse the kernel options of the running system, use --reuse-cmdline
instead of --append.
>sudokexec -l /usr/lib/modules/$(uname -r)/Image \ --initrd=/boot/initrd-$(uname -r) --reuse-cmdline
Then reboot with systemctl kexec, which shuts down the system cleanly
before it starts the loaded kernel. kexec -e also starts the loaded
kernel, but immediately and without calling shutdown(8), so services
are not stopped cleanly.
3 For more information #
Man pages:
man 8 kexec,man 8 kexec-bootloader,man 1 systemctl.For capturing kernel crash dumps with Kdump, which also uses Kexec, see the article “Capturing and Analyzing Kernel Crash Dumps with Kdump”.
Man page for Kexec with the full set of command-line options: https://man7.org/linux/man-pages/man8/kexec.8.html.
4 Legal Notice #
Copyright© 2006– 2026 SUSE LLC and contributors. All rights reserved.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or (at your option) version 1.3; with the Invariant Section being this copyright notice and license. A copy of the license version 1.2 is included in the section entitled “GNU Free Documentation License”.
For SUSE trademarks, see https://www.suse.com/company/legal/. All other third-party trademarks are the property of their respective owners. Trademark symbols (®, ™ etc.) denote trademarks of SUSE and its affiliates. Asterisks (*) denote third-party trademarks.
All information found in this book has been compiled with utmost attention to detail. However, this does not guarantee complete accuracy. Neither SUSE LLC, its affiliates, the authors, nor the translators shall be held liable for possible errors or the consequences thereof.