about summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorWill Fancher <elvishjerricco@gmail.com>2024-03-26 18:09:33 -0400
committerGitHub <noreply@github.com>2024-03-26 18:09:33 -0400
commitc77e28a0137b288ed46550d8940301b2f79903c0 (patch)
treeb33ccf73eb75ce42b991b9d7b5087513e57cfe55 /nixos/modules/system
parent8ab9a91a1a26752572d2147933caf8ab6faa5f3f (diff)
parente2e43f6ce75044a353c3846e00840ac17cf5440e (diff)
Merge pull request #298201 from philiptaron/fix-initrd-activation-with-gpt-auto
nixos/systemd/initrd: make systemd mount root as `rw` when using gpt-auto to find it
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/systemd/initrd.nix5
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/systemd/initrd.nix b/nixos/modules/system/boot/systemd/initrd.nix
index e4f61db0cd02a..06359f273846a 100644
--- a/nixos/modules/system/boot/systemd/initrd.nix
+++ b/nixos/modules/system/boot/systemd/initrd.nix
@@ -392,7 +392,10 @@ in {
 
     boot.kernelParams = [
       "root=${config.boot.initrd.systemd.root}"
-    ] ++ lib.optional (config.boot.resumeDevice != "") "resume=${config.boot.resumeDevice}";
+    ] ++ lib.optional (config.boot.resumeDevice != "") "resume=${config.boot.resumeDevice}"
+      # `systemd` mounts root in initrd as read-only unless "rw" is on the kernel command line.
+      # For NixOS activation to succeed, we need to have root writable in initrd.
+      ++ lib.optional (config.boot.initrd.systemd.root == "gpt-auto") "rw";
 
     boot.initrd.systemd = {
       initrdBin = [pkgs.bash pkgs.coreutils cfg.package.kmod cfg.package];