1 { config, lib, pkgs, ... }:
6 crashdump = config.boot.crashDump;
8 kernelParams = concatStringsSep " " crashdump.kernelParams;
20 If enabled, NixOS will set up a kernel that will
21 boot on crash, and leave the user in systemd rescue
22 to be able to save the crashed kernel dump at
24 It also activates the NMI watchdog.
27 reservedMemory = mkOption {
31 The amount of memory reserved for the crashdump kernel.
32 If you choose a too high value, dmesg will mention
33 "crashkernel reservation failed".
36 kernelParams = mkOption {
37 type = types.listOf types.str;
38 default = [ "1" "boot.shell_on_fail" ];
40 Parameters that will be passed to the kernel kexec-ed on crash.
49 config = mkIf crashdump.enable {
52 echo "loading crashdump kernel...";
53 ${pkgs.kexec-tools}/sbin/kexec -p /run/current-system/kernel \
54 --initrd=/run/current-system/initrd \
55 --reset-vga --console-vga \
56 --command-line="init=$(readlink -f /run/current-system/init) irqpoll maxcpus=1 reset_devices ${kernelParams}"
59 "crashkernel=${crashdump.reservedMemory}"
64 name = "crashdump-config";