From b9e0a682abcbab6d754f30cceded64962a2da8fa Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 7 Jan 2025 01:33:40 +0300 Subject: [PATCH] fix(users/tazjin): disable systemd user slice freezing I have a suspicion that some systemd bugs around this feature (I actually couldn't figure out what it does and why?) introduced in systemd 256 lead to issues with suspend that I've seen in recent times. In the issue, my machine is seemingly frozen after resuming from suspend. I'd seen this previously on EXWM with xsecurelock, but now I'm seeing it on niri with swaylock, where it is more severe because switching to a VT is impossible. Upstream tickets: - https://github.com/systemd/systemd/issues/33083 - https://github.com/systemd/systemd/issues/33626 - https://bugzilla.redhat.com/show_bug.cgi?id=2321268 I'm not running a VM, but there seem to be multiple different bugs leading to this, so who knows. It's worth a try. The long-term fix will be getting rid of systemd) Change-Id: Ie985a3f222f3daac1e3c7db79ee8624c66297374 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12961 Autosubmit: tazjin Reviewed-by: tazjin Tested-by: BuildkiteCI --- users/tazjin/nixos/khamovnik/default.nix | 1 + users/tazjin/nixos/modules/systemd-unfreeze.nix | 15 +++++++++++++++ users/tazjin/nixos/tverskoy/default.nix | 1 + 3 files changed, 17 insertions(+) create mode 100644 users/tazjin/nixos/modules/systemd-unfreeze.nix diff --git a/users/tazjin/nixos/khamovnik/default.nix b/users/tazjin/nixos/khamovnik/default.nix index dcb19be2a..225bc25d7 100644 --- a/users/tazjin/nixos/khamovnik/default.nix +++ b/users/tazjin/nixos/khamovnik/default.nix @@ -22,6 +22,7 @@ in (usermod "home-config.nix") (usermod "laptop.nix") (usermod "physical.nix") + (usermod "systemd-unfreeze.nix") (pkgs.home-manager.src + "/nixos") ] ++ (if (builtins.pathExists private) then [ (private + "/nixos/yandex.nix") diff --git a/users/tazjin/nixos/modules/systemd-unfreeze.nix b/users/tazjin/nixos/modules/systemd-unfreeze.nix new file mode 100644 index 000000000..650d233fb --- /dev/null +++ b/users/tazjin/nixos/modules/systemd-unfreeze.nix @@ -0,0 +1,15 @@ +# Workaround for disabling semi-broken systemd user slice freezing (whatever +# that is). This can cause machines to become unusable after resume. + +let + override.environment.SYSTEMD_SLEEP_FREEZE_USER_SESSIONS = "false"; +in +{ + systemd.services = { + systemd-suspend = override; + systemd-hibernate = override; + systemd-hybrid-sleep = override; + systemd-suspend-then-hibernate = override; + }; +} + diff --git a/users/tazjin/nixos/tverskoy/default.nix b/users/tazjin/nixos/tverskoy/default.nix index 2169c5d1a..95b6a9ef1 100644 --- a/users/tazjin/nixos/tverskoy/default.nix +++ b/users/tazjin/nixos/tverskoy/default.nix @@ -22,6 +22,7 @@ lib.fix (self: { (usermod "laptop.nix") (usermod "persistence.nix") (usermod "physical.nix") + (usermod "systemd-unfreeze.nix") (pkgs.home-manager.src + "/nixos") ] ++ lib.optional (builtins.pathExists ./local-config.nix) ./local-config.nix;