How to figure out what is keeping the screen awake?

I have a PC that’s running 24/7 that I want to turn the screen off during the night. Fresh after a boot, it behaves as I expect it to, but after some use, the PC won’t activate the screensaver or turn the screens off after any period of time. I found a command that apparently lists programs that are able to inhibit sleep or display, but not what is keeping the display on right now
the command was systemd-inhibit --list.
Is there a way to

  1. Figure out what is causing the screen to stay awake at a given instant and
  2. Make it stop?

I did have several paused youtube videos in librewolf, but if that is keeping the screen awake, then that’s something I’d like to change.

This is one of several gatekeeper problems for adopting linux (Garuda) as a daily driver for me.

In summary
For Windows, there’s the powercfg /requests command. Is there something in Linux/Garuda that replicates this?

Not posting the garuda-inxi, as that is irrelevant on a meta level.

What is a meta level? My English is poor.

Since you know what is relevant and what not, to troubleshoot your issue, post all relevant system info and logs, so we can assist you with troubleshooting.

2 Likes

meta, as in - I do not want someone to post a solution to my specific problem of my PC not going to sleep (there may be many causes for this, but that is a separate question), but I want a way to figure out whether/which program is keeping my PC from turning off the display.
I want a tool to figure out what’s wrong, not a specific solution that probably won’t apply to anyone else to a specific problem that nobody else will likely have.

Does the state of my system affect whether there is an equivalent for windows’ powercfg /requests in Garuda or Linux?

…I’ll just post it anyway, to negate further questions about it. It really shouldn’t matter.
EDIT: Wrong PC, please ignore

