Hardware/Framework/Laptop 16: Difference between revisions
m Use non-flake version of nix shell |
Mention systemd bug resulting in idle-suspend loop |
||
| Line 41: | Line 41: | ||
[[Linux kernel|Using the latest kernel]] will fix some issues. Also read configuration hints in this article. | [[Linux kernel|Using the latest kernel]] will fix some issues. Also read configuration hints in this article. | ||
=== Double suspend after GNOME automatic/idle suspend (systemd v258 regression) === | |||
Some users have reported a "double suspend" / "suspend loop" on Framework Laptop 16 (notably with GNOME and the NVIDIA dGPU module): after the machine suspends due to *automatic idle suspend* and is resumed, it may suspend again ~20-30 seconds later (sometimes repeating multiple times). Manual suspend and lid-close suspend may still behave normally. | |||
Upstream tracking: | |||
* https://github.com/systemd/systemd/issues/40078 | |||
* https://github.com/systemd/systemd/issues/39259 | |||
==== Workaround 1: add a post-resume sleep inhibitor ==== | |||
Add this snippet to configuration.nix: | |||
<syntaxhighlight lang="nix"> | |||
systemd.services.inhibit-sleep-after-resume = { | |||
description = "Temporary sleep inhibitor after resume (workaround for double-suspend)"; | |||
wantedBy = [ "post-resume.target" ]; | |||
after = [ "post-resume.target" ]; | |||
serviceConfig.Type = "oneshot"; | |||
script = '' | |||
${pkgs.systemd}/bin/systemd-inhibit \ | |||
--mode=block \ | |||
--what=sleep:idle \ | |||
--why="Workaround: avoid immediate second suspend after resume" \ | |||
${pkgs.coreutils}/bin/sleep 60 | |||
''; | |||
}; | |||
</syntaxhighlight> | |||
==== Workaround 2: disable GNOME idle-suspend (low risk; lid-close suspend still works) ==== | |||
===== Quick (imperative) test ===== | |||
Disable idle suspend on AC power: | |||
<syntaxhighlight lang="sh"> | |||
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing' | |||
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0 | |||
</syntaxhighlight> | |||
Optionally also disable it on battery: | |||
<syntaxhighlight lang="sh"> | |||
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'nothing' | |||
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 0 | |||
</syntaxhighlight> | |||
===== Declarative configuration (recommended) ===== | |||
<syntaxhighlight lang="nix"> | |||
{ lib, ... }: | |||
{ | |||
# Declaratively set GNOME dconf defaults. | |||
programs.dconf.enable = true; | |||
programs.dconf.profiles.user.databases = [ | |||
{ | |||
settings = { | |||
"org/gnome/settings-daemon/plugins/power" = { | |||
# Disable idle-suspend on AC power (keeps lid-close suspend behavior): | |||
sleep-inactive-ac-type = "nothing"; | |||
sleep-inactive-ac-timeout = lib.gvariant.mkUint32 0; | |||
# Optional: also disable idle-suspend on battery: | |||
# sleep-inactive-battery-type = "nothing"; | |||
# sleep-inactive-battery-timeout = lib.gvariant.mkUint32 0; | |||
}; | |||
}; | |||
} | |||
]; | |||
} | |||
</syntaxhighlight> | |||
After applying, log out and log back in (or reboot) to ensure GNOME picks up the updated settings. | |||
==== Workaround 3: pin nixpkgs to pre-systemd-v258 for the affected machine (higher impact) ==== | |||
If you prefer to keep GNOME idle-suspend enabled, another workaround is to pin the affected system to a nixpkgs revision before systemd v258 landed. | |||
* Commit that introduced systemd v258: https://github.com/NixOS/nixpkgs/commit/70ca21d3c4982d7f95e48688d02cd9ef6b1347f5 | |||
* Latest pre-v258 commit (pre-merge parent): https://github.com/NixOS/nixpkgs/commit/d3736636ac39ed678e557977b65d620ca75142d0. | |||
== Configuration == | == Configuration == | ||