Kexec

From openSUSE


Contents

Description

Kexec enables you to skip the BIOS when rebooting. Especially if your BIOS is slow/buggy/whatever, this is a really nice feature to have.

To test it, install "kexec-tools" and a recent kernel (those from 11.0 and above) are recent enough.

Boot into single user.

  1. kexec -l --command-line="`cat /proc/cmdline`" --initrd=/boot/initrd /boot/vmlinuz
  2. remount ro /
  3. kexec -e

You should now see the new kernel booting or at least see the harddisk light blinking during the boot process.

You an also install the perl-Linux-Bootloader package (starting with openSUSE 11.0) which includes a script called kexec-bootloader. That reads bootloader configuration and runs kexec with the same kernel command options as the bootloader would. kexec-bootloader -h lists the possible options.

Benefits and Caveats

Benefits

  • Reboot is faster.
  • The BIOS has no chance to throw errors on you.
  • The above is especially true if you use FakeRAID controllers.
  • You don't have to wait until the SCSI controller has enumerated all devices.
  • You don't depend on a working GRUB or LILO configuration.
  • You could even abuse it to install a newer version of openSUSE or any other Linux without booting from CD, DVD or Floppy.
  • You can tell the kernel to kexec on panic. See Kdump for details.

Caveats

  • Some hardware might not work after kexec'ing the new kernel. This can be fixed in the driver for that hardware.
  • Video problems like no display or corrupted display are possible. Please try kexec -e --reset-vga as last command and/or disable vesafb. Please note that even if graphics are botched during boot, everything should be fine once X starts.
  • Somebody needs to hack /sbin/reboot to optionally kexec an already loaded kernel instead of the last reboot stage.

Success and Failure reports

Success

I have had success with both my recent Samsung laptop and an old 600 MHz machine with SCSI. The time saved (compared to a normal reboot) was: Samsung laptop, Pentium M 1600 MHz: 12 seconds No-name machine, Pentium III 600 MHz, SCSI disks/cdrom: 31 seconds --Kernelhacker

Kexec works great on my desktop computer (Home built), it has an Asus A7N8X-E Deluxe motherboard, which uses NVIDIA's nForce2 chipset, and an AMD Athlon Barton XP 3200+ CPU. Although the system butchers the graphics, everything besides that works great, rebooting time saved is about 15 - 20 seconds. --Tsuroerusu.

See also