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 <tazjin@tvl.su>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2025-01-07 01:33:40 +03:00 committed by tazjin
parent 5c9e671c1f
commit b9e0a682ab
3 changed files with 17 additions and 0 deletions

View file

@ -22,6 +22,7 @@ in
(usermod "home-config.nix") (usermod "home-config.nix")
(usermod "laptop.nix") (usermod "laptop.nix")
(usermod "physical.nix") (usermod "physical.nix")
(usermod "systemd-unfreeze.nix")
(pkgs.home-manager.src + "/nixos") (pkgs.home-manager.src + "/nixos")
] ++ (if (builtins.pathExists private) then [ ] ++ (if (builtins.pathExists private) then [
(private + "/nixos/yandex.nix") (private + "/nixos/yandex.nix")

View file

@ -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;
};
}

View file

@ -22,6 +22,7 @@ lib.fix (self: {
(usermod "laptop.nix") (usermod "laptop.nix")
(usermod "persistence.nix") (usermod "persistence.nix")
(usermod "physical.nix") (usermod "physical.nix")
(usermod "systemd-unfreeze.nix")
(pkgs.home-manager.src + "/nixos") (pkgs.home-manager.src + "/nixos")
] ++ lib.optional (builtins.pathExists ./local-config.nix) ./local-config.nix; ] ++ lib.optional (builtins.pathExists ./local-config.nix) ./local-config.nix;