Skip to content

Sync root when updating the user password from the menu - #13215

Open
chessing234 wants to merge 6 commits into
omacom:quattrofrom
chessing234:fix/7539-user-root-password-sync
Open

chessing234 wants to merge 6 commits into
omacom:quattrofrom
chessing234:fix/7539-user-root-password-sync

Conversation

@chessing234

@chessing234 chessing234 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Replace the menu's bare passwd with omarchy-user-password, which sets the same new passphrase on the login user and on root (matching install).

Fixes #7539

Test plan

  • bash test/shell.d/user-password-test.sh

@llstrk

llstrk commented Sep 25, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Verified: on a default Omarchy install, the change does what it describes. After two matching, non-empty prompts, omarchy-user-password sends one user:password line and one root:password line to sudo chpasswd, the same mechanism first-boot provisioning uses (bin/omarchy-provision-owner). chpasswd goes through the same Arch system-auth password stack (pam_unix) as passwd. Colons, quotes, $, backslashes, glob characters, non-ASCII text and trailing spaces reach chpasswd unchanged, and gum input turns pasted newlines into spaces, so a password cannot add an extra chpasswd line. Empty input, a mismatch, cancelling and a sudo failure all exit with status 1 without changing a password. The new test passes on the PR head, fails against the base files, and catches three deliberate breakages (an unquoted comparison, a user-only chpasswd line, and the menu pointing back to passwd).

Two behavior changes affect setups other than the default single owner:

The menu row now always changes root, including a locked or unset root

chpasswd replaces root's shadow hash whatever its current state. A root locked with passwd -l root (!hash), or one that was never given a password (*), gets a working password equal to the user's new one. The old locked hash is not kept. Two paths reach this state:

  • An unattended install whose credentials file has no root_enc_password leaves root at *. manual/51-unattended-installs.md does not ask for that key.
  • An administrator can deliberately lock root after installing.

Impact: using the password menu silently re-enables password login for root (su, TTY) where it had been disabled on purpose, and a separately chosen root password is overwritten.

Accounts without sudo rights can no longer change their own password from the menu

                        before: passwd                  after: omarchy-user-password
authorizes with         current password (PAM)          sudo
non-wheel account       changes own password            sudo refuses, window shows "Failed"
root password           untouched                       set to the new password

passwd is setuid root and lets any local account change its own password. The new flow needs sudo, which Omarchy grants through the wheel group. The provisioned owner is always in wheel, so default installs are unaffected. A standard account added later is not.

Impact: a non-admin user loses the only password option in the menu, after typing the new password twice.

Suggested change (covers both): keep a user-only path next to the combined one. For example, run plain passwd when the caller is not in wheel, or keep a separate "User" row. Before also changing root, check whether it is locked or unset (passwd -S root) and either skip it or ask with gum confirm.

Smaller notes

  • Documentation: manual/48-security.md still says to pick the User row and describes only two passwords. Suggested change: name the "User and root" row and say that it sets both.
  • CLI help: the new user command prefix has no GROUP_DESCRIPTIONS entry in bin/omarchy, so omarchy leaves it out of the top-level listing and omarchy user --help shows a bare title. docs/cli-router.md asks for this entry when adding a browsable group. Suggested change: add a one-line GROUP_DESCRIPTIONS[user] entry.
  • Cancel: || exit 1 after each gum input turns Ctrl+C's exit status 130 into 1. The floating-terminal launcher closes quietly only on 130, so a cancelled change now shows "Failed". The previous passwd action closed quietly. Suggested change: || exit $?.

Review information

Test scope: source review of the PR and of the dependencies it relies on, at the versions Arch currently packages: shadow 4.20.0 (chpasswd, passwd), linux-pam 1.7.2 (pam_unix), sudo 1.9.17p2 and gum 2.0.2. The omarchy-iso installer was also read. The PR's test, three deliberately broken copies of the change, and scripted input scenarios ran in an isolated sandbox with stubbed gum, sudo and id. No real sudo, chpasswd, PAM or account change was run. The non-wheel and locked or unset root behavior comes from source and configuration, not from a live system. The relabeled menu row was not checked on a running desktop.

AI process: Opus 5.5 Medium coordination and synthesis, independent Opus 5.5 Xhigh and GPT 6 Sol Xhigh technical assessments, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

@chessing234

Copy link
Copy Markdown
Contributor Author

non-wheel falls back to passwd, locked root asks before syncing, cancel keeps 130, and the user group is listed

@llstrk

llstrk commented Sep 27, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Follow-up to the earlier review and the author's reply, checked at 33f35319.

Outcome: four of the five earlier findings are resolved. The new locked-root check, however, stops the password change for every account in wheel, which includes the owner on every default install. That part traces back to the earlier review's own suggestion, corrected below.

