Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions install/login/sddm.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# Prevent password-based SDDM logins from creating an encrypted login keyring
# that conflicts with Omarchy's passwordless default keyring behavior. The ISO
# owns autologin/session state because it knows whether the target is encrypted.
if [[ -f /etc/pam.d/sddm ]]; then
sed -i '/-auth.*pam_gnome_keyring\.so/d' /etc/pam.d/sddm
sed -i '/-password.*pam_gnome_keyring\.so/d' /etc/pam.d/sddm
sddm_pam="${OMARCHY_SDDM_PAM:-/etc/pam.d/sddm}"
sddm_autologin_pam="${OMARCHY_SDDM_AUTOLOGIN_PAM:-/etc/pam.d/sddm-autologin}"

if [[ -f $sddm_pam ]]; then
sed -i '/-auth.*pam_gnome_keyring\.so/d' "$sddm_pam"
sed -i '/-password.*pam_gnome_keyring\.so/d' "$sddm_pam"
fi

# Autologin has no password for pam_gnome_keyring to unlock with. Its session
# auto_start can still block sddm-helper for ~30s after Plymouth quits, leaving
# a black screen before the Wayland session starts (#13414). Omarchy seeds a
# passwordless Default keyring from install/user/default-keyring.sh instead.
if [[ -f $sddm_autologin_pam ]]; then
sed -i '/pam_gnome_keyring\.so/d' "$sddm_autologin_pam"
fi
18 changes: 18 additions & 0 deletions migrations/1790544001.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
echo "Stop pam_gnome_keyring from blocking SDDM autologin"

# sddm-autologin ships `-session optional pam_gnome_keyring.so auto_start`. With
# no password available that step can stall ~30s after Plymouth, leaving a black
# screen before Hyprland starts (#13414). Fresh installs drop the line from
# install/login/sddm.sh; existing machines need the same edit once.

autologin_pam="${OMARCHY_SDDM_AUTOLOGIN_PAM:-/etc/pam.d/sddm-autologin}"

[[ -f $autologin_pam ]] || exit 0
grep -q 'pam_gnome_keyring\.so' "$autologin_pam" || exit 0

# Migrations run as the desktop user; /etc/pam.d is root-owned.
if [[ -w $autologin_pam ]]; then
sed -i '/pam_gnome_keyring\.so/d' "$autologin_pam"
else
sudo sed -i '/pam_gnome_keyring\.so/d' "$autologin_pam"
fi
67 changes: 67 additions & 0 deletions test/shell.d/sddm-keyring-pam-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash

set -euo pipefail

source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"

sddm_install="$ROOT/install/login/sddm.sh"
migration="$ROOT/migrations/1790544001.sh"

rg -q 'OMARCHY_SDDM_AUTOLOGIN_PAM' "$sddm_install" ||
fail "SDDM install script can target a test autologin PAM path"
rg -q "sed -i '/pam_gnome_keyring\\\\.so/d'" "$sddm_install" ||
fail "SDDM install script strips gnome-keyring from autologin PAM"
pass "SDDM install script strips gnome-keyring from autologin PAM"

tmp_dir=$(mktemp -d)
trap 'rm -rf "$tmp_dir"' EXIT

cat >"$tmp_dir/sddm" <<'EOF'
#%PAM-1.0
auth include system-login
-auth optional pam_gnome_keyring.so
-password optional pam_gnome_keyring.so use_authtok
session include system-login
EOF

cat >"$tmp_dir/sddm-autologin" <<'EOF'
#%PAM-1.0
auth required pam_permit.so
auth required pam_faillock.so authsucc
auth required pam_shells.so
auth required pam_nologin.so
auth required pam_env.so
session required pam_loginuid.so
session optional pam_keyinit.so force revoke
session required pam_limits.so
session required pam_unix.so
-session optional pam_gnome_keyring.so auto_start
session optional pam_umask.so
session optional pam_systemd.so
EOF

OMARCHY_SDDM_PAM="$tmp_dir/sddm" OMARCHY_SDDM_AUTOLOGIN_PAM="$tmp_dir/sddm-autologin" \
bash -c 'source '"$sddm_install"

grep -q 'pam_gnome_keyring\.so' "$tmp_dir/sddm" &&
fail "password SDDM PAM still references gnome-keyring auth/password" "$(cat "$tmp_dir/sddm")"
Comment on lines +46 to +47

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Successful removal fails the test. When the install script correctly removes the keyring lines, grep finds no match and returns a nonzero status. With set -e, this top-level grep && fail check exits the test before it reaches pass. The autologin and migration checks use the same pattern, so the new test fails on the behavior it is meant to verify. Use if checks for these expected no-match results.

grep -q 'pam_gnome_keyring\.so' "$tmp_dir/sddm-autologin" &&
fail "autologin PAM still starts gnome-keyring" "$(cat "$tmp_dir/sddm-autologin")"
pass "sourced SDDM install script clears gnome-keyring from both PAM files"

# Migration must clear an existing autologin line without touching other session modules.
cat >"$tmp_dir/sddm-autologin" <<'EOF'
session required pam_unix.so
-session optional pam_gnome_keyring.so auto_start
session optional pam_systemd.so
EOF

OMARCHY_SDDM_AUTOLOGIN_PAM="$tmp_dir/sddm-autologin" bash "$migration"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Privileged migration path is untested. This fixture is writable by the test user, so the migration takes the direct sed branch. On an existing installation, the root-owned PAM file takes the sudo sed branch instead. A regression in that production path could leave the autologin delay unfixed while this test passes. A controlled sudo stub would let the test cover that branch.

Knowledge Base Used: Migration framework

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!


grep -q 'pam_gnome_keyring\.so' "$tmp_dir/sddm-autologin" &&
fail "migration left gnome-keyring on autologin PAM" "$(cat "$tmp_dir/sddm-autologin")"
grep -qx 'session required pam_unix.so' "$tmp_dir/sddm-autologin" ||
fail "migration preserved unrelated PAM lines"
grep -qx 'session optional pam_systemd.so' "$tmp_dir/sddm-autologin" ||
fail "migration preserved systemd PAM line"
pass "autologin keyring migration drops only gnome-keyring"