diff options
-rw-r--r-- | nixos/modules/system/boot/stage-2-init.sh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/nixos/modules/system/boot/stage-2-init.sh b/nixos/modules/system/boot/stage-2-init.sh index 50ee0b8841e..afaca2e4158 100644 --- a/nixos/modules/system/boot/stage-2-init.sh +++ b/nixos/modules/system/boot/stage-2-init.sh @@ -62,9 +62,11 @@ chown -f 0:30000 /nix/store chmod -f 1775 /nix/store if [ -n "@readOnlyStore@" ]; then if ! [[ "$(findmnt --noheadings --output OPTIONS /nix/store)" =~ ro(,|$) ]]; then - # FIXME when linux < 4.5 is EOL, switch to atomic bind mounts - #mount /nix/store /nix/store -o bind,remount,ro - mount --bind /nix/store /nix/store + if [ -z "$container" ]; then + mount --bind /nix/store /nix/store + else + mount --rbind /nix/store /nix/store + fi mount -o remount,ro,bind /nix/store fi fi |