Earlier finding Status at 33f35319
Menu row always changes root, even when locked or unset Not fixed: the new check fails, so the row now stops before changing anything (see below)
Non-wheel accounts lose the menu password option Resolved
manual/48-security.md named the old User row Resolved
user group missing from CLI help Resolved
Ctrl+C at a gum input prompt shows "Failed" Resolved

Verified: a non-wheel account now reaches plain passwd before any prompt, and exec passes its exit status through, including 130. The top-level omarchy listing now includes the user group with its description, and omarchy user --help shows the description. Both gum input prompts use || exit $?, so Ctrl+C exits 130 and the launcher closes quietly. The manual names the User and root row.

The locked-root check makes the menu row fail for every wheel user

Correction to the earlier review: its suggested change said to check root with passwd -S root but did not say that this needs root. As a normal user it cannot work.

bin/omarchy-user-password:24 runs passwd -S root as the logged-in user. The menu starts the script without elevation, and omarchy:requires-sudo is metadata only. shadow 4.20.0 refuses to show another account's status to a non-root caller (src/passwd.c:1011-1025, exit status 1). Under set -euo pipefail that failure ends the script:

wheel user, current head
  gum input × 2               passwords entered and match
  passwd -S root              exit 1  (stderr sent to /dev/null)
  root_status=$(... | awk)    pipefail → assignment fails → errexit
  script                      exit 1 → window shows "Failed (exit code 1)"
  sudo chpasswd               never reached

The confirm prompt never appears, and neither password changes. The earlier head and the base both changed the password.

Impact: on a default install, the User and root row asks for the new password twice and then fails with no explanation. If the error is simply tolerated instead (for example || true), root_status is empty and root is always overwritten again, which is the original problem.

Suggested change: read the status through sudo, and let errors show:

root_status=$(sudo passwd -S root | awk '{print $2}')

The sudo passwd -S root line was tried in a sandbox with stubbed sudo, passwd and chpasswd. With it, a normal root syncs both accounts without a prompt, a locked root asks first, and a sudo failure exits 1 with nothing changed.

Ctrl+C at the new root confirmation still changes the user's password

Once the check above works, a locked (L) or empty (NP) root shows gum confirm. gum 2.0.2 exits 130 on Ctrl+C, and the else branch at :28-29 treats that as "No", so the script continues and sends the user-only line to sudo chpasswd.

Impact: cancelling at this prompt changes the login password instead of cancelling.

Suggested change: in the else branch, status=$?; (( status == 130 )) && exit 130; sync_root=0. In the same stubbed sandbox this exits 130 with no chpasswd call, while Esc and "No" still update the user only.

Smaller notes

  • Empty root password (NP): shadow reports NP for an empty hash. Arch's system-auth uses pam_unix nullok, so such a root can log in at a console with an empty password, the opposite of "no usable password". The prompt then defaults to leaving it that way. No Omarchy install path creates this state. Suggested change: confirm only for L, or reword the prompt for NP.
  • Optional test improvement: the test's passwd stub answers -S root for any caller, and its sudo stub never runs the command. So the test passes on this head, fails as soon as the stub refuses -S root like shadow does, and also fails against the sudo passwd -S root fix above. Suggested change: have the sudo stub run passwd, make the passwd stub refuse -S root unless reached through sudo, and add Ctrl+C-at-confirm (expect 130, no chpasswd).
  • Label: the row and the manual say User and root, but non-wheel accounts and a declined confirmation change only the user's password. A short mention in manual/48-security.md would cover it.
  • Related open PR: Sync the GNOME keyring on user password changes #9239 also adds bin/omarchy-user-password and test/shell.d/user-password-test.sh and points the same menu row at it, with a different approach (plain passwd plus GNOME keyring sync). Whichever lands second needs to reconcile the two.

Review information

Test scope: source review of the new commit and the dependencies it relies on, at the versions Arch currently packages: shadow 4.20.0 (passwd, chpasswd), linux-pam 1.7.2, pambase and gum 2.0.2. The PR's test, variants of it, the suggested changes and scripted scenarios ran in an isolated sandbox with stubbed gum, id, passwd, sudo and chpasswd. The passwd -S refusal and the gum exit codes are modelled from source. No real sudo, passwd, chpasswd, PAM or account change was run, and the menu flow was not run on a desktop.

AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Critical impact] The change reaches root password authentication through the password menu.

Satisfy the indentation requirement before merging; no new behavior defect was found in the latest changes.

Findings

  1. P2 Administrator block lacks indentation ▶

Summary

The password menu now updates the login and root passwords together, with safeguards for non-administrators and locked or empty root passwords.

  • The password menu can update the login account and root together.

Reviews (5) · Last reviewed commit: "fix: drop the redundant password example..." · Reviewed by Greptile

@chessing234

Copy link
Copy Markdown
Contributor Author

fixed in 86b141d: root status is read through sudo, cancellation and prompt errors abort without changing either password, and the empty-root prompt now describes its actual state. eight stubbed checks pass, including denied status reads and cancellation; the native pam and desktop flow has not been run.

@jandrusk

jandrusk commented Oct 8, 2026

Copy link
Copy Markdown

FYI, #14556 (on the omabot/pr-13362 branch) offers to change the login and root passwords together as part of the disk-password flow. It overlaps with how root gets synced here, so it may be worth aligning both on one helper.

Small nit: user="${USER:-$(id -un)}" trusts $USER from the environment to decide whose password sudo chpasswd sets. Using user=$(id -un) avoids that.

@omarchybot

Copy link
Copy Markdown
Collaborator

I read this at 86b141d3 against quattro, along with #7539. I haven't run it on a worker yet, because the two reviewers don't agree on what kind of change it is.

The classification is unsettled. I (Opus 5.5) read it as a bug fix. Setup gives root the same password as the login user (bin/omarchy-provision-owner, the chpasswd call right after the user's). But Update > Password > User runs passwd alone, so after a change the old password still works for su and a TTY root login, which is what #7539 reports. Codex Medium was asked separately, without my answer. It read the change as an enhancement: having the menu change root as well is new behaviour, not a repair of something broken. I haven't added a bug or enhancement label, and the maintainer decides which it is before it goes further.

Two things will matter whichever way that goes:

  • Merge conflict. The branch conflicts with quattro in manual/48-security.md, where the Changing your passwords paragraph was rewritten on quattro after this branch was cut.
  • Overlapping pull requests. Sync the GNOME keyring on user password changes #9239 also adds bin/omarchy-user-password and test/shell.d/user-password-test.sh and points the same menu row at it. It does something different: it syncs the GNOME keyring instead of root. Whichever lands second has to merge the two scripts. Offer to change the login and root passwords with the system disk's #14556 offers to set the login and root passwords together from the drive-password flow, so the root sync may be worth sharing between the two.

This now waits on the maintainer's call on the classification.

Install sets both accounts to the same passphrase; the menu used to run
passwd alone and leave the old root password live for su and TTY login.
@chessing234
chessing234 force-pushed the fix/7539-user-root-password-sync branch from 86b141d to 5c461c8 Compare October 18, 2026 16:25
@omarchybot

Copy link
Copy Markdown
Collaborator

I read this again at 5c461c80 against quattro, since the branch moved. The change itself is the same as at 86b141d3: it was rebased onto current quattro, so the conflict in manual/48-security.md is gone and it merges cleanly now. I still haven't run it on a worker.

The classification is still unsettled. I (Opus 5.5) asked again on the new head and read it as a bug fix, for the same reason as before: setup gives root the user's password, and Update > Password > User runs passwd alone, leaving the old root password working for su and a TTY login (#7539). Codex Medium, asked separately without my answer, again read it as an enhancement. No bug or enhancement label goes on until that is settled.

CI's i18n-check fails on this head, and it will need fixing whichever way the classification goes. The menu row's label changed to "User and root" in default/omarchy/omarchy-menu.jsonc, but the English catalog in default/i18n/en/menu.json still has the old entry for update.password.user, so test/shell.d/i18n-test.sh reports not ok - English menu catalog mirrors the menu definition for that id. Updating the English catalog entry to match the new label should clear it.

The overlaps from last time still apply: #9239 adds the same bin/omarchy-user-password and test file names for a keyring sync, and #14556 sets login and root together from the drive-password flow.

This waits on the maintainer's call on the classification.

Comment thread bin/omarchy-user-password Resolved
Comment thread test/shell.d/user-password-test.sh Resolved
Comment thread bin/omarchy-user-password Resolved
@omarchybot omarchybot added the enhancement New feature or request label Nov 18, 2026
the command takes no arguments, and the wheel path is now an else instead of exec.
Comment thread bin/omarchy-user-password
# Non-wheel accounts cannot sudo chpasswd; keep the old user-only passwd path.
if ! id -nG "$user" | grep -qw wheel; then
passwd
else

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 Administrator block lacks indentation. The new else leaves its entire body at the outer level. AGENTS.md requires two spaces for indentation. Indent lines 14–45 by two more spaces so the administrator-only path and its nested branches are clear.

File Used: AGENTS.md (source)

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!

@omarchybot omarchybot removed the enhancement New feature or request label Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User password update in menu leaves old root password active

4 participants