elogind-246.10
Introduction to elogind
elogind is the systemd project's "logind", extracted to be a
standalone daemon. It integrates with Linux-PAM-1.5.2 to track all the users logged
in to a system, and whether they are logged in graphically, on the
console, or remotely. Elogind
exposes this information via the standard org.freedesktop.login1
D-Bus interface, and also through
the file system using systemd's standard /run/systemd
layout.
This package is known to build and work properly using an LFS 11.3
platform.
Package Information
elogind Dependencies
Required
dbus-1.14.6
Recommended
Linux-PAM-1.5.2 (required for Xorg),
Polkit-122 (runtime), docbook-xml-4.5,
docbook-xsl-nons-1.79.2, and
libxslt-1.1.37 (all three to build the man
pages)
Optional
For the tests: lxml-4.9.2, gobject-introspection-1.74.0,
zsh-5.9, Valgrind-3.20.0, audit-userspace,
bash-completion,
kexec,
and SELinux
User Notes: https://wiki.linuxfromscratch.org/blfs/wiki/elogind
Kernel
Configuration
Enable the following options in the kernel configuration and
recompile the kernel if necessary:
General setup --->
[*] Control Group support [CONFIG_CGROUPS]
File systems --->
[*] Inotify support for userspace [CONFIG_INOTIFY_USER]
Pseudo filesystems --->
[*] Tmpfs POSIX Access Control Lists [CONFIG_TMPFS_POSIX_ACL]
In addition, some tests need the userspace cryptographic kernel
API, which is enabled with:
-*- Cryptographic API ---> [CONFIG_CRYPTO]
<M/*> Userspace cryptographic algorithm configuration [CONFIG_CRYPTO_USER]
<M/*> User-space interface for hash algorithms [CONFIG_CRYPTO_USER_API_HASH]
Installation of elogind
Install elogind by running the
following commands:
sed -i '/Disable polkit/,+8 d' meson.build &&
sed '/request_name/i\
r = sd_bus_set_exit_on_disconnect(m->bus, true);\
if (r < 0)\
return log_error_errno(r, "Failed to set exit on disconnect: %m");' \
-i src/login/logind.c &&
mkdir build &&
cd build &&
meson --prefix=/usr \
--buildtype=release \
-Dcgroup-controller=elogind \
-Ddbuspolicydir=/etc/dbus-1/system.d \
-Dman=auto \
.. &&
ninja
To test the results, issue: ninja
test. A few tests are skipped if not run with
root
privileges.
Now, as the root
user:
ninja install &&
ln -sfv libelogind.pc /usr/lib/pkgconfig/libsystemd.pc &&
ln -sfvn elogind /usr/include/systemd
Command Explanations
sed ... meson.build:
This change allows the package to be built without polkit being
installed (it is still a runtime dependency) but able to use polkit
after that package is installed.
sed ...
src/login/logind.c: This change allows the elogind
daemon to exit when it is disconnected from dbus (for example when
dbus is killed).
-Dcgroup-controller=elogind
: This
switch ensures that elogind is
selected as the cgroup controller, even if booted with another
running cgroup controller.
-Ddbuspolicydir=/etc/dbus-1/system.d
:
This switch sets the location of the D-Bus policy directory.
-Dman=auto
: The default
value of this switch is false. Setting it to auto allows building and installing the
man pages if the recommended dependencies are installed.
-Ddefault-kill-user-processes=false
:
Determines whether the processes of a user should be killed when
the user logs out. The default is true, but this defeats the traditional
use of screen or
tmux. This can also
be changed in the configuration file (see below).
ln -s ...: These
commands install symlinks so that software packages can find the
systemd-compatible library and headers.
Configuring elogind
Config File
/etc/elogind/logind.conf
Configuration Information
The installed file /etc/elogind/logind.conf
contains all the
possible options with their defaults, commented out. You may wish
to disable automatically killing user processes when the user
logs out, by running, as the root
user:
sed -e '/\[Login\]/a KillUserProcesses=no' \
-i /etc/elogind/logind.conf
Each user will need to register a user session using Linux-PAM at login. The /etc/pam.d/system-session
file needs to be
modified and a new file must be created in order for elogind to work correctly. Run
the following commands as the root
user:
cat >> /etc/pam.d/system-session << "EOF" &&
# Begin elogind addition
session required pam_loginuid.so
session optional pam_elogind.so
# End elogind addition
EOF
cat > /etc/pam.d/elogind-user << "EOF"
# Begin /etc/pam.d/elogind-user
account required pam_access.so
account include system-account
session required pam_env.so
session required pam_limits.so
session required pam_unix.so
session required pam_loginuid.so
session optional pam_keyinit.so force revoke
session optional pam_elogind.so
auth required pam_deny.so
password required pam_deny.so
# End /etc/pam.d/elogind-user
EOF
Contents
Installed Programs:
busctl, elogind-inhibit, and
loginctl
Installed Library:
libelogind.so
Installed Directories:
/lib/elogind, /etc/elogind,
/usr/include/elogind, and /usr/share/doc/elogind-246.10
Short Descriptions
busctl
|
is used to introspect and monitor the D-Bus bus
|
elogind-inhibit
|
is used to execute a program with a shutdown, sleep or
idle inhibitor lock taken
|
loginctl
|
is used to introspect and control the state of the
elogind Login Manager
|
libelogind.so
|
is the main elogind utility library
|