Repository navigation
Do not block SDDM autologin on pam_gnome_keyring #13625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: quattro
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| 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 |
| 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")" | ||
| 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" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grepfinds no match and returns a nonzero status. Withset -e, this top-levelgrep && failcheck exits the test before it reachespass. The autologin and migration checks use the same pattern, so the new test fails on the behavior it is meant to verify. Useifchecks for these expected no-match results.