Kexec is a system call that enables you to load and boot into another kernel from the currently running kernel. This is useful for kernel developers or other people who need to reboot very quickly without waiting for the whole BIOS boot process to finish. Note that there may appear some problems and kexec may not work correctly for you because the devices won’t fully reinitiate when using this method.
yum install kexec-tools
vi /etc/systemd/system/[email protected]
[Unit]
Description=load %i kernel into the current kernel
Documentation=man:kexec(8)
DefaultDependencies=no
Before=shutdown.target umount.target final.target
[Service]
Type=oneshot
ExecStart=/usr/bin/kexec -l /boot/vmlinuz-%i –initrd=/boot/initramfs-%i.img –reuse-cmdline
[Install]
WantedBy=kexec.target
systemctl enable kexec-load@linux
systemctl kexec
If you wish to load a different kernel for the next kexec, for example linux-lts, disable the service for the current kernel and enable the one for the new kernel:
systemctl disable kexec-load@linux
systemctl enable kexec-load@linux-lts
It is also perfectly legal to invoke kexec manually:
kexec -l /boot/vmlinuz-linux –initrd=/boot/initramfs-linux.img –reuse-cmdline
exec -e