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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

kexec: command not found

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.

If you encounter the below error while running the command kexec:

kexec: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install kexec-tools
Ubuntu apt-get install kexec-tools
Arch Linux pacman -S kexec-tools
Kali Linux apt-get install kexec-tools
CentOS yum install kexec-tools
Fedora dnf install kexec-tools
Raspbian apt-get install kexec-tools

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. How to Use Iperf to Test Network Performance in Linux
  2. blkdiscard Command Examples in Linux
  3. How to use compress, zip, gzip commands under Linux
  4. fdisk: Unable to write /dev/sdg: Bad file descriptor – error while formatting USB disk
  5. How to re-create the yum cache (force a fetch of the cache data) from enabled repositories in CentOS/RHEL
  6. direnv: Shell extension to load and unload environment variables depending on the current directory
  7. bindkey Command Examples (Add keybindings to Z-Shell)
  8. How to Configure ACL(Access Control Lists) in Linux FileSystem
  9. runlim Command Examples in Linux
  10. rc-status Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • “glab pipeline” Command Examples
  • “glab mr” Command Examples
  • “glab mr merge” Command Examples
  • “glab mr” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright