407. Login and autologin
You reach the desktop through SDDM, the display manager: the program that shows the login screen (its greeter) and starts your session once you have logged in. The greeter runs on its own copy of KWin on the first console, tty1. This page is for anyone who wants the machine to log in by itself or stop doing so, or whose login does not reach the desktop. It covers which programs make it up, the files that decide whether the machine shows the greeter or logs somebody in by itself, how to turn autologin on and off, the recovery console on tty2, the serial console, and what to do when a login does not reach the desktop. What happens after the login is on Session and environment.
Installation
Every image has the login path; nothing on it is optional:
| Piece | From | What it does |
|---|---|---|
/usr/local/sbin/kdos-dm |
the base filesystem | Started on tty1 by /etc/inittab; makes the greeter account’s home, takes the locale from /etc/locale.conf and runs sddm. When SDDM is missing or exits three times within a minute it puts a password prompt on tty1 instead, never an autologin |
sddm, sddm-helper, sddm-greeter-qt6 |
sddm | The display manager, the helper that opens each PAM session, and the greeter, run as the sddm account (uid 64) on kwin_wayland |
| The KDOS greeter theme | kdos-sddm-theme | The theme kdos, matched to the splash and the lock screen |
| The Login Screen page | sddm-kcm | System Settings → Login Screen (SDDM): the theme, autologin and the session’s defaults |
PAM’s system-login stack and /bin/login |
pam, util-linux-login | Every login is a PAM login: pam_turnstile makes the runtime directory and starts the user’s services, pam_elogind registers the session |
pam_kwallet5 |
kwallet-pam | Opens the user’s wallet with the password typed at the greeter |
kdos-getty |
kdos-tools | Wraps agetty on tty2: loads the console font and palette, then hands over |
| plasma-setup | The first-boot wizard of an OEM install, which logs in as its own account to make the first real one |
The live medium logs the kdos account in by itself; an installed machine shows the greeter unless the install asked for autologin.
Configuration
/etc/inittab
The two console lines:
# Local Console (QEMU Window / Physical) — the display manager.
#
# kdos-dm execs SDDM, whose greeter compositor takes tty1. It is started here
# and never from rcS: init reaches this line only once rcS has returned, and the
# splash stops drawing synchronously at its end (`kdos-splash handoff`), its
# settled frame left on screen for the compositor's first frame to replace, so
# the compositor's modeset never races the splash for the DRM master.
#
# A MISSING OR FAILING SDDM STILL GIVES A CONSOLE. sddm stays up across every
# login and logout, so a respawn here is sddm having exited; kdos-dm turns a
# missing binary, a missing account or three exits in a minute into a password
# prompt on tty1 through kdos-getty, never an autologin. Autologin is SDDM's
# alone, in /etc/sddm.conf.d/kde_settings.conf.
1:2345:respawn:/usr/local/sbin/kdos-dm
# Second console, a login prompt for any account. THE RECOVERY CONSOLE: it
# is a plain agetty with no --autologin, and nothing above may be allowed to
# make it one too, because it is what is left when the desktop on tty1 does
# not come up — a greeter SDDM keeps restarting included, which no respawn
# here ever sees. kdos-getty loads the console font and palette after fbcon's
# deferred take-over; doing that in rcS is futile, because the take-over resets
# every VT's font. agetty hands the name to /bin/login, util-linux's PAM login
# (/etc/pam.d/login, through system-login), so a console login is a session
# elogind knows and starts the user's services like any other.
#
# EVERY AGETTY HERE NAMES /etc/issue. agetty built against musl, which has no
# scandirat(), reads no issue file of its own accord, and without
# --issue-file the banner /etc/issue holds is never printed.
2:2345:respawn:/usr/local/sbin/kdos-getty tty2 /sbin/agetty --noclear --issue-file /etc/issue tty2 38400 linux
kdos-dm is started only once rcS has returned, and the splash stops drawing synchronously at the end of rcS, leaving its settled frame on screen for the greeter’s compositor to replace with its first one, so the compositor never races the boot splash for the display. SDDM’s log is /var/log/sddm.log, one boot per file, with the previous boot’s in /var/log/sddm.log.old.
/etc/sddm.conf.d/
SDDM reads /usr/lib/sddm/sddm.conf.d/ first, then this directory in name order, then /etc/sddm.conf, each key’s last value winning. 00-kdos.conf is KDOS’s: a Wayland greeter, the KDOS session wrapper and no X sessions (see Session and environment), the accounts from uid 1000 up, and the theme, from fs/etc/sddm.conf.d/00-kdos.conf:
[Users]
MinimumUid=1000
MaximumUid=60000
RememberLastUser=true
RememberLastSession=true
[Theme]
# The KDOS theme, matched to the splash and the lock screen. Accounts' pictures
# need no key: SDDM reads /var/lib/AccountsService/icons/<user> itself.
Current=kdos
CursorTheme=breeze_cursors
CursorSize=24
Font=Noto Sans,10
fs/etc/sddm.conf.d/00-kdos.conf, lines 65–78
kde_settings.conf is the one home of [Autologin]. The installer writes it, the Login Screen page of System Settings writes it, and it overrides 00-kdos.conf. The image ships the live medium’s, from fs/etc/sddm.conf.d/kde_settings.conf:
[Autologin]
Relogin=true
Session=plasma
User=kdos
fs/etc/sddm.conf.d/kde_settings.conf
Relogin=true logs the account in again when its session ends; Switch User still shows a greeter, on a free virtual terminal, through sddm’s sddm-switch-user-greeter.patch. An install replaces the file:
- on a single-account machine with an encrypted root that asked for autologin, with the new account’s
[Autologin]andRelogin=false; - everywhere else, with no
[Autologin]group, so the machine shows the greeter.
The PAM stacks
sddm installs three stacks of its own, from ports/core/auth/sddm/build.sh:
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
ports/core/auth/sddm/build.sh, lines 40–74
sddm is a password login and sddm-autologin one with no password, refused for any uid under 1000 except the OEM wizard’s plasma-setup. sddm-greeter is the greeter’s own session; pam_turnstile is required there because the greeter’s KWin will not start without a runtime directory. Both user stacks include system-login, from ports/core/auth/pam/build.sh, which /bin/login on the consoles uses as well:
cat > $PKG/etc/pam.d/system-login << "EOF"
# Begin /etc/pam.d/system-login
auth include system-auth
account include system-account
password include system-password
session include system-session
-session optional pam_turnstile.so
-session optional pam_elogind.so
# End /etc/pam.d/system-login
EOF
ports/core/auth/pam/build.sh, lines 65–74
An autologin can start locked. sddm-autologin puts /etc/kdos/autologin-xdg first in XDG_CONFIG_DIRS for an automatic login and for nothing else. The image ships no such directory. The installer makes it on the encrypted single-account machine that asked for autologin, with a kscreenlockerrc of [Daemon] LockOnStart=true, so the session comes up behind the lock screen and the disk passphrase alone does not open the desktop. Answering the installer’s “no password after the disk passphrase” leaves the directory out.
Other files
| File | Holds |
|---|---|
/var/lib/sddm/ |
The greeter account’s home: the last user and session, the greeter’s output settings, and its look in the machine’s accent (.config/kdeglobals, plasmarc, kcminputrc and kdos-background.png). The image ships it with the default accent’s look; kdos-dm makes it at every start when it is missing |
/etc/locale.conf |
The language the greeter speaks; see Locale and console |
/etc/kdos/xkb.conf |
The greeter’s keyboard layout, read by its KWin through locale1 |
/var/lib/AccountsService/icons/<user> |
An account’s picture on the greeter, set on the Users page |
/etc/plasma-setup-done |
Present on every machine whose install made an account; its absence arms the first-boot wizard |
Usage
Turning autologin on or off
- System Settings → Login Screen (SDDM) → Behavior.
- Tick Automatically log in, pick the account and Plasma (Wayland) as the session, or untick it. Leave Log in again immediately after logging off unticked on a machine somebody leaves.
- Apply. The page asks for an administrator’s password and writes
/etc/sddm.conf.d/kde_settings.conf. The change applies at the next boot, or the next time SDDM starts.
From a shell, edit /etc/sddm.conf.d/kde_settings.conf as root: an [Autologin] group with User=<account> and Session=plasma logs that account in; no group shows the greeter.
Choosing autologin when installing
The installer offers autologin only on a single-account install with an encrypted root, where the disk passphrase stands in front of the desktop. See 6. Accounts in the installation guide.
Logging in on the recovery console
tty2 is a plain login prompt with no autologin, kept as the way in when the desktop on tty1 does not come up.
- Press
Ctrl+Alt+F2from the desktop or the greeter, orAlt+F2at a text console. - Log in as your own account, or as
rootif root has a password. - Go back to the desktop with
Ctrl+Alt+F1.
A login on tty2 starts no desktop. It is an elogind session like any other, so it starts the user’s services when they are not already running, and it reaches a running desktop session’s bus (see Session and environment).
Logging in on the serial console
- Connect to the machine’s first serial port,
ttyS0. TheS0line givesagettythe rates 115200, 38400 and 9600. - On the live medium you get a root shell with no password. On an installed system you get a login prompt: the installer removes
--autologin rootfrom the installed copy ofinittab.
serial-getty sleeps instead of starting agetty when no UART answers at ttyS0, so a machine without a serial port does not respawn a failing getty.
Adding an account that can log in
System Settings → Users adds an account, its password, its picture and whether it is an administrator, through AccountsService. From a shell, use shadow’s tools, as Users and groups shows:
sudo useradd -m -G wheel,audio,video,render,input -s /bin/bash alice
sudo passwd alice
The account is offered on the greeter at once: SDDM lists every account from uid 1000 to 60000.
Single-user mode
On an installed system, boot the menu’s KDOS <version> (single user) entry, or run sudo telinit S on a running machine. The live medium’s menu has no single-user entry. sulogin asks for root’s password. On an installed system root’s password is locked unless one was set in the installer, and sulogin gives no shell to a locked root; set a password first with sudo passwd root. The rules are in Single-user and emergency mode.
Tips
sudo kdos doctorreports, in its Security section, whether thekdosaccount still has the shipped passwordkdos. The section appears only when/etc/shadowis readable, so run it withsudo.loginctl list-sessionslists every session elogind knows, the greeter’s included, and which one is active;who,wandlastread the recordsutmpdandwtmpdkeep.- The login banner on a console is
kdos-banner, run from/etc/bash.bashrc;KDOS_NO_ANIM=1prints it without animation. See The login banner.
Troubleshooting
tty1 shows a text password prompt instead of the greeter. kdos-dm fell back: SDDM is not executable, there is no sddm account, or SDDM exited three times within a minute. Log in there or on tty2 and read why:
sudo grep kdos-dm /var/log/messages
sudo tail -40 /var/log/sddm.log
Logging out of the prompt starts kdos-dm again, which tries SDDM once the minute is past.
The screen stays black after the splash, and tty2 answers. SDDM is running and its greeter is not drawing; SDDM restarts a failing greeter itself, which kdos-dm cannot see. Read /var/log/sddm.log for the greeter’s errors. A greeter’s KWin with no runtime directory, or one refused the display, says so there; loginctl list-sessions should show a session of the sddm user on seat0.
The greeter comes back after the password. The password was accepted and the session did not start. The reason is in ~/.local/share/sddm/wayland-session.log; see Session and environment.
The machine logs in by itself although autologin was turned off. Another file in /etc/sddm.conf.d/ or /etc/sddm.conf carries an [Autologin] group, and a later one wins: grep -rn -A3 Autologin /etc/sddm.conf.d /etc/sddm.conf.
The wallet asks for a password after an autologin. pam_kwallet5 opens the wallet with the password typed at the greeter, and an autologin types none. Give the wallet an empty password in KWalletManager, or log in with a password.
Known gaps
- The login screen runs on a Wayland greeter upstream calls experimental
- A login that typed no password leaves the wallet locked
- The screen reader at the login screen has no sound
- A greeter that keeps failing is not seen by
kdos-dm - Without automatic login, a desktop that breaks only after a login is not rolled back
See also
- The session: what happens from the greeter to the desktop
- The console:
tty2and the text consoles - Session and environment, Screen lock, Users and groups, sudo, PAM and polkit