354.3. kscreenlocker-6.8.2
Plasma's screen locker: the locking library KWin links, the PAM unlock greeter and the Screen Locking settings page
| Version | 6.8.2, release 1 |
| Shelf | kde — KDE Plasma and Gear platform pieces outside Frameworks that have no other domain: KIO workers, thumbnailers, Plasma integration, KDE Wayland glue |
| Phase | 50_desktop (Desktop), 3 of 92 in build order |
| Licence | GPL-2.0-or-later AND (LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL) AND (GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL) AND CC0-1.0 AND LGPL-2.1-or-later AND BSD-3-Clause AND BSD-2-Clause |
| Homepage | https://invent.kde.org/plasma/kscreenlocker |
| Build time | 2.2 SBU |
| Installed size | 1.3 MiB in 34 files |
| Recipe | ports/core/kde/kscreenlocker/kpkgbuild |
About
KScreenLocker is the Plasma lock screen. libKScreenLocker is the locking side, which kwin links: it locks after the idle time set in kscreenlockerrc, when the session is told to (org.freedesktop.ScreenSaver.Lock, loginctl lock-session, the lock shortcut), and before the machine sleeps, and it keeps the session locked until the greeter reports success. The greeter, /usr/lib/libexec/kscreenlocker_greet, draws the unlock screen over every output from the lock-screen QML of the current Plasma look-and-feel package, falling back to a plain theme compiled into it. It checks each attempt through kscreenlocker_worker, a helper that runs one PAM conversation and runs as the user, not as root. The Screen Locking page of System Settings (kcm_screenlocker) is also part of the port.
Why it is in KDOS
The comment above it in script/phases/50_desktop/packages.txt:
The lock screen: the library KWin links and the PAM unlock greeter.
Sources
kscreenlocker-6.8.2.tar.xz(177.7 KiB)
sha25624538edbdb72840bbfaf5e4e4fce40f25029a46dd0e35277317be95211f7f968
upstream: https://download.kde.org/stable/plasma/6.8.2/kscreenlocker-6.8.2.tar.xz
archive copy: sources-3/kde--kscreenlocker-6.8.2.tar.xz
Dependencies
Depends on: cmake, ninja, extra-cmake-modules, qt6-qtbase, qt6-qtdeclarative, kcrash, kcmutils, kio, kglobalaccel, ki18n, kidletime, knotifications, solid, kwindowsystem, kxmlgui, ksvg, kconfig, kcoreaddons, kpackage, kdeclarative, kirigami, libplasma, layer-shell-qt, libkscreen, pam, elogind.
Required by (4): kde-plasma, kwin, plasma-desktop, plasma-workspace.
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/50_desktop/phase.env && kpkg install kscreenlocker'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/kde/kscreenlocker.
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/kde/kscreenlocker
echo '24538edbdb72840bbfaf5e4e4fce40f25029a46dd0e35277317be95211f7f968 kscreenlocker-6.8.2.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/kscreenlocker
SRC=$SRC_ROOT/kscreenlocker-6.8.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf kscreenlocker-6.8.2.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:
cmake -S . -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D KDE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D KDE_INSTALL_USE_QT_SYS_PATHS=ON \
-D BUILD_TESTING=OFF \
-D KF_SKIP_PO_PROCESSING=ON \
-D KSCREENLOCKER_PAM_PASSWORD_SERVICE=kde \
-D KSCREENLOCKER_PAM_FINGERPRINT_SERVICE=kde-fingerprint \
-D KSCREENLOCKER_PAM_SMARTCARD_SERVICE=disabled \
-D KSCREENLOCKER_PAM_FACE_SERVICE=disabled \
-D KSCREENLOCKER_PAM_UNIVERSAL2FACTOR_SERVICE=disabled \
-D CMAKE_REQUIRE_FIND_PACKAGE_loginctl=ON \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
install -vdm755 "$PKG/etc/pam.d"
cat > "$PKG/etc/pam.d/kde" << "EOF_PAM"
# Begin /etc/pam.d/kde
auth include system-auth
account include system-account
# End /etc/pam.d/kde
EOF_PAM
cat > "$PKG/etc/pam.d/kde-fingerprint" << "EOF_PAM"
# Begin /etc/pam.d/kde-fingerprint
auth required pam_fprintd.so
account include system-account
# End /etc/pam.d/kde-fingerprint
EOF_PAM
chmod 644 "$PKG/etc/pam.d/kde" "$PKG/etc/pam.d/kde-fingerprint"
The switches, and why each is set:
-D KF_SKIP_PO_PROCESSING=ON— Compiles none of the translation catalogues. kpkg removes every non-English catalogue from the package anyway (see Size and language policy), so this only saves build time.-D KSCREENLOCKER_PAM_PASSWORD_SERVICE=kde— The PAM service a password is checked against,/etc/pam.d/kde. It is upstream’s name, named here becausebuild.shwrites the service file under that name, so the two must agree; an unlock against a service with no file falls through to/etc/pam.d/other, which denies everything, and nobody can unlock. The password service cannot be turned off.-D KSCREENLOCKER_PAM_FINGERPRINT_SERVICE=kde-fingerprint— The service for unlocking with a fingerprint,/etc/pam.d/kde-fingerprint, whose stack usespam_fprintd.sofrom fprintd. The greeter offers it only oncekscreenlockerrc [Authenticators] Fingerprint=trueis set.-D KSCREENLOCKER_PAM_SMARTCARD_SERVICE=disabled— Compiles smart card unlocking out, with the value kscreenlocker’s own cache help names for turning an authenticator off. It needs a PAM module for smart cards, such aspam_pkcs11, and none is a port; built in, turning it on inkscreenlockerrc [Authenticators]would offer an unlock method whose PAM service does not exist, which/etc/pam.d/otherrefuses.-D KSCREENLOCKER_PAM_FACE_SERVICE=disabled— Compiles face unlocking out. It needs a PAM module for face recognition, such as Howdy’s, and none is a port.-D KSCREENLOCKER_PAM_UNIVERSAL2FACTOR_SERVICE=disabled— Compiles unlocking with a U2F or FIDO2 key out. It needspam_u2f, which is not a port.-D CMAKE_REQUIRE_FIND_PACKAGE_loginctl=ON— Makesloginctl, from elogind, a requirement of the configure. The window a crashed greeter leaves tells the user to runloginctl unlock-sessionfrom another virtual terminal. Upstream looks forloginctlonly as a run-time package, and when it finds none falls back to looking for ConsoleKit, which is not a port; with the flag the configure stops in a build root without elogind instead.-Wno-dev— Silences CMake’s warnings meant for the project’s own developers.
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/kscreenlocker, 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 kscreenlocker-6.8.2-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/kscreenlocker, and runs the triggers its paths call for.
Contents
Installed libraries: libKScreenLocker.so.
Installed directories: /usr/include/KScreenLocker, /usr/lib/cmake/KScreenLocker, /usr/lib/cmake/ScreenSaverDBusInterface, /usr/lib/qt6/qml/org/kde/kscreenlocker, /usr/share/licenses/kscreenlocker.
Notes
build.sh writes the lock screen’s two PAM stacks, /etc/pam.d/kde and /etc/pam.d/kde-fingerprint. kscreenlocker runs only the auth phase, pam_authenticate and then pam_setcred with PAM_REFRESH_CRED, and never account or session, so kde is system-auth’s auth lines and nothing else that would run. pam_kwallet5 is not in it: its auth phase only keeps the password for a session phase, and a lock screen has none, so an unlock opens no wallet. pam_unix checks the password through the setuid unix_chkpwd that pam installs, which is how a worker running as the user reads /etc/shadow. system-auth carries nullok, so an account with no password, such as the live medium’s, unlocks with an empty field. kde-fingerprint is the fingerprint authenticator’s service, used only when it is turned on in kscreenlockerrc [Authenticators] Fingerprint; pam_fprintd is required, so a reader that is absent or a finger that does not match fails the attempt rather than falling through. It names pam_fprintd.so, which fprintd installs; without fprintd the stack fails closed, so fprintd is not in depends.
The session is tracked by elogind over org.freedesktop.login1: the locker listens for the session’s Lock and Unlock signals and for PrepareForSleep, and holds a sleep delay inhibitor so that the lock is drawn before the machine suspends. If the greeter crashes, the locker keeps the session locked behind a black window that tells the user to switch to another virtual terminal, log in and run loginctl unlock-session <id>.
The fallback theme imports org.kde.plasma.private.sessions from plasma-workspace, which also provides the look-and-feel package whose lock screen the greeter normally draws; plasma-workspace depends on this port, so it is not named in depends. The other QML modules the fallback theme and the settings page import at run time come from kirigami, kdeclarative (org.kde.kquickcontrols and org.kde.kquickcontrolsaddons), kcmutils, ksvg and libplasma.