Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

79.2. elogind-255.24

Standalone logind: seats, sessions, login1 on the system bus, pam_elogind and libelogind

Version 255.24, release 1
Shelf auth — Authentication, authorisation, accounts and directory services
Phase 41_system (System), 48 of 1047 in build order
Licence GPL-2.0-or-later AND LGPL-2.1-or-later
Homepage https://github.com/elogind/elogind
Build time 1.1 SBU
Installed size 5.2 MiB in 601 files
Recipe ports/core/auth/elogind/kpkgbuild

About

elogind is systemd’s logind taken out of systemd and run as a daemon of its own. It owns org.freedesktop.login1 on the system bus: it records every login as a session on a seat, tells which session is the active one, hands the session’s compositor its display and input devices (TakeControl), announces a suspend or a power-off and lets programs delay or block one with an inhibitor. Besides the daemon this port installs pam_elogind.so, the PAM module through which a login registers its session, the client library libelogind and loginctl.

On KDOS it is the one logind. SDDM records each session through it and switches users through it; KWin opens the display and the input devices through the session it records, and has no other session backend that works here; PowerDevil suspends the machine and owns the lid through it; and the lock screen locks when it announces a sleep. polkit asks it whether a caller sits in the active local session, which is what the allow_active column of an action’s policy means. Why KDOS carries this one piece of systemd’s source tree, and what it costs, is in No systemd init, units or service manager.

The daemon is /usr/lib/elogind/elogind, started at boot by /etc/init.d/40_elogind.sh under ksvc, after D-Bus and before polkit and NetworkManager.

Sources

Dependencies

Depends on: meson, ninja, pkgconf, coreutils, gperf, python3-jinja2, python3-lxml, libxslt, docbook-xsl, docbook-xml, libcap, acl, eudev, util-linux, dbus, pam.

Required by (12): accountsservice, fwupd, gnome-disk-utility, gvfs, kscreenlocker, networkmanager, pipewire, polkit, powerdevil, sddm, tlp, wireplumber.

Optional, off in KDOS

These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.

Patches

build.sh applies these; kpkg applies nothing by itself.

Ten of the patches are Alpine’s set for elogind 255.24 on musl, each carried as Alpine has it with a Subject: line first: 0001 to 0009 make the systemd-derived code compile and behave against musl (no <gshadow.h>, sh instead of bash in two generator scripts, the XSI strerror_r, getdents, a struct stat field the journal code cannot compile against musl, and three include fixes), and 0010 is a backport from systemd that collects a session when its leader process dies. no-runtime-dir.patch is Chimera Linux’s, and is what lets turnstile own the runtime directory (see Notes). lxml-resolve-entities.patch passes resolve_entities=True to the parser in tools/xml_helper.py: python3-lxml otherwise leaves custom-entities.ent unloaded, and the elogind.directives and elogind.index pages stop the build with Entity 'entities' not defined. Those two pages are built unconditionally whatever configure finds, so lxml is a build dependency, not an optional one. udevadm-path.patch writes /usr/sbin/udevadm into 71-seat.rules. The template takes the directory from bindir, which on KDOS holds no udevadm (see eudev), and udev logs the failed run only at debug level.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install elogind'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/auth/elogind.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/auth/elogind
echo '7737e13f409bdf6041bd1a1f5580ab197790f6641e26faf93e09c19c68f5dab8  elogind-255.24.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/elogind
SRC=$SRC_ROOT/elogind-255.24
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf elogind-255.24.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

for p in "$PORT_SRC"/0*.patch "$PORT_SRC/no-runtime-dir.patch" "$PORT_SRC/lxml-resolve-entities.patch" "$PORT_SRC/udevadm-path.patch"; do
	patch -p1 --no-backup-if-mismatch -i "$p"
done

