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.
mkMountConfig = path: opt: let
fsEntry = config.fileSystems."${path}";
in {
mkMountConfig = path: opt: {
# create the mount point, with desired acl
systemd.tmpfiles.settings."00-10-sane-fs"."${path}".d = opt.acl;
fileSystems."${path}" = {
@@ -144,22 +142,27 @@ let
# systemd-tmpfiles.service is one such example.
# 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`
# 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"
"nofail"
# x-systemd options documented here:
# - <https://www.freedesktop.org/software/systemd/man/systemd.mount.html>
"x-systemd.before=local-fs.target"
# "x-systemd.before=local-fs.target"
];
noCheck = true;
};
# specify `systemd.mounts` because otherwise systemd doesn't seem to pick up my `x-systemd` fs options?
systemd.mounts = [{
where = path;
what = if fsEntry.device != null then fsEntry.device else "";
type = fsEntry.fsType;
options = lib.concatStringsSep "," fsEntry.options;
before = [ "local-fs.target" ];
}];
# systemd.mounts = let
# fsEntry = config.fileSystems."${path}";
# in [{
# where = path;
# what = if fsEntry.device != null then fsEntry.device else "";
# type = fsEntry.fsType;
# options = lib.concatStringsSep "," fsEntry.options;
# # before = [ "local-fs.target" ];
# }];
};
mkDirConfig = path: opt: {