Langue: en

Version: April 2006 (CentOS - 06/07/09)

Section: 8 (Commandes administrateur)


kexec - directly boot into a new kernel


/sbin/kexec [-v (--version)] [-f (--force)] [-x (--no-ifdown)] [-l (--load)] [-p (--load-panic)] [-u (--unload)] [-e (--exec)] [-t (--type)] [--mem-min=addr] [--mem-max=addr]


kexec is a system call that enables you to load and boot into another kernel from the currently running kernel. kexec performs the function of the boot loader from within the kernel. The primary difference between a standard system boot and a kexec boot is that the hardware initialization normally performed by the BIOS or firmware (depending on architecture) is not performed during a kexec boot. This has the effect of reducing the time required for a reboot.

Make sure you have selected CONFIG_KEXEC=y when configuring the kernel. The CONFIG_KEXEC option enables the kexec system call.


Using kexec consists of
(1) loading the kernel to be rebooted to into memory, and
(2) actually rebooting to the pre-loaded kernel.

To load a kernel, the syntax is as follows:

kexec -l kernel-image --append=command-line-options --initrd=initrd-image

where kernel-image is the kernel file that you intend to reboot to.

Note: Compressed kernel images such as bzImage are not supported by kexec. Use the uncompressed vmlinux.

Insert the command-line parameters that must be passed to the new kernel into command-line-options. Passing the exact contents of /proc/cmdline into command-line-options is the safest way to ensure that correct values are passed to the rebooting kernel.

The optional initrd-image is the initrd image to be used during boot.


For example, if the kernel image you want to reboot to is /boot/vmlinux, the contents of /proc/cmdline is root=/dev/hda1, and the path to the initrd is /boot/initrd, then you would use the following command to load the kernel:

kexec -l /boot/vmlinux --append=root=/dev/hda1 --initrd=/boot/initrd

After this kernel is loaded, it can be booted to at any time using the command:

kexec -e


-e (--exec)
Run the currently loaded kernel.
-f (--force)
Force an immediate kexec call, do not call shutdown.
-h (--help)
Open a help file for kexec.
-l (--load) kernel
Load the specified kernel into the current kernel.
-p (--load-panic)
Load the new kernel for use on panic.
-t (--type=type)
Specify that the new kernel is of this type.
-u (--unload)
Unload the current kexec target kernel. If a capture kernel is being unloaded then specify -p with -u.
-v (--version)
Return the version number of the installed utility.
-x (--no-ifdown)
Shut down the running kernel, but restore the interface on reload. (If this option is used, it must be specified last.)
Specify the lowest memory address addr to load code into.
Specify the highest memory address addr to load code into.


Pass ELF boot notes.
Pass Linux kernel style options.
-d  (--debug)
Enable debugging messages.
Use the kernel's real mode entry point.


Append string to the kernel command line.
Set the kernel command line to string.
Use file as the kernel's initial ramdisk.
Use file as the kernel's initial ramdisk.


Set the kernel command line to string.
--module=mod arg1 arg2 ...
Load module mod with command-line arguments arg1 arg2 ... This parameter can be specified multiple times.


Enable the serial console.
Enable the VGA console.
Prepare core headers in ELF32 format.
Prepare core headers in ELF64 format.
Attempt to reset a standard VGA device.
Specify the serial port for debug output.
Specify the baud rate of the serial port.