meson setup build \
	--prefix=/usr --sysconfdir=/etc --libdir=lib --localstatedir=/var \
	--libexecdir=/usr/lib/elogind \
	--buildtype=release \
	-Dmode=release \
	-Dcgroup-controller=elogind \
	-Ddefault-hierarchy=unified \
	-Ddefault-kill-user-processes=false \
	-Dhalt-path=/sbin/halt \
	-Dpoweroff-path=/sbin/poweroff \
	-Dreboot-path=/sbin/reboot \
	-Dkexec-path=/usr/sbin/kexec \
	-Dnologin-path=/usr/sbin/nologin \
	-Dpamlibdir=/usr/lib/security \
	-Dpam=enabled \
	-Dpolkit=enabled \
	-Dacl=enabled \
	-Dutmp=false \
	-Daudit=disabled \
	-Dselinux=disabled \
	-Dsmack=false \
	-Dxenctrl=disabled \
	-Ddbus=disabled \
	-Dtranslations=false \
	-Dman=enabled \
	-Dhtml=disabled \
	-Dtests=false
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build

rm "$PKG/usr/share/dbus-1/system-services/org.freedesktop.login1.service"
rmdir "$PKG/usr/share/dbus-1/system-services"

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/elogind, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf elogind-255.24-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/elogind, and runs the triggers its paths call for.

Contents

Installed programs: busctl, elogind-inhibit, loginctl.

Installed libraries: libelogind.so.

Installed directories: /etc/elogind, /usr/include/elogind, /usr/lib/elogind/system-shutdown, /usr/share/doc/elogind, /usr/share/licenses/elogind, /var/lib/elogind.

Short descriptions

busctl Introspect the bus
elogind-inhibit Execute a program with an inhibition lock taken
loginctl Control the elogind login manager
libelogind.pc elogind Library

Notes

/run/user/<uid> belongs to turnstile. Unpatched, elogind mounts a tmpfs there at a user’s first login and unmounts and deletes it with everything in it at the last logout, and pam_elogind exports XDG_RUNTIME_DIR. KDOS boxes and the user’s services keep their sockets in that directory (the session bus at /run/user/<uid>/bus, which every box binds), and a user who lingers keeps them running after logging out, so a second owner removing the directory under them breaks every box. no-runtime-dir.patch takes both jobs out of elogind; turnstile, built with manage_rundir, creates, exports and removes the directory. With the patch and without turnstile in the PAM stack a login has no XDG_RUNTIME_DIR at all, and KWin, the greeter’s included, refuses to start.

Lingering is one directory for both. loginctl enable-linger writes /var/lib/elogind/linger/<user>. turnstile is built to read the same directory, so the linger elogind reports and the one turnstile acts on cannot disagree.

No D-Bus activation. The build installs /usr/share/dbus-1/system-services/org.freedesktop.login1.service, which would let the bus start a second, unsupervised elogind for any caller that asked for org.freedesktop.login1 before the supervised one held it. The recipe deletes it, as the polkit recipe deletes polkit’s; the init script waits until elogind owns the name before the scripts after it run.

Configuration. Two drop-ins, read after upstream’s 10-elogind.conf, come from the tree’s fs/ overlay, not from this package, so their comments carry the reasons beside the keys; a third is written at boot:

The package’s own logind.conf, sleep.conf and their 10-elogind.conf drop-ins set nothing and sort before 50. A copy of either KDOS file in the package would be installed over the fs/ one, because packages are installed after fs/ is synced, which is why the recipe writes neither.

Seats come from the udev rules. The package installs 70-power-switch.rules, 70-uaccess.rules, 71-seat.rules and 73-seat-late.rules into /usr/lib/udev/rules.d. 71-seat.rules tags every DRM card master-of-seat and every input device seat; without it seat0 has no graphics device and the greeter’s KWin cannot take the seat. -Dacl=enabled is what writes the elogind-uaccess-command line into 73-seat-late.rules.

No libsystemd alias. Some distributions link libsystemd.pc and /usr/include/systemd to elogind’s. KDOS does not, so a port that probes for libsystemd still finds none and its systemd-only code stays off; a port that wants logind names libelogind.

meson setup runs realpath --relative-to, which coreutils’ realpath has and toybox’s and busybox’s do not, so coreutils is in depends.