summary refs log tree commit diff
diff options
context:
space:
mode:
authorBjørn Forsman <bjorn.forsman@gmail.com>2022-11-29 14:20:25 +0100
committerBjørn Forsman <bjorn.forsman@gmail.com>2022-11-29 20:39:05 +0100
commit19a6b85e8f8daca80e38418e96247cc499e2640e (patch)
treeabe768a6debda5e63fe90c1057cbcb57ca0df48e
parent6f7e53444a62bf9a7ce76e7eceb2c6d261c2e131 (diff)
downloadnixpkgs-19a6b85e8f8daca80e38418e96247cc499e2640e.tar
nixpkgs-19a6b85e8f8daca80e38418e96247cc499e2640e.tar.gz
nixpkgs-19a6b85e8f8daca80e38418e96247cc499e2640e.tar.bz2
nixpkgs-19a6b85e8f8daca80e38418e96247cc499e2640e.tar.lz
nixpkgs-19a6b85e8f8daca80e38418e96247cc499e2640e.tar.xz
nixpkgs-19a6b85e8f8daca80e38418e96247cc499e2640e.tar.zst
nixpkgs-19a6b85e8f8daca80e38418e96247cc499e2640e.zip
nixos: disable systemd-oomd when enableUnifiedCgroupHierarchy is false
Or else systemd-oomd gets marked as failed due to
"Userspace Out-Of-Memory (OOM) Killer was skipped because of a failed condition check (ConditionControlGroupController=v2)."
and cause the system to enter degraded state.

Ref https://github.com/NixOS/nixpkgs/issues/195085
-rw-r--r--nixos/modules/system/boot/systemd.nix4
1 files changed, 4 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index 8f1086c9c53..e37ed853181 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -612,6 +612,10 @@ in
 
     boot.kernelParams = optional (!cfg.enableUnifiedCgroupHierarchy) "systemd.unified_cgroup_hierarchy=0";
 
+    # Avoid potentially degraded system state due to
+    # "Userspace Out-Of-Memory (OOM) Killer was skipped because of a failed condition check (ConditionControlGroupController=v2)."
+    systemd.services.systemd-oomd.enable = mkIf (!cfg.enableUnifiedCgroupHierarchy) false;
+
     services.logrotate.settings = {
       "/var/log/btmp" = mapAttrs (_: mkDefault) {
         frequency = "monthly";