Elogind: Difference between revisions

From Alpine Linux
(create page with installation instructions)
 
(configure display manager)
Line 22: Line 22:
</pre>
</pre>


=== polkit policies ===
=== Working with Desktop Environments ===


elogind package does not ship with any polkit policies by default, meaning that no one is allowed to use '''loginctl''' command.
If using a Window Manager or Desktop Environment, such as [[Sway]], the user must ensure that login session is correctly configured.  When correctly configured, loginctl command should output the following:


We need to add custom polkit rules to allow specific users to execute '''loginctl'''.
<pre>
# using sway and sddm
localhost:~$ loginctl
SESSION  UID USER SEAT  TTY
    c1  105 sddm seat0   
    c2 1000 User seat0 tty8


Example for allowing all users in the user group <code>wheel</code> to suspend the computer with '''loginctl suspend''':
2 sessions listed.
</pre>


<pre>
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 such as greetd, sddm or lightdm.
tee -a /etc/polkit-1/rules.d/88-suspend.rules <<EOF
polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.login1.suspend" &&
        subject.isInGroup("wheel")) {
        return polkit.Result.YES;
    }
});
EOF
</pre>

Revision as of 11:06, 24 July 2022

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
# rc-update add elogind
# rc-service elogind start

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, loginctl command should output the following:

# using sway and sddm
localhost:~$ 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.