From 79d81166713174e8e49df67f866cf1123c86b8ec Mon Sep 17 00:00:00 2001 From: r-vdp Date: Mon, 1 Jul 2024 14:41:32 +0200 Subject: [PATCH 1/2] Fix ssh in initrd for systemd-initrd Broken in https://github.com/NixOS/nixpkgs/pull/323753 --- nixos/modules/system/boot/initrd-ssh.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nixos/modules/system/boot/initrd-ssh.nix b/nixos/modules/system/boot/initrd-ssh.nix index cbeec4588f59..e825198229be 100644 --- a/nixos/modules/system/boot/initrd-ssh.nix +++ b/nixos/modules/system/boot/initrd-ssh.nix @@ -265,7 +265,10 @@ in config.boot.initrd.network.ssh.authorizedKeys ++ (map (file: lib.fileContents file) config.boot.initrd.network.ssh.authorizedKeyFiles)); }; - storePaths = ["${package}/bin/sshd"]; + storePaths = [ + "${package}/bin/sshd" + "${package}/libexec/sshd-session" + ]; services.sshd = { description = "SSH Daemon"; From d1e0f30cb2b0f4fd69b81ea189ea9fa035d8711c Mon Sep 17 00:00:00 2001 From: r-vdp Date: Mon, 1 Jul 2024 15:31:58 +0200 Subject: [PATCH 2/2] Fix SSH in scripted initrd Co-authored-by: Emily --- nixos/modules/system/boot/initrd-ssh.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nixos/modules/system/boot/initrd-ssh.nix b/nixos/modules/system/boot/initrd-ssh.nix index e825198229be..650ce593e945 100644 --- a/nixos/modules/system/boot/initrd-ssh.nix +++ b/nixos/modules/system/boot/initrd-ssh.nix @@ -166,6 +166,10 @@ in UseDNS no ''} + ${optionalString (!config.boot.initrd.systemd.enable) '' + SshdSessionPath /bin/sshd-session + ''} + ${cfg.extraConfig} ''; in mkIf enabled { @@ -191,6 +195,7 @@ in boot.initrd.extraUtilsCommands = mkIf (!config.boot.initrd.systemd.enable) '' copy_bin_and_libs ${package}/bin/sshd + copy_bin_and_libs ${package}/libexec/sshd-session cp -pv ${pkgs.glibc.out}/lib/libnss_files.so.* $out/lib '';