Elogind: Difference between revisions
Prabuanand (talk | contribs) (removed Category:Desktop as per Help_talk:Style) |
Prabuanand (talk | contribs) (moved headings, removed reference to PAM as it's a dependency already) |
||
Line 4: | Line 4: | ||
* Install and configure [[Polkit#Using polkit with elogind|Polkit]] as it is used for authentication by elogind. | * Install and configure [[Polkit#Using polkit with elogind|Polkit]] as it is used for authentication by elogind. | ||
== Installation == | == Installation == | ||
Line 12: | Line 11: | ||
# rc-service elogind start</nowiki>}} | # rc-service elogind start</nowiki>}} | ||
== | == Configuration == | ||
=== Hibernation === | |||
The command to trigger hibernation is: {{Cmd|# loginctl hibernate}} | |||
For | For hibernation to work, you must have a swap partition. Check {{Cmd|# lsblk}} for a partition with the mountpoint [SWAP]. | ||
<pre> | <pre> | ||
Line 35: | Line 38: | ||
The resume process can be speed up reducing the size of the hibernation images. See the documentation for [https://docs.kernel.org/admin-guide/pm/sleep-states.html?highlight=image_size#basic-sysfs-interfaces-for-system-suspend-and-hibernation image_size] in the kernel docs for the details, but writing 0 to {{Path|/sys/power/image_size}} should make the images as small as possible. | The resume process can be speed up reducing the size of the hibernation images. See the documentation for [https://docs.kernel.org/admin-guide/pm/sleep-states.html?highlight=image_size#basic-sysfs-interfaces-for-system-suspend-and-hibernation image_size] in the kernel docs for the details, but writing 0 to {{Path|/sys/power/image_size}} should make the images as small as possible. | ||
== | === Power management === | ||
Edit the systemwide config file {{Path|/etc/elogind/logind.conf}} to configure handling of power events, such as suspending the computer when power button is pressed: | Edit the systemwide config file {{Path|/etc/elogind/logind.conf}} to configure handling of [[Power_management#elogind_and_power_management|power events]], such as suspending the computer when power button is pressed: | ||
{{cat|/etc/elogind/logind.conf|... | {{cat|/etc/elogind/logind.conf|... | ||
Line 43: | Line 46: | ||
HandlePowerKey{{=}}suspend | HandlePowerKey{{=}}suspend | ||
...}} | ...}} | ||
Since <Code>loginctl</Code> requires privilege escalation, allow either the user to be part of wheel group or configure doas to allow running it as an unprivileged user. | Since <Code>loginctl</Code> requires privilege escalation, allow either the user to be part of wheel group or configure doas to allow running it as an unprivileged user. | ||
Line 71: | Line 59: | ||
After setting the above, suspend-to-RAM can be triggered by running {{Cmd|$ /bin/loginctl suspend}} | After setting the above, suspend-to-RAM can be triggered by running {{Cmd|$ /bin/loginctl suspend}} | ||
== Troubleshooting == | |||
If using a Window Manager or Desktop Environment, such as [[Sway]], the user must ensure that login session is correctly configured. When correctly configured, the <code>loginctl</code> command should output the following when using Sway with [[SDDM]]'': | |||
<p style="background-color:#f9f9f9; border:1px dashed #2f6fab; line-height:1.1em; padding:1em; font-family:monospace; font-size:10pt; white-space:pre; overflow:auto;"><span style="color:green;">~</span>'''$''' loginctl | |||
SESSION UID USER SEAT TTY | |||
c1 105 sddm seat0 | |||
c2 1000 User seat0 tty8 | |||
2 sessions listed. | |||
</p> | |||
If the output is <code>No session available.</code>, such as in the case of launching Sway from tty, suspend and many other functionality will not work. The user then must configure a [[Display manager|display manager]]. | |||
== See also == | == See also == |
Revision as of 06:51, 24 June 2025
elogind is extracted out of "logind" - systemd login manager to be a standalone daemon and provides Seat manager support by setting up necessary permissions for the desktop environment or window manager and handles poweroff, reboot, suspend and hibernate via loginctl commands.
Prerequisites
- Install and configure Polkit as it is used for authentication by elogind.
Installation
# apk add elogind # rc-update add elogind # rc-service elogind start
Configuration
Hibernation
The command to trigger hibernation is:
# loginctl hibernate
For hibernation to work, you must have a swap partition. Check
# lsblk
for a partition with the mountpoint [SWAP].
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS nvme0n1 259:0 0 953.9G 0 disk ├─nvme0n1p1 259:1 0 200M 0 part /boot ├─nvme0n1p2 259:2 0 100G 0 part / ├─nvme0n1p3 259:3 0 805G 0 part /home └─nvme0n1p4 259:4 0 48.7G 0 part [SWAP]
Remember also to add a kernel parameter to resume, ie in /etc/default/grub :
Contents of /etc/default/grub
Note the "resume=" flag with the same partition that was marked as [SWAP].
The resume process can be speed up reducing the size of the hibernation images. See the documentation for image_size in the kernel docs for the details, but writing 0 to /sys/power/image_size should make the images as small as possible.
Power management
Edit the systemwide config file /etc/elogind/logind.conf to configure handling of power events, such as suspending the computer when power button is pressed:
Contents of /etc/elogind/logind.conf
Since loginctl
requires privilege escalation, allow either the user to be part of wheel group or configure doas to allow running it as an unprivileged user.
Option1:
# optionally, allow $USER root access with password adduser $USER wheel
Option2:
Doas is used to grant permissions for suspend-to-RAM. In the doas config file /etc/doas.conf, set
permit nopass $USER as root cmd /bin/loginctl
After setting the above, suspend-to-RAM can be triggered by running
$ /bin/loginctl suspend
Troubleshooting
If using a Window Manager or Desktop Environment, such as Sway, the user must ensure that login session is correctly configured. When correctly configured, the loginctl
command should output the following when using Sway with SDDM:
~$ loginctl SESSION UID USER SEAT TTY c1 105 sddm seat0 c2 1000 User seat0 tty8 2 sessions listed.
If the output is No session available.
, such as in the case of launching Sway from tty, suspend and many other functionality will not work. The user then must configure a display manager.