Kexec: Difference between revisions
m (→Usage: Make the code snippet a bit more graceful (doing `openrc shutdown' if kexec -l failed is dumb!) Add a note for scripters to make the code snippet even more graceful if they expect a reboot no matter what.) |
m (Needs to be two separate commands unfortunately.) |
||
Line 5: | Line 5: | ||
==Usage== | ==Usage== | ||
On a typical Alpine setup, it can be used via: | On a typical Alpine setup, it can be used manually via: | ||
{{Cmd|# kexec -l /boot/vmlinuz-edge --initrd \ | {{Cmd|# kexec -l /boot/vmlinuz-edge --initrd \ | ||
/boot/initramfs-edge --reuse-cmdline \ | /boot/initramfs-edge --reuse-cmdline \ | ||
&& openrc shutdown | && openrc shutdown | ||
& | # kexec -e}} | ||
{{Note|if the above is being used in a script and the machine is expected to reboot in the event of a kexec failure, append <code> || reboot</code> to the last line}} | {{Note|if the above is being used in a script and the machine is expected to reboot in the event of a kexec failure, append <code> || reboot</code> to the last line}} |
Revision as of 12:56, 5 September 2023
Kexec is a system call that enables loading and booting into another kernel. This is useful for faster reboots that skip the BIOS or UEFI initialisation process.
Installing kexec-tools
The userspace tools required to use it can be installed via
apk add kexec-tools kexec-tools-doc
The tools are not available on all flavors of Alpine, additionally not all kernels are compiled with the kexec syscall enabled. You will most likely want to check your /boot/config-* file for CONFIG_KEXEC=y
Usage
On a typical Alpine setup, it can be used manually via:
# kexec -l /boot/vmlinuz-edge --initrd \ /boot/initramfs-edge --reuse-cmdline \ && openrc shutdown # kexec -e
|| reboot
to the last lineThere are no Alpine-specific considerations for Kexec. Please review the man page and existing references below for more details. This page is deliberately kept short in order to avoid duplicating existing documentation.