unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Who is sending my Guix System to sleep?
@ 2019-09-26  7:21 Konrad Hinsen
  2019-10-11  8:15 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Konrad Hinsen @ 2019-09-26  7:21 UTC (permalink / raw)
  To: help-guix

Hi Guix,

In an attempt to make more use of Guix in my daily life on a
MacBook, I have set up a virtual machine (using VirtualBox)
that contains a desktop installation of Guix. I have then set
up ssh with X11 forwarding, and thus run software such as Emacs
from my macOS terminal. Since I don't need the virtual machine's
display, I usually run the machine in headless mode.

The only problem is that after 20 minutes, the virtual machine
seems to freeze. I found the cause in /var/log/messages:

    Sep 26 08:54:40 localhost NetworkManager[282]: <info>  [1569480880.2246] manager: sleep: sleep requested (sleeping: no  enabled: yes)
    Sep 26 08:54:40 localhost NetworkManager[282]: <info>  [1569480880.2247] manager: NetworkManager state is now ASLEEP
    Sep 26 08:54:40 localhost NetworkManager[282]: <info>  [1569480880.2248] device (enp0s3): state change: activated -> deactivating (reason 'sleeping', sys-iface-state: 'managed')
    Sep 26 08:54:40 localhost NetworkManager[282]: <info>
    [1569480880.2293] device (enp0s3): state change: deactivating ->
    disconnected (reason 'sleeping', sys-iface-state: 'managed')

Something requests NetworkManager to go to sleep, which is obviously not
good for my ssh connection. But what?

First I went to the XFCE settings and switched off all automatic suspend
and hibernate actions. No success. Then I replaced %desktop-services in
my config.scm by %base-services plus the explicit list of what
%desktop-services adds to it. And then I removed suspect and/or unneeded
services one by one. Now I have nothing left that I can remove without
losing some functionality or getting en error message at "guix system
reconfigure". But my system still goes to sleep after 20 minutes.

