12.2 Setting up Fast Reboots of the Current Kernel

To set up your system so that you can enable fast reboots of the current kernel:

  1. Create the file /etc/init.d/runkexec with the following contents:

    #!/bin/sh
    #
    # runkexec
    #
    ### BEGIN INIT INFO
    # Provides: runkexec
    # Required-Start:
    # Required-Stop:
    # Default-Stop:
    # Description: Enable or disable fast system rebooting
    # Short-Description: enable or disable fast system rebooting
    ### END INIT INFO
    
    KV=`uname -r`
    
    case "$1" in
      start|restart|load|reload)
            kexec -l --append="`cat /proc/cmdline`" --initrd=/boot/initramfs-${KV}.img \
                /boot/vmlinuz-${KV}
            ;;
      stop|unload)
            kexec -u && echo "Target kexec kernel unloaded."
            ;;
      status)
            echo "Status not available for kexec."
            ;;
      *)
            echo "Usage: runkexec {start|restart|load|reload|stop|unload|status}"
            exit 2
    esac
    exit 0
  2. Set the ownership and mode of the file.

    # chown root:root /etc/init.d/runkexec
    # chmod 755 /etc/init.d/runkexec
  3. Create the symbolic link S00kexec to the file from the /etc/rc1.d directory.

    # ln -s /etc/init.d/runkexec /etc/rc1.d/S00kexec
  4. To enable fast reboots without needing to reboot the system, enter:

    # service runkexec start