Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GNOME keeps suspending on unstable #42053

Closed
vorot93 opened this issue Jun 14, 2018 · 27 comments
Closed

GNOME keeps suspending on unstable #42053

vorot93 opened this issue Jun 14, 2018 · 27 comments
Labels
0.kind: question Requests for a specific question to be answered 1.severity: blocker This is preventing another PR or issue from being completed 6.topic: GNOME GNOME desktop environment and its underlying platform
Milestone

Comments

@vorot93
Copy link
Contributor

vorot93 commented Jun 14, 2018

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...
@jtojnar
Copy link
Member

jtojnar commented Jun 15, 2018

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 jtojnar added 0.kind: question Requests for a specific question to be answered 6.topic: GNOME GNOME desktop environment and its underlying platform labels Jun 15, 2018
@peti
Copy link
Member

peti commented Aug 5, 2018

@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?

@jtojnar
Copy link
Member

jtojnar commented Aug 5, 2018

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 #43992, GDM should pick it up, though. (Apparently, it is not in nixos-unstable yet.)

@peti
Copy link
Member

peti commented Aug 6, 2018

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

@jtojnar
Copy link
Member

jtojnar commented Aug 10, 2018

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.

@peti
Copy link
Member

peti commented Aug 15, 2018

@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?

@jtojnar
Copy link
Member

jtojnar commented Aug 15, 2018

It is defined here, not in the service:

environment.variables.NIX_GSETTINGS_OVERRIDES_DIR = "${nixos-gsettings-desktop-schemas}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas";

@peti
Copy link
Member

peti commented Aug 15, 2018

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.

@peti peti added the 1.severity: blocker This is preventing another PR or issue from being completed label Sep 20, 2018
@peti peti added this to the 18.09 milestone Sep 20, 2018
@peti
Copy link
Member

peti commented Sep 20, 2018

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.

@jtojnar
Copy link
Member

jtojnar commented Sep 21, 2018

Why would this be an issue with lightdm?

@peti
Copy link
Member

peti commented Sep 21, 2018

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?

@jtojnar
Copy link
Member

jtojnar commented Sep 21, 2018

Yes, lightdm is the new default DM (#30890) but this is an issue about GDM.

@peti
Copy link
Member

peti commented Sep 21, 2018

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

@jtojnar
Copy link
Member

jtojnar commented Sep 28, 2018

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
  '';

@peti
Copy link
Member

peti commented Oct 1, 2018

@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

@peti
Copy link
Member

peti commented Oct 1, 2018

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).

peti added a commit that referenced this issue Oct 2, 2018
This is necessary when system-wide dconf settings must be configured, i.e. to
disable GDM's auto-suspending of the machine when no user is logged in.

Related to #42053.
@peti
Copy link
Member

peti commented Oct 2, 2018

OK, I've figured it out at last. The code from #42053 (comment) works after I applied 1af8f3a 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.

@peti
Copy link
Member

peti commented Oct 2, 2018

I created a NixOS module that disables GDM's auto-suspension of the machine based on the code from #42053 (comment). Just import that module from your configuration.nix and run dconf update after the new configuration has been activated. This needs nixpkgs @ 1af8f3a or later to work.

@jtojnar
Copy link
Member

jtojnar commented Oct 3, 2018

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.

@matthewbauer matthewbauer removed this from the 18.09 milestone Jan 22, 2019
wizeman pushed a commit to wizeman/nixpkgs that referenced this issue Jan 24, 2019
This is necessary when system-wide dconf settings must be configured, i.e. to
disable GDM's auto-suspending of the machine when no user is logged in.

Related to NixOS#42053.
wizeman pushed a commit to wizeman/nixpkgs that referenced this issue Jan 24, 2019
This is necessary when system-wide dconf settings must be configured, i.e. to
disable GDM's auto-suspending of the machine when no user is logged in.

Related to NixOS#42053.
wizeman pushed a commit to wizeman/nixpkgs that referenced this issue Jan 24, 2019
This is necessary when system-wide dconf settings must be configured, i.e. to
disable GDM's auto-suspending of the machine when no user is logged in.

Related to NixOS#42053.
wizeman pushed a commit to wizeman/nixpkgs that referenced this issue Jan 24, 2019
This is necessary when system-wide dconf settings must be configured, i.e. to
disable GDM's auto-suspending of the machine when no user is logged in.

Related to NixOS#42053.
wizeman pushed a commit to wizeman/nixpkgs that referenced this issue Jan 24, 2019
This is necessary when system-wide dconf settings must be configured, i.e. to
disable GDM's auto-suspending of the machine when no user is logged in.

Related to NixOS#42053.
wizeman pushed a commit to wizeman/nixpkgs that referenced this issue Jan 24, 2019
This is necessary when system-wide dconf settings must be configured, i.e. to
disable GDM's auto-suspending of the machine when no user is logged in.

Related to NixOS#42053.
@JohnAZoidberg
Copy link
Member

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.

@FRidh FRidh added this to the 19.09 milestone Jul 20, 2019
@worldofpeace
Copy link
Contributor

Setting

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

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

@husnoo
Copy link

husnoo commented Apr 25, 2020

Setting

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

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

And for lightdm?

@worldofpeace
Copy link
Contributor

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.

@husnoo
Copy link

husnoo commented Apr 25, 2020 via email

@jtojnar jtojnar changed the title Desktop keeps suspending on unstable GNOME keeps suspending on unstable Apr 25, 2020
@jtojnar
Copy link
Member

jtojnar commented Apr 25, 2020

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.

@con-f-use
Copy link
Contributor

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.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/need-help-for-nixos-gnome-scaling-settings/24590/5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: question Requests for a specific question to be answered 1.severity: blocker This is preventing another PR or issue from being completed 6.topic: GNOME GNOME desktop environment and its underlying platform
Projects
None yet
Development

No branches or pull requests

10 participants