diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh index 516cbb295fa42..788f64c948f4e 100644 --- a/nixos/modules/system/boot/stage-1-init.sh +++ b/nixos/modules/system/boot/stage-1-init.sh @@ -140,6 +140,7 @@ done # Create device nodes in /dev. +@preDeviceCommands@ echo "running udev..." mkdir -p /etc/udev ln -sfn @udevRules@ /etc/udev/rules.d diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index ace2d10ec9c1e..a9acb4453d328 100644 --- a/nixos/modules/system/boot/stage-1.nix +++ b/nixos/modules/system/boot/stage-1.nix @@ -203,7 +203,7 @@ let inherit (config.boot) resumeDevice devSize runSize; inherit (config.boot.initrd) checkJournalingFS - preLVMCommands postDeviceCommands postMountCommands kernelModules; + preLVMCommands preDeviceCommands postDeviceCommands postMountCommands kernelModules; resumeDevices = map (sd: if sd ? device then sd.device else "/dev/disk/by-label/${sd.label}") (filter (sd: sd ? label || hasPrefix "/dev/" sd.device) config.swapDevices); @@ -303,6 +303,15 @@ in ''; }; + boot.initrd.preDeviceCommands = mkOption { + default = ""; + type = types.lines; + description = '' + Shell commands to be executed before udev is started to create + device nodes. + ''; + }; + boot.initrd.postDeviceCommands = mkOption { default = ""; type = types.lines; diff --git a/nixos/modules/testing/test-instrumentation.nix b/nixos/modules/testing/test-instrumentation.nix index f37bbd0246da1..c233beb63ca72 100644 --- a/nixos/modules/testing/test-instrumentation.nix +++ b/nixos/modules/testing/test-instrumentation.nix @@ -43,6 +43,11 @@ let kernel = config.boot.kernelPackages.kernel; in # into thinking they're running interactively. environment.variables.PAGER = ""; + boot.initrd.preDeviceCommands = + '' + echo 600 > /proc/sys/kernel/hung_task_timeout_secs + ''; + boot.initrd.postDeviceCommands = '' # Using acpi_pm as a clock source causes the guest clock to