These are the services I still have, in addition to %base-services:

      (list (service xfce-desktop-service-type)
            (service openssh-service-type
		     (openssh-configuration
		      (x11-forwarding? #t)))
            (set-xorg-configuration
              (xorg-configuration
               (keyboard-layout keyboard-layout)))

            (service gdm-service-type)
            (service network-manager-service-type)
            (service wpa-supplicant-service-type)
            (service avahi-service-type)
            (accountsservice-service)
            (elogind-service)
            (dbus-service)

            (service ntp-service-type)

            x11-socket-directory-service)

Does anyone have an idea what could cause the automatic sleep?

BTW, I also tried using a basic non-desktop system, but then I cannot
run X11 applications for whatever reason.

Thanks in advance,
  Konrad

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Who is sending my Guix System to sleep?
  2019-09-26  7:21 Who is sending my Guix System to sleep? Konrad Hinsen
@ 2019-10-11  8:15 ` Ludovic Courtès
  2019-10-22 19:16   ` Jack Hill
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2019-10-11  8:15 UTC (permalink / raw)
  To: Konrad Hinsen; +Cc: help-guix

Hello!

Konrad Hinsen <konrad.hinsen@fastmail.net> skribis:

> The only problem is that after 20 minutes, the virtual machine
> seems to freeze. I found the cause in /var/log/messages:
>
>     Sep 26 08:54:40 localhost NetworkManager[282]: <info>  [1569480880.2246] manager: sleep: sleep requested (sleeping: no  enabled: yes)
>     Sep 26 08:54:40 localhost NetworkManager[282]: <info>  [1569480880.2247] manager: NetworkManager state is now ASLEEP
>     Sep 26 08:54:40 localhost NetworkManager[282]: <info>  [1569480880.2248] device (enp0s3): state change: activated -> deactivating (reason 'sleeping', sys-iface-state: 'managed')
>     Sep 26 08:54:40 localhost NetworkManager[282]: <info>
>     [1569480880.2293] device (enp0s3): state change: deactivating ->
>     disconnected (reason 'sleeping', sys-iface-state: 'managed')
>
> Something requests NetworkManager to go to sleep, which is obviously not
> good for my ssh connection. But what?

I think elogind is the thing you’d want to configure to turn off
automatic standby when the machine is idle, presumably by changing the
‘idle-action’ field of <elogind-configuration>?

logind.conf(5) is not entirely clear, though:

--8<---------------cut here---------------start------------->8---
IdleAction=
    Configures the action to take when the system is idle. Takes one of "ignore",
    "poweroff", "reboot", "halt", "kexec", "suspend", "hibernate", "hybrid-sleep",
    "suspend-then-hibernate", and "lock". Defaults to "ignore".

    Note that this requires that user sessions correctly report the idle status to the
    system. The system will execute the action after all sessions report that they are
    idle, no idle inhibitor lock is active, and subsequently, the time configured with
    IdleActionSec= (see below) has expired.
--8<---------------cut here---------------end--------------->8---

HTH!

Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Who is sending my Guix System to sleep?
  2019-10-11  8:15 ` Ludovic Courtès
@ 2019-10-22 19:16   ` Jack Hill
  2019-10-22 20:00     ` Jack Hill
  0 siblings, 1 reply; 4+ messages in thread
From: Jack Hill @ 2019-10-22 19:16 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: help-guix

On Fri, 11 Oct 2019, Ludovic Courtès wrote:

> Konrad Hinsen <konrad.hinsen@fastmail.net> skribis:
>
>> The only problem is that after 20 minutes, the virtual machine
>> seems to freeze.

I've experienced unwanted suspends as well on a desktop system when not 
logged in graphically.

>> I found the cause in /var/log/messages:
>>
>>     Sep 26 08:54:40 localhost NetworkManager[282]: <info>  [1569480880.2246] manager: sleep: sleep requested (sleeping: no  enabled: yes)
>>     Sep 26 08:54:40 localhost NetworkManager[282]: <info>  [1569480880.2247] manager: NetworkManager state is now ASLEEP
>>     Sep 26 08:54:40 localhost NetworkManager[282]: <info>  [1569480880.2248] device (enp0s3): state change: activated -> deactivating (reason 'sleeping', sys-iface-state: 'managed')
>>     Sep 26 08:54:40 localhost NetworkManager[282]: <info>
>>     [1569480880.2293] device (enp0s3): state change: deactivating ->
>>     disconnected (reason 'sleeping', sys-iface-state: 'managed')
>>
>> Something requests NetworkManager to go to sleep, which is obviously not
>> good for my ssh connection. But what?

I believe that NetworkManager is more of a symptom than a cause, and it is 
not really related to networking, but NetworkManager happens to be the 
most helpful thing by printing the error messages.

> I think elogind is the thing you’d want to configure to turn off
> automatic standby when the machine is idle, presumably by changing the
> ‘idle-action’ field of <elogind-configuration>?
>
> logind.conf(5) is not entirely clear, though:

Also, it looks like we're already setting idle-action to ignore by 
default[0], so I was skeptical that this is what was triggering the 
suspend.

[0] https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/services/desktop.scm?id=cdc81ccedb332fb297f6100ccd99eaf13d161ada#n618

My particular symptoms are that when I log into a graphical GNOME session 
from gdm, the machine does not suspend unexpectedly, and follows the 
settings that I have configured in GNOME Settings. However, if I'm not 
logged in, and the computer is waiting at the gdm greater, the unwanted 
suspension happens.

I believe what is happening is when a user is logged in, their settings 
are in force, but when no user is logged in, it is the gdm user's settings 
that are effective.

After some searching online [1][2][3], it appears that the following dconf 
settings are the important ones:

/org/gnome/settings-daemon/plugins/power/sleep-inactive-ac-type
/org/gnome/settings-daemon/plugins/power/sleep-inactive-ac-timeout

[1] https://unix.stackexchange.com/questions/361214/disable-gdm-suspend-on-lock-screen
[2] https://bbs.archlinux.org/viewtopic.php?id=132376
[3] https://wiki.archlinux.org/index.php/GNOME#Login_screen

I changed sleep-inactive-ac-type imperatively by becoming the gdm user 
and then running dconf command as follows

```
# su - gdm -s /run/current-system/profile/bin/sh
-sh-5.0$ export $(dbus-launch)
-sh-5.0$ dconf write /org/gnome/settings-daemon/plugins/power/sleep-inactive-ac-type "'blank'"
```

Note the double quoting around blank. This is important when running at 
the shell because the single quotes are part of the value so that its type 
can determined.

After running the dconf command a /var/lib/gdm/.config/dconf/user file is 
created to hold this setting, and (at least after restarting the host, I 
don't know if this is necessary, but it's what I did) the computer no 
longer suspends while waiting for a user to login.

It would be great to be able to handle dconf settings in the gdm-service. 
It would be even greater to have general dconf settings mechanisms to 
handle settings stored in that database for any service that uses it. I 
could see this being useful to guix home as well as any work to clean up 
stateful system directories [4]. Perhaps the dconf settings mechanisms 
could even look at schemas to aid in generating code and only provide the 
user with ways to write correct configuration.

[4] https://lists.gnu.org/archive/html/guix-devel/2019-10/msg00421.html

Best,
Jack

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Who is sending my Guix System to sleep?
  2019-10-22 19:16   ` Jack Hill
@ 2019-10-22 20:00     ` Jack Hill
  0 siblings, 0 replies; 4+ messages in thread
From: Jack Hill @ 2019-10-22 20:00 UTC (permalink / raw)
  To: help-guix

I also found a related Debian bug for gdm settings: 
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=896083

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-22 20:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-26  7:21 Who is sending my Guix System to sleep? Konrad Hinsen
2019-10-11  8:15 ` Ludovic Courtès
2019-10-22 19:16   ` Jack Hill
2019-10-22 20:00     ` Jack Hill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).