System:
Kernel: 6.10.9-zen1-2-zen arch: x86_64 bits: 64 compiler: gcc v: 14.2.1
clocksource: tsc avail: acpi_pm
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
root=UUID=6ae04bd2-8f8a-48cf-91ca-fcd356578251 rw rootflags=subvol=@
resume=UUID=819a7180-b343-4466-94af-6072f3c2b416 loglevel=3 pci=nocrs
ibt=off
Desktop: KDE Plasma v: 6.1.5 tk: Qt v: N/A info: frameworks v: 6.6.0
wm: kwin_wayland with: krunner vt: 1 dm: SDDM Distro: Garuda
base: Arch Linux
Machine:
Type: Laptop System: LENOVO product: 20CD00E2MH v: ThinkPad S1 Yoga
serial: <superuser required> Chassis: type: 10 serial: <superuser required>
Mobo: LENOVO model: 20CD00E2MH v: SDK0E50512 Std
serial: <superuser required> part-nu: LENOVO_MT_20CD_BU_Think_FM_ThinkPad
S1 Yoga uuid: <superuser required> UEFI: LENOVO v: GQET63WW (1.43 )
date: 03/24/2020
Battery:
ID-1: BAT0 charge: 20.7 Wh (96.3%) condition: 21.5/47.1 Wh (45.8%)
volts: 15.7 min: 14.8 model: SMP 45N1707 type: Li-poly serial: <filter>
status: not charging
CPU:
Info: model: Intel Core i5-4210U bits: 64 type: MT MCP arch: Haswell
gen: core 4 level: v3 note: check built: 2013-15 process: Intel 22nm
family: 6 model-id: 0x45 (69) stepping: 1 microcode: 0x26
Topology: cpus: 1x dies: 1 clusters: 2 cores: 2 threads: 4 tpc: 2
smt: enabled cache: L1: 128 KiB desc: d-2x32 KiB; i-2x32 KiB L2: 512 KiB
desc: 2x256 KiB L3: 3 MiB desc: 1x3 MiB
Speed (MHz): avg: 798 min/max: 800/2700 scaling: driver: intel_cpufreq
governor: schedutil cores: 1: 798 2: 798 3: 798 4: 798 bogomips: 19155
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Vulnerabilities: <filter>
Graphics:
Device-1: Intel Haswell-ULT Integrated Graphics vendor: Lenovo driver: i915
v: kernel arch: Gen-7.5 process: Intel 22nm built: 2013 ports: active: eDP-1
empty: DP-1,HDMI-A-1,HDMI-A-2 bus-ID: 00:02.0 chip-ID: 8086:0a16
class-ID: 0300
Device-2: Chicony Integrated Camera driver: uvcvideo type: USB rev: 2.0
speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 2-6:4 chip-ID: 04f2:b39f
class-ID: 0e02
Display: wayland server: X.org v: 1.21.1.13 with: Xwayland v: 24.1.2
compositor: kwin_wayland driver: X: loaded: modesetting
alternate: fbdev,intel,vesa dri: crocus gpu: i915 display-ID: 0
Monitor-1: eDP-1 res: 1920x1080 size: N/A modes: N/A
API: EGL v: 1.5 hw: drv: intel crocus platforms: device: 0 drv: crocus
device: 1 drv: swrast gbm: drv: crocus surfaceless: drv: crocus wayland:
drv: crocus x11: drv: crocus
API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel mesa v: 24.2.3-arch1.1
glx-v: 1.4 direct-render: yes renderer: Mesa Intel HD Graphics 4400 (HSW
GT2) device-ID: 8086:0a16 memory: 1.46 GiB unified: yes display-ID: :1.0
API: Vulkan v: 1.3.295 layers: 7 device: 0 type: integrated-gpu name: Intel
HD Graphics 4400 (HSW GT2) driver: mesa intel v: 24.2.3-arch1.1
device-ID: 8086:0a16 surfaces: xcb,xlib,wayland device: 1 type: cpu
name: llvmpipe (LLVM 18.1.8 256 bits) driver: mesa llvmpipe
v: 24.2.3-arch1.1 (LLVM 18.1.8) device-ID: 10005:0000
surfaces: xcb,xlib,wayland
Audio:
Device-1: Intel Haswell-ULT HD Audio vendor: Lenovo driver: snd_hda_intel
v: kernel bus-ID: 00:03.0 chip-ID: 8086:0a0c class-ID: 0403
Device-2: Intel 8 Series HD Audio vendor: Lenovo driver: snd_hda_intel
v: kernel bus-ID: 00:1b.0 chip-ID: 8086:9c20 class-ID: 0403
API: ALSA v: k6.10.9-zen1-2-zen status: kernel-api tools: N/A
Server-1: PipeWire v: 1.2.4 status: active with: 1: pipewire-pulse
status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
Device-1: Intel Wireless 7260 driver: iwlwifi v: kernel pcie: gen: 1
speed: 2.5 GT/s lanes: 1 bus-ID: 04:00.0 chip-ID: 8086:08b2 class-ID: 0280
IF: wlp4s0 state: up mac: <filter>
Info: services: NetworkManager, smbd, systemd-timesyncd, wpa_supplicant
Bluetooth:
Device-1: Intel Bluetooth wireless interface driver: btusb v: 0.8 type: USB
rev: 2.0 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 2-4:2 chip-ID: 8087:07dc
class-ID: e001
Report: btmgmt ID: hci0 rfk-id: 7 state: up address: <filter> bt-v: 4.0
lmp-v: 6 status: discoverable: no pairing: no class-ID: 6c010c
Drives:
Local Storage: total: 931.51 GiB used: 62.96 GiB (6.8%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/sda maj-min: 8:0 vendor: Samsung model: SSD 860 EVO 1TB
size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
tech: SSD serial: <filter> fw-rev: 2B6Q scheme: GPT
Partition:
ID-1: / raw-size: 40.32 GiB size: 40.32 GiB (100.00%)
used: 28.02 GiB (69.5%) fs: btrfs dev: /dev/sda8 maj-min: 8:8
ID-2: /boot/efi raw-size: 1024 MiB size: 1022 MiB (99.80%)
used: 584 KiB (0.1%) fs: vfat dev: /dev/sda7 maj-min: 8:7
ID-3: /home raw-size: 412.41 GiB size: 412.41 GiB (100.00%)
used: 34.94 GiB (8.5%) fs: btrfs dev: /dev/sda9 maj-min: 8:9
ID-4: /var/log raw-size: 40.32 GiB size: 40.32 GiB (100.00%)
used: 28.02 GiB (69.5%) fs: btrfs dev: /dev/sda8 maj-min: 8:8
ID-5: /var/tmp raw-size: 40.32 GiB size: 40.32 GiB (100.00%)
used: 28.02 GiB (69.5%) fs: btrfs dev: /dev/sda8 maj-min: 8:8
Swap:
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
ID-1: swap-1 type: zram size: 7.67 GiB used: 4.58 GiB (59.7%)
priority: 100 comp: zstd avail: lzo,lzo-rle,lz4,lz4hc,842 max-streams: 4
dev: /dev/zram0
ID-2: swap-2 type: partition size: 8.06 GiB used: 0 KiB (0.0%)
priority: -2 dev: /dev/sda6 maj-min: 8:6
Sensors:
System Temperatures: cpu: 56.0 C mobo: N/A
Fan Speeds (rpm): cpu: 0 fan-2: 0
Info:
Memory: total: 8 GiB available: 7.67 GiB used: 4.75 GiB (62.0%)
Processes: 311 Power: uptime: 6d 23h 53m states: freeze,standby,mem,disk
suspend: deep avail: s2idle,shallow wakeups: 1 hibernate: platform
avail: shutdown, reboot, suspend, test_resume image: 3.05 GiB
services: org_kde_powerdevil, power-profiles-daemon, upowerd Init: systemd
v: 256 default: graphical tool: systemctl
Packages: pm: pacman pkgs: 1815 libs: 529 tools: octopi,pamac,paru
Compilers: clang: 18.1.8 gcc: 14.2.1 Shell: garuda-inxi default: fish
v: 3.7.1 running-in: konsole inxi: 3.3.36
Garuda (2.6.26-1):
System install date:     2024-07-08
Last full system update: 2024-09-25 ↻
Is partially upgraded:   No
Relevant software:       snapper NetworkManager dracut
Windows dual boot:       Probably (Run as root to verify)
Failed units:

There is no such task-specific utility, to my knowledge.
FWIW, in Linux, things are not the same as WinOS. There are several ways of inhibiting the system (to sleep, hibernate, shutdown, etc.) and the display monitors. By experience, video players, and browser-embedded videos (YT, vimeo, etc.) may trigger such inhibition mechanisms (traps). Either system-level (systemd, Xorg server, etc.), or application-level (xscreensaver, etc.) may use their respective programming languages features/capabilities, or DBUS to watch and block from sleep, or engage some screensaver method.

For troubleshooting/investigating the issue, we scan/investigate the journal ( usingjournalctl command ) or other logging features, depending on the Display Environment (KDE, Gnome etc.) and other system utilities and applications currently running (graphical, or daemons/systemd.units).

For example, I would set some short time limit (1-2 sec) for sleep mode, let it be blocked, and investigate journal for relevant messages (usually, there are some).

2 Likes

Alright, I will try to test this in the coming days… pretty hacky, but I hope it will yield some useful information.

This is the simplest and most usual method for troubleshooting issues in Linux. Hacky is on another meta level :joy: .

As a follow-up, systemd-inhibit is about potentially destructive activities, like preventing system from sleep (not a display monitor), in case a previously started time-consuming activity is forced to stop and it might damage the system integrity, like file system operations (copy/move data, etc.) or others.
The responsible system component for monitor sleep (for screen saving, or battery saving) is the display server, which, in x11/Xorg is the Xorg server, while on wayland is the compositor/window manager (kwin_wayland, mutter, etc.).

Good luck! :wink:

2 Likes

On plasma there is the Power & Battery in the system tray. You may have to R-click on the system tray down arrow an click configure to enable it so it shows up.

image

4 Likes

https://wiki.archlinux.org/title/Lenovo_ThinkPad_Yoga_S1#Power_management

After installing iio-sensor-proxy the device is immediately waking after suspending. The soloution is to disable XHC in wake events

# echo XHC > /proc/acpi/wakeup

iio-sensor-proxy is installed by default in the desktop environment you chose (it is a dependency of input-devices-support).

Ah, well…in that case, disregard the above. :wink:

2 Likes

Oh wow, this means that posting that inxi actually just made things worse by misleading people xD
The insomnia problem is on a custom-built stationary PC, but I posted the question from my laptop.
I guess I’ll have this for future reference if/when I actually do have that kind of problem with my laptop, so thanks regardless.

On an irrelevant note, I am getting random sleep-related problems with both of my computers with Garuda, but that’s not the topic here. I also understand that it’s somewhat of a generic linux thing… but right now, that’s not my priority, I just want a setup where I can have Garuda running on my stationary PC 24/7 and not have to reboot after less than 3 days.

That kinda looks like what I wanted, I will look at that as well. Thanks!
…there’s the slight caveat of it being a KDE plasma thing, but, for now, it might do. I’ll have to try to do another multi-day session on my stationary PC.

Yes, posting incorrect hardware information is super unhelpful and definitely makes things worse and misleads people, as you have mentioned.

I guess I would have thought this was obvious, but: you need to post the inxi from the computer which has the issue. How can people search for clues with hardware information from a completely different machine?

3 Likes

One option could be that the machine is rendered somehow unusable. However, I do imagine that such a problem probably won’t be solved by the inxi as well…
In my case, I wasn’t at home, so I couldn’t (and wouldn’t) reboot on the fly, I keep my main (stationary) PC on pretty much 24/7, so I snap back to windows when something goes wrong with that. Windows can last me a couple weeks to about a month per session, while the most I’ve managed to get out of Garuda w/o problems so far has been 2 full days.
I had a moment when I remembered of the problem at uni, searched for potential solutions and eventually decided to ask a question about it, since I wasn’t finding what I wanted - most of it was how to keep linux from going to sleep. I ended up throwing the inxi in the third post as a bureaucratic procedure, thinking it would save some back-and-forth about the inxi being irrelevant to my question, but, well, here we are :joy:.

I misread your question, I read it as, basically, “why would someone post the hardware information (question) from a different machine?”. I seem to be a bit off today/now.

That’s fine, I hope you feel better soon.

If you want to open a new topic for this issue, please be sure to read the topic template more carefully and make a better effort to include the requested information in your post. Specifically, add more details regarding what the issue is (the way it is described here is super vague), describe what you have done so far to resolve the issue on your own, and–of course–include relevant hardware information and diagnostic output from the device which has the issue.

As for this topic, it seems to be going nowhere so I’ll recategorize it accordingly.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.