git.iko.soy/typeable/nixpkgs
on master help sign in
stage2: use atomic bind mounts
commitcb3a0f55e8e37c4f7db239ce27491fd66c9503cc authorMichael Fellinger <michael.fellinger@iohk.io> dateWed 20 Oct 2021, 22:09 (5 years ago) parent726da12
1 file changed+5−3
nixos/modules/system/boot/stage-2-init.sh+5−3
nixos/modules/system/boot/stage-2-init.sh+5−3
@@ -62,9 +62,11 @@ chown -f 0:30000 /nix/store
6262chmod -f 1775 /nix/store
6363if [ -n "@readOnlyStore@" ]; then
6464 if ! [[ "$(findmnt --noheadings --output OPTIONS /nix/store)" =~ ro(,|$) ]]; then
65− # FIXME when linux < 4.5 is EOL, switch to atomic bind mounts
66− #mount /nix/store /nix/store -o bind,remount,ro
67− mount --bind /nix/store /nix/store
65+ if [ -z "$container" ]; then
66+ mount --bind /nix/store /nix/store
67+ else
68+ mount --rbind /nix/store /nix/store
69+ fi
6870 mount -o remount,ro,bind /nix/store
6971 fi
7072fi