nixos/amazon: move nvme_core.io_timeout to runtime module

This kernel parameter was accidentally added to the image builder module
in 2018 (e4777ae2d8) when it should have been in the runtime config.
This causes a mismatch between AMIs built with the builder and systems
configured with just the runtime module.

Move it to modules/virtualisation/amazon-image.nix so that all EC2
instances get the recommended NVMe timeout, regardless of how they
were provisioned.
This commit is contained in:
edef 2026-01-10 23:58:09 +00:00
parent 84786db9e0
commit 323d269a24
2 changed files with 13 additions and 15 deletions

View file

@ -11,7 +11,6 @@ let
mkOption
optionalString
types
versionAtLeast
;
inherit (lib.options) literalExpression;
cfg = config.amazonImage;
@ -46,16 +45,6 @@ in
})
];
# Amazon recommends setting this to the highest possible value for a good EBS
# experience, which prior to 4.15 was 255.
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-ebs-volumes.html#timeout-nvme-ebs-volumes
config.boot.kernelParams =
let
timeout =
if versionAtLeast config.boot.kernelPackages.kernel.version "4.15" then "4294967295" else "255";
in
[ "nvme_core.io_timeout=${timeout}" ];
options.amazonImage = {
contents = mkOption {
example = literalExpression ''

View file

@ -59,9 +59,18 @@ in
];
boot.initrd.kernelModules = [ "xen-blkfront" ];
boot.initrd.availableKernelModules = [ "nvme" ];
boot.kernelParams = [
boot.kernelParams =
let
# Amazon recommends setting this to the highest possible value for a good EBS
# experience, which prior to 4.15 was 255.
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-ebs-volumes.html#timeout-nvme-ebs-volumes
nvmeTimeout =
if lib.versionAtLeast config.boot.kernelPackages.kernel.version "4.15" then "4294967295" else "255";
in
[
"console=ttyS0,115200n8"
"random.trust_cpu=on"
"nvme_core.io_timeout=${nvmeTimeout}"
];
# Prevent the nouveau kernel module from being loaded, as it