HowTo Prevent A Laptop Lid Close Suspension: Difference between revisions

From MediaWiki
Jump to navigationJump to search
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
__TOC__
__TOC__
= Overview =
= Overview =
This page demonstrates how one can shut the lid of a laptop computer running NST and still have NST run without being suspended. This is especially useful when NST is booted in console mode. The '''[https://www.freedesktop.org/software/systemd/man/systemd-logind.service.html systemd-logind.service]''' can be configured to "'''ignore'''" the ''suspension'' system power action. This '''[https://www.freedesktop.org/software/systemd/man/systemd.html systemd]''' service handles various hardware state system power functionality.
This page demonstrates how one can shut the lid of a laptop computer running NST or Fedora without suspending the system. This is especially useful when NST is booted in console mode. The '''[https://www.freedesktop.org/software/systemd/man/systemd-logind.service.html systemd-logind.service]''' can be configured to "'''ignore'''" the ''suspension'' system power action. This '''[https://www.freedesktop.org/software/systemd/man/systemd.html systemd]''' service handles various hardware state system power functionality.


== Edit Configuration File for systemd-logind.service ==
== NST Version Below: 40 - Edit Configuration File for systemd-logind.service ==
The '''systemd-logind.service''' has a configuration file: "'''[https://www.freedesktop.org/software/systemd/man/logind.conf.html /etc/systemd/logind.conf]'''" that contains an entry for controlling the system power when the lid switch is in the '''Closed''' position. If one wants to allow an NST system running on a laptop computer not to enter the '''Suspension''' power state, then the '''HandleLidSwitch''' entry needs to be set to: "'''ignore'''".
The '''systemd-logind.service''' has a configuration file: "'''[https://www.freedesktop.org/software/systemd/man/logind.conf.html /etc/systemd/logind.conf]'''" that contains an entry for controlling the system power when the lid switch is in the '''Closed''' position. If one wants to allow an NST system running on a laptop computer not to enter the '''Suspension''' power state, then the '''HandleLidSwitch''' entry needs to be set to: "'''ignore'''".


