diff options
author | Ramses <ramses@well-founded.dev> | 2023-07-13 17:12:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-13 17:12:54 +0200 |
commit | 1bee79f9f7c4a66ac144944f72a02c2e14bd931b (patch) | |
tree | 0f7514001cfbc213bdba945c199d49fccbf7eea7 | |
parent | 6e7938422dd95d4a1b19a0fb8a3bf3f3fa42b5ab (diff) | |
download | nixpkgs-1bee79f9f7c4a66ac144944f72a02c2e14bd931b.tar nixpkgs-1bee79f9f7c4a66ac144944f72a02c2e14bd931b.tar.gz nixpkgs-1bee79f9f7c4a66ac144944f72a02c2e14bd931b.tar.bz2 nixpkgs-1bee79f9f7c4a66ac144944f72a02c2e14bd931b.tar.lz nixpkgs-1bee79f9f7c4a66ac144944f72a02c2e14bd931b.tar.xz nixpkgs-1bee79f9f7c4a66ac144944f72a02c2e14bd931b.tar.zst nixpkgs-1bee79f9f7c4a66ac144944f72a02c2e14bd931b.zip |
nixos/swap: make sure all kernel modules are loaded before creating swap devices. (#239163)
Co-authored-by: iliana etaoin <iliana@buttslol.net>
-rw-r--r-- | nixos/modules/config/swap.nix | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/nixos/modules/config/swap.nix b/nixos/modules/config/swap.nix index 0a7e45bffb2..8989a640826 100644 --- a/nixos/modules/config/swap.nix +++ b/nixos/modules/config/swap.nix @@ -252,6 +252,11 @@ in let realDevice' = escapeSystemdPath sw.realDevice; in nameValuePair "mkswap-${sw.deviceName}" { description = "Initialisation of swap device ${sw.device}"; + # The mkswap service fails for file-backed swap devices if the + # loop module has not been loaded before the service runs. + # We add an ordering constraint to run after systemd-modules-load to + # avoid this race condition. + after = [ "systemd-modules-load.service" ]; wantedBy = [ "${realDevice'}.swap" ]; before = [ "${realDevice'}.swap" ]; path = [ pkgs.util-linux pkgs.e2fsprogs ] |