What is suspending my Fedora Sway laptop on idle?

Hi,

I have a laptop with Fedora 43 Sway spin. When I do not use the laptop for about 10 minutes, it suspends (checked in kernel logs and by trying to reach the system on the network).

I would like to change this timeout, but cannot figure out where it is configured / what program is responsible for triggering suspend.

It’s not logind itself:

nikratio@nlp ~> loginctl 
SESSION  UID USER     SEAT  LEADER CLASS   TTY  IDLE SINCE
      2 1000 nikratio seat0 2513   user    tty2 no   -    
      3 1000 nikratio -     2522   manager -    no   -    

2 sessions listed.
nikratio@nlp ~> loginctl show-session 2  -p IdleHint -p IdleHintMonotonicTimestamp -p IdleAction 
IdleHint=no
nikratio@nlp ~> loginctl show-session 3  -p IdleHint -p IdleHintMonotonicTimestamp -p IdleAction
IdleHint=no

nikratio@nlp ~> busctl get-property org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager IdleAction
s "ignore"
nikratio@nlp ~> busctl get-property org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager IdleActionUSec
t 1800000000

It’s also not swayidle:

> ps aux | grep swayidle
nikratio    2706  0.0  0.0   5452  2616 ?        Ss   Apr27   0:00 swayidle -w timeout 300 swaylock -f -c 000000 timeout 900 swaymsg "output * dpms off" resume swaymsg "output * dpms on" before-sleep swaylock -f -c 000000
nikratio  128488  0.0  0.0 231268  1792 pts/0    S+   08:56   0:00 grep --color=auto swayidle

As far as I can tell, it’s also not upower (which only acts on low batterie, and the system is plugged in).

systemd-logind logs do not reveal anything, even in debug mode:

Apr 27 14:50:28 nlp systemd-logind[1564]: External (1) displays connected.
Apr 27 14:50:28 nlp systemd-logind[1564]: Handling of handle-lid-switch (level) is disabled, taking no action.
Apr 27 15:00:28 nlp systemd-logind[1564]: Sleep state 'freeze' is supported by kernel.
Apr 27 15:00:28 nlp systemd-logind[1564]: No sleep mode configured, using kernel default for /sys/power/mem_sleep.
Apr 27 15:00:28 nlp systemd-logind[1564]: Suspending...
Apr 27 15:00:28 nlp systemd-logind[1564]: Sent message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1/unit/suspend_2etarget interface=org.freedesktop.DBus.Properties member=Get cookie=352 reply_cookie=0 signature=ss error-name=n/a error-message=n/a
Apr 27 15:00:28 nlp systemd-logind[1564]: Got message type=method_return sender=:1.2 destination=:1.12 path=n/a interface=n/a member=n/a  cookie=2112 reply_cookie=352 signature=v error-name=n/a error-message=n/a
Apr 27 15:00:28 nlp systemd-logind[1564]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/login1 interface=org.freedesktop.login1.Manager member=PrepareForSleep cookie=353 reply_cookie=0 signature=b error-name=n/a error-message=n/a

I also don’t see any dbus messages (captured while suspend happened):

> sudo dbus-monitor --system "interface='org.freedesktop.login1.Manager',member='Suspend'"
signal time=1777288065.657166 sender=org.freedesktop.DBus -> destination=:1.4710 serial=4294967295
path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
   string ":1.4710"
signal time=1777288065.657182 sender=org.freedesktop.DBus -> destination=:1.4710 serial=4294967295
path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
   string ":1.4710"

No other power-related daemons are running (and even if they were, I think I should see them communicate with logind through dbus?):slight_smile:

nikratio@nlp ~> ps aux | grep -iE 'power|gsd'
root         157  0.0  0.0      0     0 ?        I    Apr27   0:00 [kworker/0:2-events_power_efficient]
root        1581  0.0  0.0 543468  9520 ?        Ssl  Apr27   0:01 /usr/libexec/upowerd
nikratio  135020  0.0  0.0 231268  1756 pts/2    S+   09:18   0:00 grep --color=auto -iE power|gsd

Anyone able to help? What’s responsible for suspending my system on idle, and how do I configure this?

Maybe systemd. See man 5 sleep.conf.d.

On other desktops there are power setting controls in the desktop’s setting app.

Does sway have a setting app that allows power setting config?

As @gnwiii says it will be likely be systemd that the app configures under the hood.

I have asked the maintainers of the Sway Spin for you, add they say it uses tuned as the power profile manager, so look up tuned and see if there is a setting you can change.

I have asked the maintainers of the Sway Spin for you, add they say it uses tuned as the power profile manager, so look up tuned and see if there is a setting you can change.

Thanks Mat! I don’t think “tuned” exists on my system though:

nikratio@nlp ~> ps ax | grep tuned
 143854 pts/2    S+     0:00 grep --color=auto tuned

nikratio@nlp ~> which tuned
which: no tuned in (/home/nikratio/.cargo/bin:/home/nikratio/bin:/home/nikratio/.local/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin)

nikratio@nlp ~ [1]> man tuned
No manual entry for tuned

nikratio@nlp ~> apropos tune
adjtimex (2)         - tune kernel clock
bdflush (2)          - start, flush, or tune buffer-dirty-flush daemon
btrfstune (8)        - tune various filesystem parameters
clock_adjtime (2)    - tune kernel clock
Image::ExifTool::ITC (3pm) - Read iTunes Cover Flow meta information
nilfs-tune (8)       - adjust tunable file system parameters on NILFS file system
ntp_adjtime (3)      - tune kernel clock
plipconfig (8)       - fine tune PLIP device parameters
tune.exfat (8)       - adjust tunable filesystem parameters on an exFAT filesystem
tune2fs (8)          - adjust tunable file system parameters on ext2/ext3/ext4 file systems
tunegfs2 (8)         - View and manipulate gfs2 superblocks

Maybe systemd. See man 5 sleep.conf.d.

As far as I can tell, sleep.conf.d configures how the system suspends, not when.

Another way to check

dnf list installed tuned

I’m on F44 Sway, but not the Spin. I have tlp installed, by default, as a power manager.

Yeah, neither is installed here. (I’d also expect them to send dbus requests to logind, if they were triggering suspend).

Funnily enough, the “mechanism” that is responsible for suspending the laptop turned out to be a systemd bug (logind suspends laptop on DPMS-off when lid is closed · Issue #41898 · systemd/systemd · GitHub). In short, whenever swayidle turns the external display off, systemd-logind incorrectly believes that the laptop has been undocked and the lid closed, and suspends the system.

1 Like