sane.fs: dont have local-fs.target depend on any of my (persistence) bind mounts

otherwise it's too easy for local-fs to hang (/mnt/persist/private), or fail (/mnt/pool), and i lose critical things like *networking*

this was only working because on servo the /mnt/persist/private deps caused a cycle and systemd just _removed_ local-fs.target
This commit is contained in:
2024-11-13 12:05:31 +00:00
parent d37e7fb5e8
commit 7b88c9c644

View File

@@ -129,9 +129,7 @@ let
}; };
# given a mountEntry definition, evaluate its toplevel `config` output. # given a mountEntry definition, evaluate its toplevel `config` output.
mkMountConfig = path: opt: let mkMountConfig = path: opt: {
fsEntry = config.fileSystems."${path}";
in {
# create the mount point, with desired acl # create the mount point, with desired acl
systemd.tmpfiles.settings."00-10-sane-fs"."${path}".d = opt.acl; systemd.tmpfiles.settings."00-10-sane-fs"."${path}".d = opt.acl;
fileSystems."${path}" = { fileSystems."${path}" = {
@@ -144,22 +142,27 @@ let
# systemd-tmpfiles.service is one such example. # systemd-tmpfiles.service is one such example.
# so, we *prefer* to be ordered before `local-fs.target` (since everything pulls that in), # so, we *prefer* to be ordered before `local-fs.target` (since everything pulls that in),
# but we generally don't want to *fail* `local-fs.target`, since that breaks everything, even `ssh` # but we generally don't want to *fail* `local-fs.target`, since that breaks everything, even `ssh`
# on the other hand, /mnt/persist/private can take an indeterminate amount of time to be mounted,
# and if they block local-fs, that might block things like networking as well...
# so don't even required `before=local-fs.target`
# "noauto" # "noauto"
"nofail" "nofail"
# x-systemd options documented here: # x-systemd options documented here:
# - <https://www.freedesktop.org/software/systemd/man/systemd.mount.html> # - <https://www.freedesktop.org/software/systemd/man/systemd.mount.html>
"x-systemd.before=local-fs.target" # "x-systemd.before=local-fs.target"
]; ];
noCheck = true; noCheck = true;
}; };
# specify `systemd.mounts` because otherwise systemd doesn't seem to pick up my `x-systemd` fs options? # specify `systemd.mounts` because otherwise systemd doesn't seem to pick up my `x-systemd` fs options?
systemd.mounts = [{ # systemd.mounts = let
where = path; # fsEntry = config.fileSystems."${path}";
what = if fsEntry.device != null then fsEntry.device else ""; # in [{
type = fsEntry.fsType; # where = path;
options = lib.concatStringsSep "," fsEntry.options; # what = if fsEntry.device != null then fsEntry.device else "";
before = [ "local-fs.target" ]; # type = fsEntry.fsType;
}]; # options = lib.concatStringsSep "," fsEntry.options;
# # before = [ "local-fs.target" ];
# }];
}; };
mkDirConfig = path: opt: { mkDirConfig = path: opt: {