From db4fdd6247ec191677ac84e08da274ab88a0682e Mon Sep 17 00:00:00 2001 From: Luflosi Date: Tue, 3 May 2022 17:01:39 +0200 Subject: [PATCH] nixos/filesystems: skip fsck for bind mounts Without this change, configurations like ```nix fileSystems."/path/to/bindMountedDirectory" = { device = "/path/to/originalDirectory"; options = [ "bind" ]; }; ``` will lead to a warning message in `dmesg`: ``` systemd-fstab-generator: Checking was requested for "/path/to/originalDirectory", but it is not a device. ``` This happens because the generated /etc/fstab entry contains a non-zero fsck pass number, which doesn't make sense for a bind mount. --- nixos/modules/tasks/filesystems.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix index b8afe231dd2e..82adc499ad0e 100644 --- a/nixos/modules/tasks/filesystems.nix +++ b/nixos/modules/tasks/filesystems.nix @@ -280,7 +280,8 @@ in environment.etc.fstab.text = let fsToSkipCheck = [ "none" "bindfs" "btrfs" "zfs" "tmpfs" "nfs" "vboxsf" "glusterfs" "apfs" ]; - skipCheck = fs: fs.noCheck || fs.device == "none" || builtins.elem fs.fsType fsToSkipCheck; + isBindMount = fs: builtins.elem "bind" fs.options; + skipCheck = fs: fs.noCheck || fs.device == "none" || builtins.elem fs.fsType fsToSkipCheck || isBindMount fs; # https://wiki.archlinux.org/index.php/fstab#Filepath_spaces escape = string: builtins.replaceStrings [ " " "\t" ] [ "\\040" "\\011" ] string; swapOptions = sw: concatStringsSep "," (