Line 49: Line 49:
[root@shopper2 ~]#
[root@shopper2 ~]#
</pre>
</pre>
* Finally reboot or restart the "'''systemd-logind.service'''".
== NST Version 40 or Above - Edit Configuration File for systemd-logind.service ==
* See man pages: man '''[https://man7.org/linux/man-pages/man8/systemd-logind.service.8.html systemd-logind]''' and '''[https://man7.org/linux/man-pages/man5/logind.conf.5.html logind.conf]'''
* Create directory: "'''/etc/systemd/logind.conf.d/'''"
* Copy file: "'''/usr/lib/systemd/logind.conf'''" to "'''/etc/systemd/logind.conf.d/'''"
* Uncomment entries: "'''HandleLidSwitch'''", "'''HandleLidSwitchExternalPower'''" and "'''HandleLidSwitchDocked'''" and set them to the value: "'''ignore'''" in file: "'''/etc/systemd/logind.conf.d/logind.conf'''" show below:
<pre class="programListing">
[root@nst40-lat5411 ~]# cat /etc/systemd/logind.conf.d/logind.conf
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it under the
#  terms of the GNU Lesser General Public License as published by the Free
#  Software Foundation; either version 2.1 of the License, or (at your option)
#  any later version.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file (or a copy of it placed in
# /etc/ if the original file is shipped in /usr/), or by creating "drop-ins" in
# the /etc/systemd/logind.conf.d/ directory. The latter is generally
# recommended. Defaults can be restored by simply deleting the main
# configuration file and all drop-ins located in /etc/.
#
# Use 'systemd-analyze cat-config systemd/logind.conf' to display the full config.
#
# See logind.conf(5) for details.
[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#UserStopDelaySec=10
#HandlePowerKey=poweroff
#HandlePowerKeyLongPress=ignore
#HandleRebootKey=reboot
#HandleRebootKeyLongPress=poweroff
#HandleSuspendKey=suspend
#HandleSuspendKeyLongPress=hibernate
#HandleHibernateKey=hibernate
#HandleHibernateKeyLongPress=ignore
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#RebootKeyIgnoreInhibited=no
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RuntimeDirectoryInodesMax=
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192
#StopIdleSessionSec=infinity
</pre>
* Finally reboot or restart the systemd service: "'''systemd-logind.service'''".
[root@nst40-lat5411 ~]# systemctl status systemd-logind.service;
* Show the current effective "'''systemd/logind.conf'''"
[root@nst40-lat5411 ~]# systemd-analyze --tldr cat-config systemd/logind.conf
# /usr/lib/systemd/logind.conf
[Login]
# /etc/systemd/logind.conf.d/logind.conf
[Login]
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore

Latest revision as of 19:00, 16 September 2024

Overview

This page demonstrates how one can shut the lid of a laptop computer running NST or Fedora without suspending the system. This is especially useful when NST is booted in console mode. The systemd-logind.service can be configured to "ignore" the suspension system power action. This systemd service handles various hardware state system power functionality.

NST Version Below: 40 - Edit Configuration File for systemd-logind.service

The systemd-logind.service has a configuration file: "/etc/systemd/logind.conf" that contains an entry for controlling the system power when the lid switch is in the Closed position. If one wants to allow an NST system running on a laptop computer not to enter the Suspension power state, then the HandleLidSwitch entry needs to be set to: "ignore".

The HandleLidSwitch entry is set to: "ignore" in the listing below for file: "/etc/systemd/logind.conf"

[root@shopper2 ~]# cat /etc/systemd/logind.conf 
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See logind.conf(5) for details.

[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
HandleLidSwitch=ignore
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192
#UserTasksMax=33%
[root@shopper2 ~]#
  • Finally reboot or restart the "systemd-logind.service".

NST Version 40 or Above - Edit Configuration File for systemd-logind.service

  • See man pages: man systemd-logind and logind.conf
  • Create directory: "/etc/systemd/logind.conf.d/"
  • Copy file: "/usr/lib/systemd/logind.conf" to "/etc/systemd/logind.conf.d/"
  • Uncomment entries: "HandleLidSwitch", "HandleLidSwitchExternalPower" and "HandleLidSwitchDocked" and set them to the value: "ignore" in file: "/etc/systemd/logind.conf.d/logind.conf" show below:
[root@nst40-lat5411 ~]# cat /etc/systemd/logind.conf.d/logind.conf 
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it under the
#  terms of the GNU Lesser General Public License as published by the Free
#  Software Foundation; either version 2.1 of the License, or (at your option)
#  any later version.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file (or a copy of it placed in
# /etc/ if the original file is shipped in /usr/), or by creating "drop-ins" in
# the /etc/systemd/logind.conf.d/ directory. The latter is generally
# recommended. Defaults can be restored by simply deleting the main
# configuration file and all drop-ins located in /etc/.
#
# Use 'systemd-analyze cat-config systemd/logind.conf' to display the full config.
#
# See logind.conf(5) for details.

[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#UserStopDelaySec=10
#HandlePowerKey=poweroff
#HandlePowerKeyLongPress=ignore
#HandleRebootKey=reboot
#HandleRebootKeyLongPress=poweroff
#HandleSuspendKey=suspend
#HandleSuspendKeyLongPress=hibernate
#HandleHibernateKey=hibernate
#HandleHibernateKeyLongPress=ignore
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#RebootKeyIgnoreInhibited=no
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RuntimeDirectoryInodesMax=
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192
#StopIdleSessionSec=infinity
  • Finally reboot or restart the systemd service: "systemd-logind.service".
[root@nst40-lat5411 ~]# systemctl status systemd-logind.service;
  • Show the current effective "systemd/logind.conf"
[root@nst40-lat5411 ~]# systemd-analyze --tldr cat-config systemd/logind.conf
# /usr/lib/systemd/logind.conf
[Login]

# /etc/systemd/logind.conf.d/logind.conf
[Login]
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore