344.1. sddm-0.21.0
Display manager — the QML login greeter, run on kwin_wayland
| Version | 0.21.0, release 2 |
| Shelf | auth — Authentication, authorisation, accounts and directory services |
| Phase | 50_desktop (Desktop), 7 of 92 in build order |
| Licence | GPL-2.0-or-later AND MIT AND CC-BY-3.0 |
| Homepage | https://github.com/sddm/sddm |
| Build time | 0.3 SBU |
| Installed size | 5.7 MiB in 156 files |
| Recipe | ports/core/auth/sddm/kpkgbuild |
About
SDDM is the login screen. Its daemon, sddm, runs as root on tty1, started from /etc/inittab through kdos-dm; it owns the seat through elogind, and starts the greeter as the sddm system account on its own compositor: kwin_wayland from kwin, named by [Wayland] CompositorCommand in /etc/sddm.conf.d/00-kdos.conf. The greeter, sddm-greeter-qt6, is a QML program that draws the theme [Theme] Current= names. After a password is accepted, sddm-helper opens the user’s PAM session, writes the login to utmp, and runs the session’s Exec= line through the program in [Wayland] SessionCommand. DisplayServer=wayland keeps any X server off the login path; the greeter links libxcb only for its X11 keyboard backend, which a Wayland greeter never uses (see No Xorg server).
The configuration under /etc/sddm.conf.d/, the sddm account and kdos-dm are the tree’s fs/ overlay, not this package. The PAM stacks /etc/pam.d/sddm, sddm-autologin and sddm-greeter, the greeter’s real-time limit and the autologin’s environment file are written by build.sh (see Notes). The boot-to-greeter chain is in Boot and init.
Why it is in KDOS
The comment above it in script/phases/50_desktop/packages.txt:
The login screen. A QML greeter on its own kwin_wayland, started from inittab through kdos-dm; it opens the Plasma session through elogind and PAM.
Sources
sddm-0.21.0.tar.gz(3.4 MiB)
sha256f895de2683627e969e4849dbfbbb2b500787481ca5ba0de6d6dfdae5f1549abf
upstream: https://github.com/sddm/sddm/archive/v0.21.0/sddm-v0.21.0.tar.gz
archive copy: sources-1/auth--sddm-0.21.0.tar.gz
Dependencies
Depends on: cmake, ninja, qt6-qtbase, qt6-qtdeclarative, qt6-qttools, pam, elogind, turnstile, dbus, utmps, libxcb, libXau, python3-docutils, kwin.
Required by (3): kde-plasma, plasma-setup, sddm-kcm.
Patches
build.sh applies these; kpkg applies nothing by itself.
sddm-elogind-session-desktop.patch puts XDG_SESSION_DESKTOP (the session’s DesktopNames, KDE for Plasma) into the login’s PAM environment on an elogind build as well as a systemd one. pam_elogind records it as the session’s Desktop property, and with the variable missing every login’s loginctl show-session -p Desktop is empty and kdos status cannot tell a Plasma session from any other Wayland one. Upstream guards the line with HAVE_SYSTEMD alone; the patch is to be offered upstream.
sddm-switch-user-greeter.patch makes Switch User show a greeter on a VT of its own, and a password typed there return to the account’s running session. Upstream SDDM gets three things wrong here, and the patch changes each:
- The Switch User display autologins. SDDM autologins every new display while
[Autologin] Relogin=true, including the oneSeatManager::switchToGreetermakes for Switch User, so that display logs the account whose session already holds the seat in again. The patch givesDisplaya greeter-only flag that onlyswitchToGreetersets (an X11-user fallback of such a display keeps it), and a greeter-only display skips the autologin. - The second display takes VT 1.
fetchAvailableVt()asks elogind whetherttySDDM_INITIAL_VTis in use:SDDM_INITIAL_VTis astatic const intinconfig.h, whichSTRINGIFYturns into its own name, so the initial VT always looks free. The second display then takes VT 1 from the running session, wheresddm-helpercannot take control of/dev/tty1, exits 5, and the display is removed. The patch builds the name at run time, and the second display gets a free VT. - A login does not find an autologin session. With
ReuseSession(on by default) a login at that greeter goes back to the account’s session only when the session’s PAM service issddm; a session that began as an autologin issddm-autologin, so it is not found and the login starts a second Plasma session for the same account. The patch matches both services.
The live medium ships Relogin=true, and so does an installed machine whose Login Screen page has “log in again after logging off” ticked. The patch is to be offered upstream.
sddm-restart-greeter.patch keeps the login screen through a trip to a text console. The greeter’s KWin can drop every output across a VT switch, and the greeter quits with its last window: Ctrl+Alt+F2 and back to tty1 then ends it with a clean exit, which upstream’s daemon does not restart, so the screen stays black and takes no password until sddm itself is restarted. The patch makes the greeter quit only when the daemon stops it, its socket closes or a login succeeds (setQuitOnLastWindowClosed(false) and setQuitLockEnabled(false), outside test mode), so it draws again when the outputs come back. And a greeter that ends while nobody logs in on its display and nobody asked it to stop (a crash, a KWin that died) is started again, but only once the display’s VT is in front again: sddm-helper activates the greeter’s VT as it starts it, and would pull the user off the console they switched to. Three exits in a row, each within a minute of its start, end the retries and leave the display to tty2. The patch is to be offered upstream.
sddm-elogind-session-desktop.patch— Hand the session desktop to an elogind login as well as a systemd onepam_elogind records XDG_SESSION_DESKTOP as the session's Desktop property, as pam_systemd does; the guard set it only for a systemd build.
sddm-restart-greeter.patch— Keep the greeter across a VT switch, and start again a greeter that exits with no loginThe greeter quits once its last window is gone, and its compositor can drop every output across a VT switch: leaving the greeter's VT for a text console and coming back ends the greeter. The daemon starts a greeter again only after a display-server, tty or session error, so the display stays black with no password field until sddm itself is restarted.
Outside test mode the greeter quits only when the daemon stops it, when its socket closes, or when a login succeeds; a closed last window or a released event-loop lock ends nothing.
The daemon starts a greeter again that exits while nobody logs in on its display and nobody asked it to stop, once the display's VT is in front again: sddm-helper activates the greeter's VT as it starts it, and would pull a user off the console they switched to. Three exits in a row, each within a minute of its start, end the retries.
sddm-switch-user-greeter.patch— Show the greeter on a Switch User display, on a VT of its own, and return to an autologin sessionWith Autologin.Relogin=true every new display logs the autologin account in, the one SeatManager::switchToGreeter makes for Switch User included, and that login fails on a seat the account's session already holds. The Switch User display skips the autologin and shows the greeter.
fetchAvailableVt() asks whether "ttySDDM_INITIAL_VT" is in use: SDDM_INITIAL_VT is a static const int, which the preprocessor cannot stringify, so the initial VT always looks free and a second display takes the VT of the running session. The name is built at run time instead.
A password typed at that greeter returns to the account's own session only when that session's PAM service is "sddm"; a session that began as an autologin ("sddm-autologin") is not found, and the login starts a second session for the same account. Both services are matched.
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 sddm'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/auth/sddm.
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/sddm
echo 'f895de2683627e969e4849dbfbbb2b500787481ca5ba0de6d6dfdae5f1549abf sddm-0.21.0.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/sddm
SRC=$SRC_ROOT/sddm-0.21.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf sddm-0.21.0.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:
patch -p1 --no-backup-if-mismatch -i "$PORT_SRC/sddm-elogind-session-desktop.patch"
patch -p1 --no-backup-if-mismatch -i "$PORT_SRC/sddm-switch-user-greeter.patch"
patch -p1 --no-backup-if-mismatch -i "$PORT_SRC/sddm-restart-greeter.patch"
export CXXFLAGS="$CXXFLAGS -I/usr/include/utmps"
cmake -S . -B build -G Ninja \
-D CMAKE_POLICY_VERSION_MINIMUM=3.5 \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_WITH_QT6=ON \
-D NO_SYSTEMD=ON \
-D USE_ELOGIND=ON \
-D ENABLE_JOURNALD=OFF \
-D INSTALL_PAM_CONFIGURATION=OFF \
-D BUILD_MAN_PAGES=ON \
-D UID_MIN=1000 \
-D UID_MAX=60000 \
-D RUNTIME_DIR=/run/sddm \
-D DBUS_CONFIG_FILENAME=sddm_org.freedesktop.DisplayManager.conf \
-D CMAKE_CXX_STANDARD_LIBRARIES=-lutmps \
-Wno-dev
grep -qx 'ELOGIND_FOUND:INTERNAL=1' build/CMakeCache.txt
cmake --build build
DESTDIR=$PKG cmake --install build
install -vdm755 "$PKG/etc/pam.d"
cat > "$PKG/etc/pam.d/sddm" << "EOF_PAM"
# Begin /etc/pam.d/sddm
auth include system-login
-auth optional pam_kwallet5.so
account include system-login
password include system-login
session include system-login
-session optional pam_kwallet5.so
# End /etc/pam.d/sddm
EOF_PAM
cat > "$PKG/etc/pam.d/sddm-autologin" << "EOF_PAM"
# Begin /etc/pam.d/sddm-autologin
auth [success=1 default=ignore] pam_succeed_if.so user = plasma-setup quiet
auth required pam_succeed_if.so uid >= 1000 quiet
auth required pam_permit.so
account include system-login
password required pam_deny.so
session include system-login
session optional pam_env.so readenv=0 user_readenv=0 conffile=/etc/security/sddm-autologin.conf
-session optional pam_kwallet5.so
# End /etc/pam.d/sddm-autologin
EOF_PAM
cat > "$PKG/etc/pam.d/sddm-greeter" << "EOF_PAM"
# Begin /etc/pam.d/sddm-greeter
auth required pam_permit.so
account required pam_permit.so
password required pam_deny.so
session required pam_limits.so
session required pam_unix.so
session optional pam_elogind.so
session required pam_turnstile.so
# End /etc/pam.d/sddm-greeter
EOF_PAM
chmod 644 "$PKG/etc/pam.d/sddm" "$PKG/etc/pam.d/sddm-autologin" \
"$PKG/etc/pam.d/sddm-greeter"
install -vdm755 "$PKG/etc/security/limits.d"
cat > "$PKG/etc/security/limits.d/30-sddm.conf" << "EOF_LIM"
sddm - rtprio 1
EOF_LIM
chmod 644 "$PKG/etc/security/limits.d/30-sddm.conf"
cat > "$PKG/etc/security/sddm-autologin.conf" << "EOF_ENV"
XDG_CONFIG_DIRS DEFAULT=/etc/kdos/autologin-xdg:/etc/xdg:/usr/share/kdos/xdg
EOF_ENV
chmod 644 "$PKG/etc/security/sddm-autologin.conf"
The switches, and why each is set:
-D CMAKE_POLICY_VERSION_MINIMUM=3.5— SDDM 0.21.0 declarescmake_minimum_required(VERSION 3.4), which the tree’s CMake refuses. Alpine carries a patch raising the line to 3.5; the flag does the same without one.-D CMAKE_INSTALL_LIBDIR=lib— SDDM takes its paths fromGNUInstallDirs, not from ECM, so this is the library-directory switch it reads.-D BUILD_WITH_QT6=ON— Build the Qt 6 daemon, greeter and QML components. The default is Qt 5, and the Plasma greeter theme is Qt 6 QML.-D NO_SYSTEMD=ON— Look for no systemd. Without it the configure probessystemd.pc, and the journald and unit-file paths with it.-D USE_ELOGIND=ON— Look forlibelogindand compileloginctl poweroffandloginctl rebootin as the halt and reboot commands. SDDM reaches logind’s seats and sessions over D-Bus whichever is set; this flag changes only those two commands and the PAM module named in upstream’s greeter stack. The probe is apkg_check_modulesthat is not required, sobuild.shchecksELOGIND_FOUNDin the CMake cache after the configure: a build that missed elogind would compile in/sbin/shutdownand still succeed.-D ENABLE_JOURNALD=OFF— Log to the file and syslog, never to journald.-D INSTALL_PAM_CONFIGURATION=OFF— Install none of upstream’s PAM files. They includesystem-local-login, which KDOS does not have, namepam_gnome_keyring, and give the greeter a stack withoutpam_turnstile;build.shwrites KDOS’s own after the install, and with this on upstream’s would be installed over them.-D BUILD_MAN_PAGES=ON—sddm(1),sddm-greeter(1),sddm.conf(5)andsddm-state.conf(5), generated byrst2manfrom python3-docutils. The configure does not stop whenrst2manis missing; the build does.-D UID_MIN=1000— With-D UID_MAX=60000: the range of accounts the greeter lists, the same as/etc/login.defs. Given on the command line, the configure does not readlogin.defsfrom the build root, which a chroot that lacks it would make fatal.-D RUNTIME_DIR=/run/sddm— Where the daemon keeps X authority files. Without systemd the default is/var/run/sddm.-D DBUS_CONFIG_FILENAME=sddm_org.freedesktop.DisplayManager.conf— The system-bus policy under/usr/share/dbus-1/system.d, named after the package that owns it, as Alpine names it.-D CMAKE_CXX_STANDARD_LIBRARIES=-lutmps— With-I/usr/include/utmpsinCXXFLAGS: musl’sutmpxfunctions do nothing, sosddm-helperwrites its utmp and wtmp records through utmps, as shadow does. The library goes at the end of every link line, and--as-neededkeeps it only insddm-helper, the one program that calls it.
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/sddm, 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 sddm-0.21.0-2.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/sddm, and runs the triggers its paths call for.
Contents
Installed programs: sddm, sddm-greeter-qt6.
Installed directories: /usr/lib/qt6/qml/SddmComponents, /usr/share/licenses/sddm, /usr/share/sddm/faces, /usr/share/sddm/flags, /usr/share/sddm/scripts, /usr/share/sddm/themes/elarun, /usr/share/sddm/themes/maldives, /usr/share/sddm/themes/maya.
Short descriptions
sddm |
the simple desktop display manager |
Notes
Alpine’s 0.21.0-r10 carries three patches, and none is applied here. 0001-pam-path-fix.patch points upstream’s PAM files at Alpine’s base-* stacks; KDOS installs none of upstream’s PAM files (INSTALL_PAM_CONFIGURATION=OFF), so it has nothing to change. 0002-disable-automatic-portal-launching.patch sets QT_NO_XDG_DESKTOP_PORTAL=1 in the greeter’s main(); 0.21.0’s sddm-helper already sets that variable in the environment of every greeter-class session (src/helper/Backend.cpp), so the patch repeats it. 0003-CMake-Raise-required-version-to-3.5.patch is the CMAKE_POLICY_VERSION_MINIMUM=3.5 flag.
The greeter session gets QT_WAYLAND_SHELL_INTEGRATION=xdg-shell from the daemon, and GreeterEnvironment in 00-kdos.conf is applied after it, which is how QT_WAYLAND_SHELL_INTEGRATION=layer-shell reaches the Plasma greeter theme.
USE_ELOGIND needs NO_SYSTEMD with it: the configure looks for libelogind only when both are on. The package links no libelogind and no libsystemd.
The package installs /usr/share/sddm/scripts/wayland-session, upstream’s session wrapper. KDOS’s 00-kdos.conf names its own wrapper in SessionCommand instead, and the stock script stays for a configuration that drops the key. The X11 scripts (Xsession, Xsetup, Xstop) and sddm-helper-start-x11user are installed too and never run while DisplayServer=wayland.
Upstream’s test programs under test/ are built with no switch to skip them, and none is installed. Translations are built and installed to /usr/share/sddm/translations-qt6, and the package-wide English-only rule removes every catalogue but the source language’s (see Size and language policy).
The upstream session power menu falls back to UPower when logind does not answer on the system bus. elogind always answers on KDOS, so UPower is not a dependency.
The PAM stacks. sddm and sddm-autologin include system-login, from pam, which is where every KDOS login is registered with elogind and handed to turnstile, so a desktop login gets the same session, runtime directory, session bus and real-time limits as a console one. pam_kwallet5 comes after system-login in the session phase because it puts the wallet’s socket in the runtime directory turnstile has just made; in the auth phase it comes after pam_unix, because it only keeps the password pam_unix was given, and with no password in hand it would prompt for one itself. That is also why sddm-autologin has no pam_kwallet5 auth line: an autologin has no password, and the wallet asks for its own the first time it is opened. Both pam_kwallet5 lines start with -, so the stacks work without kwallet-pam installed, and it is not in depends.
sddm-autologin refuses any account below uid 1000 (pam_succeed_if), so a kde_settings.conf naming root or a system account starts nothing. The one exception is plasma-setup, the system account the OEM first boot logs in to run the setup wizard: the first pam_succeed_if line matches that name alone and, on a match, skips the uid check. Without it the wizard’s autologin is refused and an OEM install never leaves the login screen. root and sddm stay refused.
sddm-greeter is the sddm account’s session for the greeter. pam_turnstile is required there, not optional: turnstile is the only creator of /run/user/<sddm uid>, and the greeter’s KWin refuses to start without XDG_RUNTIME_DIR, so a session without it is a black screen that looks like a working one. That is why turnstile is in depends. turnstile’s KDOS backend starts no user services for a uid below 1000 except the session bus for sddm, so the greeter gets a runtime directory and a session bus, which its on-screen keyboard and keyboard-layout buttons reach its KWin over, and no PipeWire, timers or boxes. pam_limits with /etc/security/limits.d/30-sddm.conf grants the account real-time priority 1, which is what KWin’s SCHED_RR request needs; the capability the kwin binary carries upstream does not survive kpkg’s tar. The limit is a hard one pam_limits can raise only as root, which sddm-helper is.
An autologin can start locked, and only an autologin. sddm-autologin runs pam_env with /etc/security/sddm-autologin.conf, which puts /etc/kdos/autologin-xdg first in XDG_CONFIG_DIRS, ahead of /etc/xdg and the distribution’s defaults in /usr/share/kdos/xdg. The image ships no such directory, so on its own the line changes nothing. The installer creates it on a single-account machine with an encrypted root, with a kscreenlockerrc of [Daemon] LockOnStart=true: KWin’s screen locker then locks before the desktop is shown, and the lock screen is that machine’s login. The installer’s “no password after the disk passphrase” answer leaves the directory out. The setting lives with the stack rather than in /etc/xdg/kscreenlockerrc or a home directory because it belongs to the autologin, not to the account: a password login through sddm never reads the directory, so turning autologin off in System Settings → Login Screen does not leave every later login asking for the password a second time, and a second account is never locked at its first login. pam_env is optional, and a missing file is skipped: an autologin is never refused over it.
The greeter runs as sddm, uid and gid 64, home /var/lib/sddm, shell /sbin/nologin: an account fs/etc/passwd, group and shadow carry rather than one a postinstall makes. Its id is fixed and below 101 because useradd -r, which every service account’s postinstall runs, hands out ids from 999 downwards, so a fixed id in that range could be one a tree that already holds those accounts has given to somebody else. kdos-dm makes /var/lib/sddm and hands it to the account at every start, since nothing else creates a system account’s home; SDDM keeps its state there (state.conf: the last user and session), and the greeter its own settings and the output configuration its KWin writes.