Osegi
Software·2 min read

kmorph: Open-Source Tool Recovers Linux Kernel Crashes in Seconds

The Multikernel team has released kmorph, an open-source project that swaps in a standby Linux kernel after a crash or update, restoring a server in about two seconds.

Server rack with a terminal showing a Linux kernel switching to a standby kernel after a crash.
Image: Хабр

The Multikernel team has released kmorph, an open-source project that restores a Linux machine after a kernel crash and can also replace the running kernel without a full reboot. The project is developed by Cong Wang, the maintainer of the Linux kernel's Traffic Control (TC) subsystem.

In tests run by the developers, a server running nginx resumed work roughly two seconds after a kernel failure. The team says it aims to make the switchover instant and invisible to connected clients.

How it works

Today, a kernel crash on a PC or server can mean several minutes of downtime because of hardware initialization, loading the system environment and saving a memory dump through kdump. With kdump, the system effectively boots twice: first a separate kernel is loaded via kexec to save the dump, then the working kernel starts along with system services.

kmorph avoids this by loading a spare Linux kernel and a minimal system environment into memory in advance, bound to a dedicated processor core. That environment monitors the main kernel. If the main kernel hangs or panics, the standby takes over, saves the crashed kernel's memory dump, and assumes control of CPU cores, memory, devices, network configuration and the file system.

Two tools coordinate the switch: kmorph runs in the active environment, builds the standby environment and syncs network state into it, while kmorphd runs in the standby environment and watches the active one. Common services such as nginx can be kept running in standby, so they handle requests immediately after the switch.

Updates and support

The same mechanism can be used to update the kernel without a traditional reboot. The kernel already includes Kexec HandOver (KHO) and Live Update Orchestrator (LUO), which start a new kernel from an old one without losing state. However, they cannot help after a crash, since they need the running kernel to preserve its state, and they are slower because they still require a kexec reboot.

kmorph currently supports x86_64 and ARM64, with RISC-V support in development. Distribution integration follows the kdump model, using dracut, initramfs-tools, kernel-install and systemd.

Apps worth a look

SUMO: the number puzzle

Tap the right tiles, add them up, hit the target. Easy to learn, hard to master. Free, for all ages.

Tags:linuxkmorphmultikernelkernelkdumpopen source

More from this day

See all →

More in: Software

See all →