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

77.12. util-linux-login-2.42.4

util-linux's login, built against PAM: the console login that registers an elogind session

Version 2.42.4, release 1
Shelf base — The minimal userland and system daemons that every KDOS image boots with
Phase 41_system (System), 208 of 1047 in build order
Licence GPL-2.0-or-later
Homepage https://github.com/util-linux/util-linux
Build time 0.9 SBU
Installed size 151.4 KiB in 4 files
Recipe ports/core/base/util-linux-login/kpkgbuild

About

This port is util-linux’s login, the program agetty hands a console login to, and nothing else from util-linux. It is built against PAM, so a login on a text console runs the /etc/pam.d/login stack this port installs, which includes system-login from pam: the password is checked by pam_unix, turnstile gives the user /run/user/<uid>, the session bus and audio, and elogind registers the login as a session on seat0. A console login is then an active local session like a Plasma one, so polkit’s allow_active answers apply to it.

It is a second build of the util-linux tarball. util-linux is a 30_foundation port, built before PAM exists, and its login needs PAM’s headers; this port configures the same tarball again in 41_system, once pam is installed, and packages only login and its manual page. Its version and sha256 must equal util-linux’s, and both recipes carry group = util-linux, so the version checker offers the two only as one bump (see A second build of the same source). shadow installs no login, so this is the only one.

Sources

Dependencies

Depends on: pam, utmps, shadow.

Required by: no port names it.

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.

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 util-linux-login'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/base/util-linux-login.

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/base/util-linux-login
echo 'fbd62a100ab7bb8746ba0661255c3c48185b1e9021507c624da01fbc696330ec  util-linux-2.42.4.tar.xz' | 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/util-linux-login
SRC=$SRC_ROOT/util-linux-login-2.42.4
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf util-linux-2.42.4.tar.xz -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 recipe’s helpers group and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i "$PORT_SRC/utmps-paths.patch"
./configure \
	--prefix=/usr \
	--disable-all-programs \
	--enable-login \
	--enable-login-lastlog \
	--without-systemd \
	--without-systemdsystemunitdir \
	--without-udev \
	--without-python \
	--without-selinux \
	--without-audit \
	--without-econf \
	--disable-asciidoc \
	--disable-poman \
	--disable-nls \
	CPPFLAGS=-I/usr/include/utmps
make LIBS="-lutmps -lskarnet" login
install -D -m 755 login "$PKG/usr/bin/login"
install -D -m 644 login-utils/login.1 "$PKG/usr/share/man/man1/login.1"

install -d -m 755 "$PKG/etc/pam.d"
cat > "$PKG/etc/pam.d/login" << "EOF"
# Begin /etc/pam.d/login
auth      optional   pam_faildelay.so  delay=3000000
auth      requisite  pam_nologin.so
auth      include    system-login
account   include    system-login
password  include    system-login
session   include    system-login
# End /etc/pam.d/login
EOF
chmod 644 "$PKG/etc/pam.d/login"

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/util-linux-login, 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 util-linux-login-2.42.4-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/util-linux-login, and runs the triggers its paths call for.

Contents

Installed programs: login.

Installed directories: /usr/share/licenses/util-linux-login.

Short descriptions

login begin session on the system

Notes

make login builds the one program, and build.sh installs it and login.1 by hand, so the package holds /usr/bin/login, /usr/share/man/man1/login.1 and the PAM service file, and nothing util-linux’s package also installs.

/etc/pam.d/login includes system-login for all four module types, so a console login is registered with elogind and handed to turnstile exactly as a desktop login is. Before that, pam_faildelay holds a failed attempt for three seconds and pam_nologin refuses everybody but root while /etc/nologin exists. Without the file login would fall through to /etc/pam.d/other, which refuses everybody, and the recovery console on tty2 would refuse every password; pam_elogind and pam_turnstile are optional in system-login, so it still logs in with elogind or turnstiled down. util-linux’s login opens the PAM service login for a console login and remote for one started with -h; nothing on KDOS starts it with -h, so no remote file ships, and /etc/pam.d/other would refuse such a login.

login sets MAIL to /var/mail/<user> whatever login.defs says. Nothing on KDOS delivers to that directory, which does not exist; a mail reader that follows MAIL finds no mailbox.

The recipe names shadow in replaces and depends: shadow’s package does not install login, and in a tree whose installed shadow package still holds /usr/bin/login, replaces lets this package take the path over instead of being refused.