diff options
author | Naïm Favier <n@monade.li> | 2022-12-27 23:22:44 +0100 |
---|---|---|
committer | Naïm Favier <n@monade.li> | 2022-12-29 14:06:40 +0100 |
commit | 80665d606ab66a82fc969a24a8d0143914683806 (patch) | |
tree | bcf81ed62315643e1d781c4ae4c523b838b5a2e9 | |
parent | 3fc528ff7fa9d0de0343ffd877cdb76287be2549 (diff) | |
download | nixpkgs-80665d606ab66a82fc969a24a8d0143914683806.tar nixpkgs-80665d606ab66a82fc969a24a8d0143914683806.tar.gz nixpkgs-80665d606ab66a82fc969a24a8d0143914683806.tar.bz2 nixpkgs-80665d606ab66a82fc969a24a8d0143914683806.tar.lz nixpkgs-80665d606ab66a82fc969a24a8d0143914683806.tar.xz nixpkgs-80665d606ab66a82fc969a24a8d0143914683806.tar.zst nixpkgs-80665d606ab66a82fc969a24a8d0143914683806.zip |
nixos/systemd-boot: skip EFI update to 252
That version has a regression that leaves some machines unbootable. While we wait for the fix (252.2) to land in master, this is a workaround that should save people some pain.
-rwxr-xr-x[-rw-r--r--] | nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py | 15 | ||||
-rw-r--r-- | nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix | 6 |
2 files changed, 15 insertions, 6 deletions
diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py index 68da2061591..ad7e2184d2a 100644..100755 --- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py +++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py @@ -16,6 +16,7 @@ import datetime import glob import os.path from typing import NamedTuple, List, Optional +from packaging import version class SystemIdentifier(NamedTuple): profile: Optional[str] @@ -258,12 +259,18 @@ def main() -> None: if available_match is None: raise Exception("could not determine systemd-boot version") - installed_version = installed_match.group(1) - available_version = available_match.group(1) + installed_version = version.parse(installed_match.group(1)) + available_version = version.parse(available_match.group(1)) + # systemd 252 has a regression that leaves some machines unbootable, so we skip that update. + # The fix is in 252.2 + # See https://github.com/systemd/systemd/issues/25363 and https://github.com/NixOS/nixpkgs/pull/201558#issuecomment-1348603263 if installed_version < available_version: - print("updating systemd-boot from %s to %s" % (installed_version, available_version)) - subprocess.check_call(["@systemd@/bin/bootctl", "--esp-path=@efiSysMountPoint@", "update"]) + if version.parse('252') <= available_version < version.parse('252.2'): + print("skipping systemd-boot update to %s because of known regression" % available_version) + else: + print("updating systemd-boot from %s to %s" % (installed_version, available_version)) + subprocess.check_call(["@systemd@/bin/bootctl", "--esp-path=@efiSysMountPoint@", "update"]) mkdir_p("@efiSysMountPoint@/efi/nixos") mkdir_p("@efiSysMountPoint@/loader/entries") diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix index 8cb7c7b8e47..103d6e583c3 100644 --- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix +++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix @@ -7,12 +7,14 @@ let efi = config.boot.loader.efi; + python3 = pkgs.python3.withPackages (ps: [ ps.packaging ]); + systemdBootBuilder = pkgs.substituteAll { src = ./systemd-boot-builder.py; isExecutable = true; - inherit (pkgs) python3; + inherit python3; systemd = config.systemd.package; @@ -48,7 +50,7 @@ let }; checkedSystemdBootBuilder = pkgs.runCommand "systemd-boot" { - nativeBuildInputs = [ pkgs.mypy ]; + nativeBuildInputs = [ pkgs.mypy python3 ]; } '' install -m755 ${systemdBootBuilder} $out mypy \ |