• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

kexec Command Examples in Linux

by Deepika

“kexec” is a Linux system call that enables the kernel to load and boot into another kernel, bypassing the BIOS or firmware boot loader. This allows the system to reboot directly into a new kernel without going through the process of shutting down and restarting the system.

The kexec system call is useful in several scenarios, such as:

  • Developers who are testing new kernels and want to quickly switch between different versions without the need for a complete reboot.
  • It can be used in situations where the system is unable to boot due to a problem with the current kernel, and a new kernel is needed to fix the issue.

The kexec system call requires the kernel and initrd (initial ramdisk) of the new kernel to be loaded into memory before executing the kexec system call. This means that the new kernel must be compatible with the current hardware and must have the necessary drivers and modules required to boot the system.

It’s important to note that kexec is not a replacement for a full reboot and is not suitable for all cases. Also, it should be used with care as it may cause data loss and system instability if not used properly.

kexec Command Examples

1. Load a new kernel:

# kexec -l path/to/kernel --initrd=path/to/initrd --command-line=arguments

2. Load a new kernel with current boot parameters:

# kexec -l path/to/kernel --initrd=path/to/initrd --reuse-cmdline

3. Execute a currently loaded kernel:

# kexec -e

4. Unload current kexec target kernel:

# kexec -u

Filed Under: Linux

Some more articles you might also be interested in …

  1. rc-service: command not found
  2. CentOS / RHEL : How to configure an DHCP server
  3. virt-xml-validate: command not found
  4. sort: command not found
  5. How to disable write access to USB devices using “hdparm” tool
  6. How to block a specific IP Connecting to a server with firewall-cmd
  7. CentOS / RHEL : How to delete a volume group in LVM
  8. Beginners guide to Device Mapper (DM) multipathing
  9. avrdude: Driver program for Atmel AVR microcontrollers programming (Command Examples)
  10. How to Check if a Service Restart or Server Reboot is required After RPM Package Update (CentOS/RHEL/Fedora)

You May Also Like

Primary Sidebar

Recent Posts

  • csslint: A linter for CSS code
  • csh: The shell (command interpreter) with C-like syntax (Command Examples)
  • csc: The Microsoft C# Compiler (Command Examples)
  • crystal: Tool for managing Crystal source code

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright