From fcf0e540b16eb487e7bf131e52d8002e643aeb5e Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Tue, 6 Dec 2022 13:47:40 +0100 Subject: [PATCH 1/3] nixos/manual: document kernel backporting policy and implications of it I'm well aware that this issue is currently under discussion[1] and that these things may change. Also, please don't misinterpret this as an attempt to end the discussion. This topic made it obvious that people are surprised by the way this issue is handled and only finding out about this unwritten rule because of asking is not a good state IMHO, so I decided to document the following things: * Right now we drop kernels as soon as they get out of maintenance (LTS kernels even before the next stable NixOS that will exceed their lifespan). * The `latestCompatibleLinuxPackages` attribute from ZFS isn't monotonic since latest only refers to the latest supported kernel. * In fact `latestCompatibleLinuxPackages` doesn't seem to be documented at all in the manual, so I also did that. [1] https://discourse.nixos.org/t/aggressive-kernel-removal-on-eol-in-nixos/23097 --- .../configuration/linux-kernel.chapter.md | 30 ++++++++++++++ .../configuration/linux-kernel.chapter.xml | 41 +++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/nixos/doc/manual/configuration/linux-kernel.chapter.md b/nixos/doc/manual/configuration/linux-kernel.chapter.md index 1d06543d4f1e..87c1cf6a7cb8 100644 --- a/nixos/doc/manual/configuration/linux-kernel.chapter.md +++ b/nixos/doc/manual/configuration/linux-kernel.chapter.md @@ -17,6 +17,16 @@ you may want to use one of the unversioned `pkgs.linuxPackages_*` aliases such as `pkgs.linuxPackages_latest`, that are kept up to date with new versions. +Please note that the current convention in NixOS is to only keep actively +maintained kernel versions on both unstable and the currently supported stable +release(s) of NixOS. This means that a non-longterm kernel will be removed after it's +abandoned by the kernel developers, even on stable NixOS versions. If you +pin your kernel onto a non-longterm version, expect your evaluation to fail as +soon as the version is out of maintenance. + +Longterm versions of kernels will be removed before the next stable NixOS that will +exceed the maintenance period of the kernel version. + The default Linux kernel configuration should be fine for most users. You can see the configuration of your current kernel with the following command: @@ -138,3 +148,23 @@ $ cd linux-* $ make -C $dev/lib/modules/*/build M=$(pwd)/drivers/net/ethernet/mellanox modules # insmod ./drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko ``` + +## ZFS {#sec-linux-zfs} + +It's a common issue that the latest stable version of ZFS doesn't support the latest +available Linux kernel. It's possible to pin the system to the latest available kernel +version *that is supported by ZFS* like this: + +```nix +{ + boot.kernelPackages = pkgs.zfs.latestCompatibleLinuxPackages; +} +``` + +Please note that the version this attribute points to isn't monotonic because the latest kernel +version only refers to kernel versions supported by the Linux developers. In other words, +the latest kernel version that ZFS is compatible with may decrease over time. + +An example: the latest version ZFS is compatible with is 5.19 which is a non-longterm version. When 5.19 +is out of maintenance, the latest supported kernel version is 5.15 because it's longterm and the versions +5.16, 5.17 and 5.18 are already out of maintenance because they're non-longterm. diff --git a/nixos/doc/manual/from_md/configuration/linux-kernel.chapter.xml b/nixos/doc/manual/from_md/configuration/linux-kernel.chapter.xml index a1d6815af29c..7fb3ba5ac98f 100644 --- a/nixos/doc/manual/from_md/configuration/linux-kernel.chapter.xml +++ b/nixos/doc/manual/from_md/configuration/linux-kernel.chapter.xml @@ -21,6 +21,19 @@ boot.kernelPackages = pkgs.linuxKernel.packages.linux_3_10; pkgs.linuxPackages_latest, that are kept up to date with new versions. + + Please note that the current convention in NixOS is to only keep + actively maintained kernel versions on both unstable and the + currently supported stable release(s) of NixOS. This means that a + non-longterm kernel will be removed after it’s abandoned by the + kernel developers, even on stable NixOS versions. If you pin your + kernel onto a non-longterm version, expect your evaluation to fail + as soon as the version is out of maintenance. + + + Longterm versions of kernels will be removed before the next stable + NixOS that will exceed the maintenance period of the kernel version. + The default Linux kernel configuration should be fine for most users. You can see the configuration of your current kernel with the @@ -154,4 +167,32 @@ $ make -C $dev/lib/modules/*/build M=$(pwd)/drivers/net/ethernet/mellanox module # insmod ./drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko +
+ ZFS + + It’s a common issue that the latest stable version of ZFS doesn’t + support the latest available Linux kernel. It’s possible to pin + the system to the latest available kernel version that + is supported by ZFS like this: + + +{ + boot.kernelPackages = pkgs.zfs.latestCompatibleLinuxPackages; +} + + + Please note that the version this attribute points to isn’t + monotonic because the latest kernel version only refers to kernel + versions supported by the Linux developers. In other words, the + latest kernel version that ZFS is compatible with may decrease + over time. + + + An example: the latest version ZFS is compatible with is 5.19 + which is a non-longterm version. When 5.19 is out of maintenance, + the latest supported kernel version is 5.15 because it’s longterm + and the versions 5.16, 5.17 and 5.18 are already out of + maintenance because they’re non-longterm. + +
From fa257ecb332118786db8e6f635bbd0970838a6e0 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Tue, 6 Dec 2022 14:38:16 +0100 Subject: [PATCH 2/3] nixos/kernel: link manual (with backport policies) from boot.kernelPackages Yes I know it's dirty to link the rendered HTML, but linking `#sec-kernel-config` breaks the manual build for me with the following error: element link: validity error : IDREF attribute linkend references an unknown ID "sec-kernel-config" This is something that should probably be fixed, but for the current change I'd argue that this is good enough (in fact even the `nix.settings`-option uses that hack). --- nixos/modules/system/boot/kernel.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index 6783f8ec62ff..b13e50cb17d2 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -62,6 +62,11 @@ in configuration. For instance, if you use the NVIDIA X driver, then it also needs to contain an attribute {var}`nvidia_x11`. + + Please note that we strictly support kernel versions that are + maintained by the Linux developers only. More information on the + availability of kernel versions is documented + [in the Linux section of the manual](https://nixos.org/manual/nixos/unstable/index.html#sec-kernel-config). ''; }; From 8476b02749ac97b49629745ded7b8b333c8d024a Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Fri, 9 Dec 2022 11:34:05 +0100 Subject: [PATCH 3/3] nixos/doc: suggest using the latest longterm kernel for ZFS --- .../doc/manual/configuration/linux-kernel.chapter.md | 5 ++++- .../from_md/configuration/linux-kernel.chapter.xml | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/nixos/doc/manual/configuration/linux-kernel.chapter.md b/nixos/doc/manual/configuration/linux-kernel.chapter.md index 87c1cf6a7cb8..7b84416a8646 100644 --- a/nixos/doc/manual/configuration/linux-kernel.chapter.md +++ b/nixos/doc/manual/configuration/linux-kernel.chapter.md @@ -152,7 +152,10 @@ $ make -C $dev/lib/modules/*/build M=$(pwd)/drivers/net/ethernet/mellanox module ## ZFS {#sec-linux-zfs} It's a common issue that the latest stable version of ZFS doesn't support the latest -available Linux kernel. It's possible to pin the system to the latest available kernel +available Linux kernel. It is recommended to use the latest available LTS that's compatible +with ZFS. Usually this is the default kernel provided by nixpkgs (i.e. `pkgs.linuxPackages`). + +Alternatively, it's possible to pin the system to the latest available kernel version *that is supported by ZFS* like this: ```nix diff --git a/nixos/doc/manual/from_md/configuration/linux-kernel.chapter.xml b/nixos/doc/manual/from_md/configuration/linux-kernel.chapter.xml index 7fb3ba5ac98f..dd570e1d66c2 100644 --- a/nixos/doc/manual/from_md/configuration/linux-kernel.chapter.xml +++ b/nixos/doc/manual/from_md/configuration/linux-kernel.chapter.xml @@ -171,9 +171,15 @@ $ make -C $dev/lib/modules/*/build M=$(pwd)/drivers/net/ethernet/mellanox module ZFS It’s a common issue that the latest stable version of ZFS doesn’t - support the latest available Linux kernel. It’s possible to pin - the system to the latest available kernel version that - is supported by ZFS like this: + support the latest available Linux kernel. It is recommended to + use the latest available LTS that’s compatible with ZFS. Usually + this is the default kernel provided by nixpkgs (i.e. + pkgs.linuxPackages). + + + Alternatively, it’s possible to pin the system to the latest + available kernel version that is supported by + ZFS like this: {