Skip to content

Conversation

igorpecovnik
Copy link
Member

@igorpecovnik igorpecovnik commented Oct 6, 2025

Description

On the GNOME desktop image some systems still suspend after idle, even when the GNOME UI is set to “never.” Journals show systemd-logind initiating suspend (The system will suspend now!), which means system-wide logind IdleAction is firing. Minimal/CLI images don’t show this behavior.

What’s included

  • Systemd/logind policy override (system-wide)
  • GNOME per-user defaults (best effort)

Scope

  • Affects: GNOME desktop images only.
  • Unchanged: Minimal/CLI images.

How Has This Been Tested?

Verify logind policy

systemd-analyze cat-config systemd/logind.conf
loginctl show-logind | egrep 'IdleAction|Handle(Lid|Power|Suspend|Hibernate)'

Expect: IdleAction=ignore and lid switches ignore.

Verify GNOME defaults (as desktop user)

gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type
gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type
gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout
gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout

Expect: 'nothing' and 0.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@igorpecovnik igorpecovnik requested a review from a team as a code owner October 6, 2025 10:13
@igorpecovnik igorpecovnik added the Work in progress Unfinished / work in progress label Oct 6, 2025
@github-actions github-actions bot added 11 Milestone: Fourth quarter release size/small PR with less then 50 lines Desktop Graphical user interface Needs review Seeking for review Framework Framework components labels Oct 6, 2025
Copy link
Contributor

coderabbitai bot commented Oct 6, 2025

Walkthrough

  • Adds GNOME power settings in three postinst scripts (desktop/common, desktop/bookworm, desktop/trixie) to set:
    • sleep-inactive-ac-type='nothing'
    • sleep-inactive-battery-type='nothing'
    • sleep-inactive-battery-timeout='0'
    • Existing sleep-inactive-ac-timeout='0' remains.
  • Updates lib/functions/rootfs/distro-specific.sh to create /etc/systemd/logind.conf.d/90-nosuspend.conf to prevent suspend, gated to run only when BUILD_DESKTOP="yes" and executed inside install_distribution_specific before installing base-files.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly describes the main objective of preventing unintended suspend on GNOME desktop images and specifies the two primary mechanisms used: overriding logind IdleAction and adjusting GNOME power defaults. It clearly reflects the changes in both system-wide and per-user configuration. The parenthetical clarifies the technical approach without excessive detail. Therefore it accurately summarizes the core intent of the pull request.
Description Check ✅ Passed The pull request description details the underlying problem, the specific changes made to systemd/logind and GNOME settings, and provides testing instructions and scope, all of which directly relate to the modifications in the changeset. It explains the inclusion of a system-wide logind policy override and per-user GNOME defaults adjustments to prevent unintended suspend. The description also documents how to verify the new configuration and expected outcomes. As such, it is clearly aligned with the changes introduced in the pull request.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch nosuspend

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2097b0a and 8426dbc.

📒 Files selected for processing (1)
  • lib/functions/rootfs/distro-specific.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/functions/rootfs/distro-specific.sh

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
config/desktop/common/environments/gnome/debian/postinst (1)

21-24: LGTM! Consider consolidating duplicate power settings.

The power settings are correct. However, these identical GNOME power configurations are duplicated across three postinst files (common, bookworm, trixie). While this works, consider consolidating them into a single location for easier maintenance.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c340b22 and d08bb04.

📒 Files selected for processing (4)
  • config/desktop/bookworm/environments/gnome/debian/postinst (1 hunks)
  • config/desktop/common/environments/gnome/debian/postinst (1 hunks)
  • config/desktop/trixie/environments/gnome/debian/postinst (1 hunks)
  • lib/functions/rootfs/distro-specific.sh (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
lib/functions/rootfs/distro-specific.sh (1)
lib/functions/bsp/armbian-bsp-cli-deb.sh (1)
  • board_side_bsp_cli_postinst_base (425-446)
🔇 Additional comments (3)
config/desktop/trixie/environments/gnome/debian/postinst (1)

22-25: LGTM! GNOME power settings configured correctly.

The added settings properly prevent GNOME from initiating suspend on both AC and battery power. The combination of type='nothing' and timeout='0' ensures no idle suspend occurs.

config/desktop/bookworm/environments/gnome/debian/postinst (1)

22-25: LGTM! Power settings configured correctly.

The GNOME power management settings properly prevent suspend behavior.

lib/functions/rootfs/distro-specific.sh (1)

50-50: Confirm disabling the power button is intentional
HandlePowerKey=ignore in lib/functions/rootfs/distro-specific.sh (also in config/boards/pinebook-pro.csc) prevents all power-button actions; if you need a shutdown dialog, use HandlePowerKey=poweroff or =suspend instead.

igorpecovnik and others added 2 commits October 6, 2025 12:21
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@HackingGate
Copy link
Contributor

HackingGate commented Oct 12, 2025

The following behavior should match most users' expectation IMO, and it's the default for major distro desktops.

GNOME on: suspend after idle
GNOME off: no suspention (behaves like a minimal server OS)

When GNOME isn't needed for a device, the user have the option to run this, and the power management from GNOME will be gone.

systemctl set-default multi-user.target
systemctl isolate multi-user.target

For those uses cases that require no suspension while using desktop, adding a separate var like DESKTOP_NO_SUSPEND to allow a board maintainer or a user to custom the image, could be better?

@igorpecovnik
Copy link
Member Author

igorpecovnik commented Oct 12, 2025

Main problem in this world is that resume from suspend is generally not working at the level of 1st class hardware. Often suspend leads into inability of resuming or resume ends up with unstable system. In early days, suspend was defaulted to off by default and now this is not the case anymore. We could add DESTKOP_NO_SUSPEND variable, which should disable suspend by default, so maintainer would enable this in a board config. Or just SUSPEND=yes / no,
regardless of if DE is enabled or not - disable systemd service.

Having only this:

/etc/systemd/sleep.conf.d/00-disable.conf

[Sleep]
AllowSuspend=no
AllowHibernation=no
AllowHybridSleep=no
AllowSuspendThenHibernate=no

And perhaps adding enable / disable to armbian-config ?

@igorpecovnik igorpecovnik added the Discussion Being discussed - Voice your opinions :) label Oct 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

11 Milestone: Fourth quarter release Desktop Graphical user interface Discussion Being discussed - Voice your opinions :) Framework Framework components Needs review Seeking for review size/small PR with less then 50 lines Work in progress Unfinished / work in progress

Development

Successfully merging this pull request may close these issues.

2 participants