Technical Deep Dive: KDE Plasma on OpenRC

Technical Deep Dive: KDE Plasma on OpenRC

KDE Plasma was designed for systemd. Running it on OpenRC requires understanding exactly which services need to be running, in what order, and why.

This guide covers the complete configuration and the solutions to every “Plasma won’t start” problem I’ve encountered.

The Service Dependency Chain

KDE Plasma requires these services, in this order:

1. dbus          (message bus - EVERYTHING depends on this)

2. elogind       (session management - replaces systemd-logind)

3. polkit        (privilege escalation - "enter password to...")

4. udisks        (disk management - Dolphin, device notifier)

5. upower        (power management - battery, suspend)

6. display-manager (SDDM - starts Plasma)

If ANY of these fail or start out of order, Plasma breaks in mysterious ways.

Essential Service Configuration

Enable All Required Services

# Core services (MUST be in default runlevel)
rc-update add dbus default
rc-update add elogind default
rc-update add polkit default

# Hardware services
rc-update add udisks default
rc-update add upower default

# Optional but recommended
rc-update add bluetooth default
rc-update add NetworkManager default

# Display manager (starts Plasma)
rc-update add display-manager default

Verify Services Are Running

rc-status default

# Should show all as "started":
# dbus           [  started  ]
# elogind        [  started  ]
# polkit         [  started  ]
# udisks         [  started  ]
# display-manager [  started  ]

The UDisks2 Crash: The #1 Plasma Killer

The Symptoms

  • Plasma starts but immediately hangs
  • Desktop loads but Dolphin crashes
  • Device notifications never appear
  • System becomes sluggish, eventually freezes

The Logs

journalctl -xe  # or check /var/log/messages

# You'll see:
kf.solid.backends.udisks2: Failed enumerating UDisks2 objects:
"org.freedesktop.DBus.Error.Spawn.ExecFailed"
"Failed to execute program org.freedesktop.UDisks2: Permission denied"

Why This Happens

KDE Solid (the hardware abstraction layer) polls UDisks2 constantly. On systemd, UDisks2 auto-starts via D-Bus activation. On OpenRC, you must start it manually.

Without UDisks2:

  1. Solid tries to query disk info
  2. Query fails
  3. Solid retries immediately
  4. Retry fails
  5. Repeat 1000x per second
  6. System grinds to a halt

The Fix

# Start it NOW
rc-service udisks start

# Make it permanent
rc-update add udisks default

# Verify
rc-service udisks status

The SDDM Login Loop

The Symptoms

  1. SDDM appears (so X11/Wayland works)
  2. Enter username and password
  3. Screen goes black
  4. Cursor appears momentarily
  5. SDDM reappears (back to login)

Debugging

Switch to a TTY (Ctrl+Alt+F2) and check logs:

# SDDM's log
cat /var/log/sddm.log

# Look for:
# Auth: sddm-helper exited with 1

# Check elogind
cat /var/log/elogind.log

Common Causes

Cause 1: elogind not running

rc-service elogind status
# If stopped:
rc-service elogind start

Cause 2: dbus restarted but elogind wasn’t

After emerge dbus, the running dbus daemon is outdated. Elogind tries to talk new protocol to old daemon.

# Fix: restart both in order
rc-service elogind stop
rc-service dbus restart
rc-service elogind start

Cause 3: Polkit authentication failure

rc-service polkit status
# If stopped:
rc-service polkit start

Cause 4: Wrong session type

Check ~/.xinitrc or SDDM session configuration:

# For Plasma Wayland
/usr/bin/startplasma-wayland

# For Plasma X11
/usr/bin/startplasma-x11

Display Manager Configuration

SDDM Setup

# Install SDDM
emerge x11-misc/sddm

# Set as display manager
echo 'DISPLAYMANAGER="sddm"' > /etc/conf.d/display-manager

# Enable
rc-update add display-manager default

SDDM Theme Configuration

# /etc/sddm.conf
[Theme]
Current=breeze

[Users]
MaximumUid=65000
MinimumUid=1000

[Wayland]
SessionDir=/usr/share/wayland-sessions

[X11]
SessionDir=/usr/share/xsessions

Elogind: The systemd-logind Replacement

Elogind provides:

  • Session tracking (who’s logged in where)
  • Seat management (which user owns which display)
  • Power management hooks (suspend, hibernate)

Configuration

# /etc/elogind/logind.conf
[Login]
HandlePowerKey=suspend
HandleLidSwitch=suspend
HandleLidSwitchDocked=ignore
IdleAction=ignore

Verify Session

# Check your session
loginctl list-sessions

# Should show something like:
# SESSION  UID USER SEAT  TTY
#       1 1000 commander seat0 tty7

# Detailed info
loginctl show-session 1

Polkit Rules for Desktop Use

Polkit controls “can this user do this privileged action?”

Allow Wheel Group to Manage System

// /etc/polkit-1/rules.d/50-wheel.rules
polkit.addRule(function(action, subject) {
    if (subject.isInGroup("wheel")) {
        return polkit.Result.YES;
    }
});

Allow Users to Manage NetworkManager

// /etc/polkit-1/rules.d/50-networkmanager.rules
polkit.addRule(function(action, subject) {
    if (action.id.indexOf("org.freedesktop.NetworkManager") == 0 &&
        subject.isInGroup("users")) {
        return polkit.Result.YES;
    }
});

Complete Recovery Procedure

If Plasma is completely broken:

# 1. Switch to TTY
Ctrl+Alt+F2

# 2. Login as root

# 3. Stop display manager
rc-service display-manager stop

# 4. Restart all services in order
rc-service dbus restart
sleep 2
rc-service elogind restart
sleep 2
rc-service polkit restart
rc-service udisks restart
rc-service upower restart

# 5. Start display manager
rc-service display-manager start

# 6. Switch back to graphical
Ctrl+Alt+F7

The Nuclear Option: Service Reset

If nothing works:

# Remove from runlevel
rc-update del display-manager default
rc-update del elogind default
rc-update del polkit default
rc-update del udisks default

# Reboot to clean state
reboot

# Re-add in correct order
rc-update add dbus default
rc-update add elogind default
rc-update add polkit default
rc-update add udisks default
rc-update add display-manager default

# Reboot again
reboot

KDE Plasma on OpenRC is absolutely stable once configured correctly. The key is understanding that every service systemd would auto-start must be explicitly enabled and ordered on OpenRC.