Nixpkgs: GNOME keeps suspending on unstable

Created on 14 Jun 2018  ·  26Comments  ·  Source: NixOS/nixpkgs

Issue description

After upgrading from 18.03 to unstable my headless desktop tower just keeps suspending after some period of idleness. This happens irrespective of display manager (GDM) status and attempts at manual disabling via logind did not help.

Technical details

nix-shell

 - system: `"x86_64-linux"`
 - host os: `Linux 4.13.0, NixOS, 18.09pre142796.4b649a99d84 (Jellyfish)`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.0.4`
 - channels(root): `"nixos-18.09pre142796.4b649a99d84"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

configuration.nix

Also select options from configuration.nix:

powerManagement.enable = false;
services.logind.lidSwitch = "ignore";
services.logind.extraConfig = "IdleAction=ignore";

services.xservers.desktopManager.gnome3.enable = true;
services.xserver.displayManager.gdm.enable = true;

Suspend on idle is disabled for my account in GNOME settings.

Logs

июн 14 23:59:09 vorot93-tower .gsd-power-wrap[2399]: failed to turn the kbd backlight off: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnkn>
июн 15 00:15:10 vorot93-tower .gsd-power-wrap[2399]: failed to turn the kbd backlight off: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnkn>
июн 15 00:18:55 vorot93-tower .gnome-shell-wr[1956]: Screen lock is locked down, not locking
июн 15 00:18:55 vorot93-tower systemd[1]: Reached target Sleep.
июн 15 00:18:55 vorot93-tower systemd[1]: Starting Suspend...
июн 15 00:18:55 vorot93-tower systemd-sleep[21390]: Suspending system...
question blocker GNOME

Most helpful comment

I created a NixOS module that disables GDM's auto-suspension of the machine based on the code from https://github.com/NixOS/nixpkgs/issues/42053#issuecomment-425570100. Just import that module from your configuration.nix and run dconf update after the new configuration has been activated. This needs nixpkgs @ 1af8f3a980bb8ac92f5c09ac23cca4781571bcd1 or later to work.

All 26 comments

GNOME is set up to automatically suspend after 20 minutes of inactivity by default, I think it has something to do with some EU regulation. I have the following in my configuration.nix:

services.xserver.desktopManager.gnome3 = {
  enable = true;
  extraGSettingsOverridePackages = with pkgs; [ gnome3.gnome_settings_daemon ];
  extraGSettingsOverrides = ''
    [org.gnome.desktop.screensaver]
    lock-delay=3600
    lock-enabled=true'

    [org.gnome.desktop.session]
    idle-delay=900

    [org.gnome.settings-daemon.plugins.power]
    power-button-action='nothing'
    idle-dim=true
    sleep-inactive-battery-type='nothing'
    sleep-inactive-ac-timeout=3600
    sleep-inactive-ac-type='nothing'
    sleep-inactive-battery-timeout=1800
  '';
};

sleep-inactive-ac-type is the setting you are after.

