about summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorPhilip Taron <philip.taron@gmail.com>2024-03-22 16:05:50 -0700
committerPhilip Taron <philip.taron@gmail.com>2024-03-22 16:08:29 -0700
commite2e43f6ce75044a353c3846e00840ac17cf5440e (patch)
tree897ad18024acc2df628e11878722819ec28348da /nixos/modules/system
parent53c8f2940d16701ac96fcf660f1f5b0ff15f2133 (diff)
nixos/systemd/initrd: make systemd mount root as rw if gpt-auto is set
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];