mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 20:25:32 +03:00
stage-2-init: fix false positives for RO Nix store mounts
We need to take the "top" mount instead of any mount, which is the last line printed by findmnt. Additionally, make the regex more strict, so we don't select mount options ending in ro (like `errors=remount-ro` from ext4, or overlay paths ending in 'ro') and accidentally leave the Nix store RW after boot.
This commit is contained in:
parent
189200a18d
commit
2f3a80c96f
1 changed files with 2 additions and 1 deletions
|
@ -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 --direction backward --first-only --noheadings --output OPTIONS /nix/store)" =~ (^|,)ro(,|$) ]]; then
|
||||
if [ -z "$container" ]; then
|
||||
mount --bind /nix/store /nix/store
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue