Elogind: Difference between revisions

From Alpine Linux
(recommend pam in installation)
(I've had this issue in at least 3 different installs - this is how you get hibernate to work)
Line 11: Line 11:


Set up a [[PAM]] login.
Set up a [[PAM]] login.
== Hibernating ==
For {{Cmd|# loginctl hibernate}} to work, you must have a swap partition. Check {{Cmd|# lsblk}} for a partition with the mountpoint [SWAP].
<pre>
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]
</pre>
Remember also to add a kernel parameter to resume, ie in {{Path|/etc/default/grub}} :
<pre>
GRUB_TIMEOUT=2
GRUB_DISABLE_SUBMENU=y
GRUB_DISABLE_RECOVERY=true
GRUB_CMDLINE_LINUX_DEFAULT="modules=sd-mod,usb-storage,ext4,nvme quiet rootfstype=ext4 resume=/dev/nvme0n1p4"
</pre>
Note the "resume=" flag with the same partition that was marked as [SWAP].


== Configuration ==
== Configuration ==

Revision as of 03:24, 29 June 2023

elogind is a login manager and provides support for

  • setting up necessary permissions for the desktop environment or window manager
  • handling poweroff, reboot, suspend and hibernate via loginctl command

Installation

# apk add elogind polkit-elogind

  1. rc-update add elogind
  2. rc-service elogind start

Set up a PAM login.

Hibernating

For

# loginctl hibernate

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 :

GRUB_TIMEOUT=2
GRUB_DISABLE_SUBMENU=y
GRUB_DISABLE_RECOVERY=true
GRUB_CMDLINE_LINUX_DEFAULT="modules=sd-mod,usb-storage,ext4,nvme quiet rootfstype=ext4 resume=/dev/nvme0n1p4"

Note the "resume=" flag with the same partition that was marked as [SWAP].

Configuration

logind.conf

Edit /etc/elogind/logind.conf to configure handling of power events, such as suspending the computer when power button is pressed:

# sed -i 's|#HandlePowerKey=poweroff|HandlePowerKey=suspend|' /etc/elogind/logind.conf

Working with Desktop Environments

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:

Using Sway and 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 such as greetd, SDDM or lightdm.

See also