@jtojnar, I copied that snippet verbatim into my configuration.nix, but it makes no difference. GDM still suspends my machine after 20 minutes if no user is logged in. :-( Is it possible that the code I have to add has changes in recent versions of nixos-unstable?

Previously, GDM would not see that because the NIX_GSETTINGS_OVERRIDES_DIR was being set as a part of xsession. Now, as a side effect of https://github.com/NixOS/nixpkgs/pull/43992, GDM should pick it up, though. (Apparently, it is not in nixos-unstable yet.)

I switched my machine to 558c032e53141f0f53536f0f2a5ac4741ba024b9, which includes #43992, but it made no difference. GDM still suspends my desktop after ~20 minutes when no-one is logged in.

Hmm, maybe GDM filters the NIXOS_GSETTINGS_OVERRIDE variable, try updating the patch that also adds GDM_SESSIONS_DIR variable. Or maybe the overrides are broken – we had some issues on Elementary desktop that I was not able to debug. We should probably work on the dconf module.

@jtojnar, I switch to the current master @ 2937e73 again, and frankly I cannot find any setting of NIXOS_GSETTINGS_OVERRIDE in the gdb service definition at all:

~~~
$ cat /etc/systemd/system/display-manager.service
[Unit]
After=rc-local.service systemd-machined.service systemd-user-sessions.service systemd-udev-settle.service local-fs.target acpid.service systemd-logind.service
Description=X11 Server
Wants=systemd-machined.service systemd-udev-settle.service

[Service]
Environment="GDM_SESSIONS_DIR=/nix/store/z70l89z5k2vggk4cm244v9gka9hi498h-desktops/share/xsessions"
Environment="GDM_X_SERVER_EXTRA_ARGS=-config /nix/store/p0kwwmghji2lnpfr9jiy8qkbda55hd5x-xserver.conf -xkbdir /nix/store/1w12kk6jjw0g9hc6gp84pvy156j7asy4-xkeyboard-config-2.24/etc/X11/xkb -logfile /dev/null -nolisten tcp"
Environment="LD_LIBRARY_PATH=/run/opengl-driver/lib"
Environment="LOCALE_ARCHIVE=/nix/store/c228yaf0lpwz2b9w5cz6jqqf7wmn6lq3-glibc-locales-2.27/lib/locale/locale-archive"
Environment="PATH=/nix/store/f4ipv4illw3wrjyifwwx72jpzg42zzh0-gnome-session-3.28.1/bin:/nix/store/bgii6n1si6za1ry0vbwnmiapzagcyrjm-coreutils-8.29/bin:/nix/store/hm91iaffdsq7gihqd75ax4wqqbk7mmzh-findutils-4.6.0/bin:/nix/store/jhchn2x6n13m58syjwfvji1brprrw005-gnugrep-3.1/bin:/nix/store/lay34qr1x11xllcs4bvfjrg4s91fprna-gnused-4.5/bin:/nix/store/3xsmi5ay8vs0gf5i782wyl453bz43g7v-systemd-238/bin:/nix/store/f4ipv4illw3wrjyifwwx72jpzg42zzh0-gnome-session-3.28.1/sbin:/nix/store/bgii6n1si6za1ry0vbwnmiapzagcyrjm-coreutils-8.29/sbin:/nix/store/hm91iaffdsq7gihqd75ax4wqqbk7mmzh-findutils-4.6.0/sbin:/nix/store/jhchn2x6n13m58syjwfvji1brprrw005-gnugrep-3.1/sbin:/nix/store/lay34qr1x11xllcs4bvfjrg4s91fprna-gnused-4.5/sbin:/nix/store/3xsmi5ay8vs0gf5i782wyl453bz43g7v-systemd-238/sbin"
Environment="TZDIR=/nix/store/1739slb02r1mb60q4648ajbdms52yvnr-tzdata-2018e/share/zoneinfo"
Environment="XCURSOR_PATH=~/.icons:/nix/store/250n8ld0k30rxjbx3w2v8pznkf9xlqas-adwaita-icon-theme-3.28.0/share/icons"

X-RestartIfChanged=false

BusName=org.gnome.DisplayManager
ExecStart=/nix/store/85xidixi6zqqy8h4h8pv2cxdpnr3vafk-unit-script-display-manager-start
ExecStartPre=/nix/store/hg64k0az3xcjsjls6kvd9skjywny8khr-unit-script-display-manager-pre-start
IgnoreSIGPIPE=no
KillMode=mixed
Restart=always
RestartSec=200ms
StandardError=inherit
StandardOutput=syslog
StartLimitBurst=3
StartLimitInterval=30s
SyslogIdentifier=display-manager
~~~

Am I missing something?

That is probably why it's not working because environment.variables affects interactive user shells who source /etc/bashrc, but systemd services never see any of those settings.

This issue needs to be fixed. master recently switched to lightdm by default, and now my desktop suspends power again when no user is logged in. This is really bad since the machine is supposed to be available 24/7.

Why would this be an issue with lightdm?

The new default display manager suspends my desktop when nobody is logged in, and I was under the impression that lightdm is the new default? Is that not correct?

Yes, lightdm is the new default DM (https://github.com/NixOS/nixpkgs/pull/30890) but this is an issue about GDM.

As I said, I have the same issue with lightdm.

Alternately, you can try

  programs.dconf.enable = true;
  programs.dconf.profiles.user = pkgs.writeText "dconf-user-profile" ''
    user-db:user
    system-db:local
  '';

  environment.etc."dconf/db/local.d/01-cros-ui".text = ''
    [org.gnome.settings-daemon.plugins.power]
    power-button-action='nothing'
    idle-dim=true
    sleep-inactive-battery-type='nothing'
    sleep-inactive-ac-timeout=3600
    sleep-inactive-ac-type='nothing'
    sleep-inactive-battery-timeout=1800
  '';

@jtojnar, I added these lines to my configuration.nix, but they made no difference. The outcome is the same: my desktop suspends after ~20 minutes when no user is logged in.

Also, I'm getting errors running dconf after these changes are applied:

~~~

dconf list /

(dconf:7808): dconf-WARNING **: 15:00:28.249: unable to open file '/etc/dconf/db/local': Failed to open file “/etc/dconf/db/local”: open() failed: No such file or directory; expect degraded performance
~~~

OK, the dconf error goes away after I run "dconf update" manually, which creates the missing file. Still, there is no effect on gdm. The machine suspends anyway (even after rebooting first and all).

OK, I've figured it out at last. The code from https://github.com/NixOS/nixpkgs/issues/42053#issuecomment-425570100 works after I applied 1af8f3a980bb8ac92f5c09ac23cca4781571bcd1 and manually ran

# dconf update

as root in the newly booted (or switched) system. I'm now trying to simplify matters further. I'll report my progress once I know more.

I created a NixOS module that disables GDM's auto-suspension of the machine based on the code from https://github.com/NixOS/nixpkgs/issues/42053#issuecomment-425570100. Just import that module from your configuration.nix and run dconf update after the new configuration has been activated. This needs nixpkgs @ 1af8f3a980bb8ac92f5c09ac23cca4781571bcd1 or later to work.

Eventually, we want to extend the dconf module to support creating databases, so that user could do something like

  programs.dconf = {
    enable = true;
    databases.local."org/gnome/settings-daemon/plugins/power" = "nothing";
  };

and it would take care of running dconf update automatically.

Here's the upstream bugtracker: https://bugzilla.gnome.org/show_bug.cgi?id=681869#c19
It indeed was to comply with EU and Californian regulation.

Setting

services.xserver.displayManager.gdm.autoSuspend = false;

should fix this until upstream sorts this out with a proper interface.

Setting

services.xserver.displayManager.gdm.autoSuspend = false;

should fix this until upstream sorts this out with a proper interface.

And for lightdm?

Setting

services.xserver.displayManager.gdm.autoSuspend = false;

should fix this until upstream sorts this out with a proper interface.

And for lightdm?

I believe lightdm and GDM will have nothing in common, so it wouldn't be this issue for lightdm.

Unfortunately belief doesn't help with my laptop going to sleep after I
leave something running... This started since I upgraded to 20.03.
I've just tried:
/run/current-system/sw/bin/xset -dpms
/run/current-system/sw/bin/xset s off

But I haven't had a chance to test it yet.

On Sat, 25 Apr 2020 at 20:47, worldofpeace notifications@github.com wrote:

Setting

services.xserver.displayManager.gdm.autoSuspend = false;

should fix this until upstream sorts this out with a proper interface.

And for lightdm?

I believe lightdm and GDM will have nothing in common, so it wouldn't be
this issue for lightdm.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/NixOS/nixpkgs/issues/42053#issuecomment-619431510,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAWJWSWYLQETUEVCX7DNPX3ROM43TANCNFSM4FFC4B4Q
.

Please open a new issue and describe the system you are using. GDM is a completely different software from lightdm and the issue with the GDM is fixed.

Setting

services.xserver.displayManager.gdm.autoSuspend = false;

should fix this until upstream sorts this out with a proper interface.

That does exactly nothing for me on current unstable. Still suspends after 20 min if not logged in.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

grahamc picture grahamc  ·  3Comments

copumpkin picture copumpkin  ·  3Comments

copumpkin picture copumpkin  ·  3Comments

tomberek picture tomberek  ·  3Comments

ghost picture ghost  ·  3Comments