From e2e43f6ce75044a353c3846e00840ac17cf5440e Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Fri, 22 Mar 2024 16:05:50 -0700 Subject: [PATCH] nixos/systemd/initrd: make systemd mount root as rw if gpt-auto is set --- nixos/modules/system/boot/systemd/initrd.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nixos/modules/system/boot/systemd/initrd.nix b/nixos/modules/system/boot/systemd/initrd.nix index e4f61db0cd02..06359f273846 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];