diff --git a/nixos/modules/system/boot/stage-2-init.sh b/nixos/modules/system/boot/stage-2-init.sh index b5627ec8e5717..847badaee804d 100755 --- a/nixos/modules/system/boot/stage-2-init.sh +++ b/nixos/modules/system/boot/stage-2-init.sh @@ -69,7 +69,8 @@ fi chown -f 0:30000 /nix/store chmod -f 1775 /nix/store if [ -n "@readOnlyNixStore@" ]; then - if ! [[ "$(findmnt --noheadings --output OPTIONS /nix/store)" =~ ro(,|$) ]]; then + # #375257: Ensure that we pick the "top" (i.e. last) mount so we don't get a false positive for a lower mount. + if ! [[ "$(findmnt --noheadings --output OPTIONS /nix/store | tail -n1)" =~ (^|,)ro(,|$) ]]; then if [ -z "$container" ]; then mount --bind /nix/store /nix/store else