Display Managers and Session Management
Display Managers and Session Management
A graphical desktop session requires authenticating user credentials, initializing PAM policies, setting up environment variables, and establishing a graphical seat.
+-----------------------------------------------------------+
| Graphical Session Launch Chain |
| |
| 1. Init System (PID 1) |
| | |
| v (Starts display-manager.service) |
| 2. Display Manager (GDM, LightDM, SDDM, or greetd) |
| - Allocates virtual console (e.g. tty7) |
| - Prompts user for username and password |
| - Authenticates credentials via Linux PAM (/etc/pam.d) |
| | |
| v (Launches session script) |
| 3. Session Manager (systemd-logind or seatd) |
| - Grants ACL permissions on /dev/dri/card0, /dev/input |
| - Sets up XDG_RUNTIME_DIR (/run/user/$UID) |
| | |
| v |
| 4. Compositor / Desktop Session (sway, GNOME, Plasma) |
+-----------------------------------------------------------+
Leading Display Managers
- GDM (GNOME Display Manager): The standard for GNOME. Runs completely under Wayland out of the box with multi-seat and biometric authentication support.
- SDDM (Simple Desktop Display Manager): The preferred display manager for KDE Plasma. Configurable via QML markup.
- LightDM: A modular, cross-desktop display manager popular in XFCE and lightweight distributions.
- greetd: A minimalist, terminal and Wayland-native greeting daemon written in Rust. Extremely lightweight and ideal for custom tiling window managers or musl-based distributions.
The Role of logind and seatd
Historically, Xorg ran with full root privileges so it could access raw video memory (/dev/mem) and input devices (/dev/input/event*).
In modern distributions, running a display server as root is unacceptable from a security standpoint. Unprivileged display servers rely on a seat manager: - systemd-logind: Automatically adjusts filesystem ACLs on GPU and input device nodes when a user logs in, revoking them when switching virtual consoles (Ctrl+Alt+F1). - seatd: An ultra-lightweight, independent seat management daemon created by the Sway/wlroots community for distributions that do not run systemd.
The Standard Session Manifest (.desktop)
Display managers discover available desktop sessions by reading .desktop files in /usr/share/wayland-sessions/ and /usr/share/xsessions/:
# /usr/share/wayland-sessions/sway.desktop
[Desktop Entry]
Name=Sway
Comment=An i3-compatible Wayland compositor
Exec=sway
Type=Application
DesktopNames=sway