Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
7a04358
Log the update transcript to a per-user path
AnPod Oct 16, 2026
8a54bac
Add omarchy user list
osbase77 Oct 11, 2026
21701de
Add omarchy user add, remove and admin
osbase77 Oct 12, 2026
a7d4f3e
Refuse to run omarchy user add, remove and admin as root
osbase77 Oct 12, 2026
2658030
Switch to multi-user when the second account is added, and back
osbase77 Oct 12, 2026
6655291
Log the removal before switching back to one user, and say what changed
osbase77 Oct 12, 2026
29fb100
Let omarchy-drive-password take the system disk's passwords on stdin
osbase77 Oct 13, 2026
9057175
Ask for each password once when switching between one and more users
osbase77 Oct 13, 2026
21fe575
Ask for the current disk password, not the one everyone uses
osbase77 Oct 13, 2026
c62c1f3
Ask who is logging in when there is more than one account
osbase77 Oct 14, 2026
0915cc3
Tab cycles between the name and password boxes
osbase77 Oct 14, 2026
8c7a10d
Add omarchy-sudo-allowed: is this account an administrator
osbase77 Oct 14, 2026
309fee0
Updates: tell accounts that aren't administrators up front
osbase77 Oct 14, 2026
ddc6d91
Packages: say an administrator installs and removes software
osbase77 Oct 14, 2026
7293156
Browser theme color: leave the machine-wide policy to administrators
osbase77 Oct 14, 2026
507afba
Ask the account prompts in the current language
osbase77 Oct 20, 2026
b876c1d
Switch back to one account before removing the other
osbase77 Oct 20, 2026
21bdd36
Don't offer a last user who no longer exists
osbase77 Oct 20, 2026
4fef8af
Let omarchy user list take its definitions from the shared helper
osbase77 Oct 20, 2026
1e9d507
Account commands: stop before sudo, bound the password tries, refuse …
osbase77 Oct 20, 2026
5732bdf
Login screen: the name box on request
osbase77 Oct 20, 2026
cb14e54
Account commands: the account first, every question first, one change…
osbase77 Oct 20, 2026
ad88c6e
Login screen: a name reached from the password box is selected
osbase77 Oct 20, 2026
20f5c12
Account commands: the switch first again, and a lock only root can hold
osbase77 Oct 20, 2026
1d29ac8
Say when an earlier disk password change must be finished first
osbase77 Oct 20, 2026
cde56d4
Say that the login screen asks for a user name
osbase77 Oct 20, 2026
44af4ea
Point the removal at omarchy-drive-password too, when a change is pen…
osbase77 Oct 20, 2026
8b89dfa
Time zone: tell a limited user it takes an administrator
osbase77 Oct 21, 2026
65942ae
Treat a cryptsetup error as no answer, not a wrong disk password
osbase77 Oct 21, 2026
64b60f1
Stop the account switches while a disk password change is unfinished
osbase77 Oct 21, 2026
2308643
Read user admin's arguments by position, so on and off can be names
osbase77 Oct 21, 2026
d023f2f
Start the account and user list tests the way the test contract says
osbase77 Oct 21, 2026
9e7df96
Drop omarchy-sudo-allowed's example: it takes no arguments
osbase77 Oct 21, 2026
a8ca6ef
Write the new two-path flows as full if/else, and numbers in (( ))
osbase77 Oct 21, 2026
8f548a5
Document the update's administrator check and drive-password's script…
osbase77 Oct 21, 2026
03f1d29
Drop an account's sudo grants before the account, or its wheel member…
osbase77 Oct 21, 2026
5f0968b
Never trace omarchy-user-remove: it holds two passwords
osbase77 Oct 21, 2026
7a128b5
Write the wheel rule for --admin after the switch's questions
osbase77 Oct 21, 2026
345b15a
Count (root : root) and (ALL : ALL) rules as full sudo
osbase77 Oct 21, 2026
37a56ab
Ask every login account whether its disk password change finished
osbase77 Oct 21, 2026
ed0ef0e
Tell a limited user the package pickers take an administrator
osbase77 Oct 21, 2026
a5f7d75
Don't tell the administrator to finish someone else's disk password c…
osbase77 Oct 21, 2026
f89cd91
Say in the file layout notes that every account's record is asked
osbase77 Oct 21, 2026
50d148a
Stop a removal or demotion when its sudo grants can't be removed
osbase77 Oct 21, 2026
d5f9c29
Check for an unfinished disk password change before every removal
osbase77 Oct 21, 2026
09138ca
Decide user admin on the account as it is under the lock
osbase77 Oct 21, 2026
a6235c9
Clip the login screen's name box
osbase77 Oct 21, 2026
3852cae
Warn when a demoted account is still in the docker group
osbase77 Oct 21, 2026
3cbd1f4
Answer --system-pending without taking the lock or writing state
osbase77 Oct 21, 2026
c68e820
Never give an account the disk password as its own
osbase77 Oct 21, 2026
3de02fd
Count only open sessions as signed in, in user list
osbase77 Oct 21, 2026
342ca22
Refuse an add when the system disk can't be told
osbase77 Oct 21, 2026
2b712ff
Refuse a removal when the system disk can't be told
osbase77 Oct 21, 2026
8edeebd
Ask only administrators about an unfinished disk password change
osbase77 Oct 21, 2026
32dc4a9
Let a limited account's migrations leave sudo steps to an administrator
osbase77 Oct 21, 2026
d1f98c7
Don't skip a limited account's migration step about the account itself
osbase77 Oct 21, 2026
cb59461
Keep administrator rights while that account's disk password change i…
osbase77 Oct 21, 2026
55ca087
Recognise a limited account named as user:group in a migration's sudo…
osbase77 Oct 21, 2026
b41924e
Count root in a list of run-as users as full sudo
osbase77 Oct 21, 2026
5d0a8b5
Don't take a program sharing an account's name for that account
osbase77 Oct 21, 2026
d4b340f
Stop when the wheel sudo rule can't be put in place
osbase77 Oct 21, 2026
2b8c0cc
Check the disk's keys before automatic login, instead of everyone's n…
osbase77 Oct 21, 2026
0ba1396
Keep a home that holds an unfinished disk password change
osbase77 Oct 21, 2026
dcfb782
Finish your own interrupted disk password change before either switch
osbase77 Oct 21, 2026
0cc1fa1
Run the package tests as an administrator whoever runs them
osbase77 Oct 21, 2026
1b95e01
Merge quattro into multi-user
osbase77 Oct 21, 2026
e294990
Merge quattro into multi-user
osbase77 Oct 22, 2026
c941ff5
Stub the administrator check and checkupdates in the first-run tests
osbase77 Oct 22, 2026
119e6f0
update: analyze the legacy transcript on the update that installs thi…
AnPod Oct 22, 2026
8cf935c
Hold one update lock for the whole machine, migrations included
osbase77 Oct 23, 2026
b48f5ed
Merge quattro into multi-user
osbase77 Oct 24, 2026
c75ea56
Fold the new tests into their areas' existing files
osbase77 Oct 24, 2026
1a6ad11
Leave FIDO2 setup to an administrator
osbase77 Oct 24, 2026
4339ce9
Run a limited account's migrations only after an administrator's
osbase77 Oct 24, 2026
809acff
Merge quattro into multi-user
osbase77 Oct 24, 2026
8f821c7
Merge quattro into multi-user
osbase77 Oct 24, 2026
224b6e7
Carry the update that installs the machine-wide lock onto it
osbase77 Oct 25, 2026
7a10ce5
Carry the update onto the lock right after the migration that creates it
osbase77 Oct 25, 2026
e81a90a
Move the package administrator checks into pkg-drop-test.sh
osbase77 Oct 25, 2026
76249fa
Merge quattro into multi-user
osbase77 Oct 25, 2026
77a3ce9
Merge quattro into multi-user
osbase77 Oct 27, 2026
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
20 changes: 17 additions & 3 deletions agents/skills/migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ prompt themselves. Migrations must be idempotent: if one user already applied a
machine-wide repair, the same migration running for another user should detect
that and no-op.

### Accounts that aren't administrators

On an account outside `wheel` (`omarchy-sudo-allowed` fails), `omarchy-migrate` puts `default/omarchy/migrate-limited/` first on `PATH`: its `sudo` and `pkexec` run nothing, print what they left on stderr, and report success. The machine-wide steps are an administrator's, done by their own run of the same migration, normally `omarchy update` as soon as it has installed the migration. The limited account's run applies only its own part, without a password prompt sudo would refuse, and only after an administrator's run: an administrator's run records each migration it runs in `/var/lib/omarchy/admin-migrations`, and a limited account's run stops at the first pending migration not recorded there, so its part always follows the machine-wide one (`--pending` lists only what it can run now). An administrator's run also reruns a newer migration the record lacks, such as one lost to a rollback of `/`. Migrations older than the one that creates the record run as they did before. So:

- Don't base a step for the user on what a sudo command printed or returned: for such an account it printed nothing and succeeded.
- A privileged step about the account itself, with its name or home in the command (`sudo gpasswd -d "$USER" input`), is not one an administrator's run does for it, so there it fails, says so, and the migration stays pending until an administrator has done it. Where a repair applies to every account, have the administrator's run do it for all of them.
- Package helpers still refuse there when a package is missing (`omarchy-pkg-add` says an administrator installs software), which fails the migration and leaves it pending until an administrator has installed it.

## When migrations run

### During `omarchy update`
Expand All @@ -43,7 +51,11 @@ omarchy-hook post-update
```

`omarchy-migrate` waits for any active pacman transaction to finish, then runs
all pending migrations for the current user in the visible update terminal.
all pending migrations for the current user in the visible update terminal. An
administrator's run holds the machine-wide update lock while it does, so two
administrators' updates or migrations never run the same migration at once;
run on its own while another holds it, it says so and runs nothing. Other
accounts' runs change only their own files and lock nothing.

### At login

Expand All @@ -54,8 +66,10 @@ Every graphical login starts `omarchy-migrate-notify.service` after
omarchy-migrate --pending
```

It stays silent while `omarchy update` holds its lock, since that update applies
the pending migrations itself.
It waits while an update or migration holds a lock the account takes, and only
then counts what is still pending: the account's own update applies its pending
migrations itself, and those another administrator's update doesn't are
prompted for once it has finished.

If that user has pending migrations, it shows a notification that opens a
terminal for:
Expand Down
1 change: 1 addition & 0 deletions bin/omarchy
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ GROUP_DESCRIPTIONS[toggle]="Toggle Omarchy features"
GROUP_DESCRIPTIONS[transcode]="Image and video transcoding"
GROUP_DESCRIPTIONS[tui]="Terminal UI launchers"
GROUP_DESCRIPTIONS[update]="Omarchy and system updates"
GROUP_DESCRIPTIONS[user]="User accounts and administrator access"
GROUP_DESCRIPTIONS[version]="Version and channel information"
GROUP_DESCRIPTIONS[voxtype]="Voxtype dictation"
GROUP_DESCRIPTIONS[weather]="Weather status"
Expand Down
65 changes: 52 additions & 13 deletions bin/omarchy-drive-password
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

# omarchy:summary=Set a new password for an encrypted drive
# omarchy:args=[--system-stdin]
# omarchy:requires-sudo=true

# Changes a drive's LUKS key and nothing else. For the disk holding /, the new
Expand All @@ -15,6 +16,20 @@ set +x
REKEY_STATE=${XDG_STATE_HOME:-$HOME/.local/state}/omarchy/drive-password.state
source "$OMARCHY_PATH/install/provisioning/luks-rekey.sh"

# --system-stdin is for commands that already have both passwords (omarchy user
# add and remove): change the system disk's, reading the current password and
# then the new one from stdin, one per line, with no prompts. Every check below
# applies as when a person types them.
scripted=0
case ${1:-} in
"") ;;
--system-stdin) scripted=1 ;;
*)
echo "Usage: omarchy-drive-password [--system-stdin]" >&2
exit 2
;;
esac

# The LUKS partition beneath /, or nothing when / is not encrypted. Fails when
# it cannot tell, including a crypt layer whose LUKS partition lsblk cannot name.
root_luks_device() {
Expand Down Expand Up @@ -389,16 +404,21 @@ finish_interrupted_change() {
change_selected_drive() {
local encrypted_drives drive current old_slot others new_password confirmation status=0 system_drive=false

encrypted_drives=$(luks_drives)
if [[ -z $encrypted_drives ]]; then
echo "No encrypted drives available."
return 1
fi

if (( $(wc -l <<<"$encrypted_drives") == 1 )); then
drive="$encrypted_drives"
if (( scripted )); then
[[ -n $root_drive ]] || { echo "The system drive is not encrypted."; return 1; }
drive=$root_drive
else
drive="$(omarchy-drive-select "$encrypted_drives")"
encrypted_drives=$(luks_drives)
if [[ -z $encrypted_drives ]]; then
echo "No encrypted drives available."
return 1
fi

if (( $(wc -l <<<"$encrypted_drives") == 1 )); then
drive="$encrypted_drives"
else
drive="$(omarchy-drive-select "$encrypted_drives")"
fi
fi

if [[ -z $drive ]]; then
Expand All @@ -411,7 +431,11 @@ change_selected_drive() {
drive=$root_drive
fi

current=$(gum input --password --header "$(omarchy-i18n drive.currentPassword)") || return 1
if (( scripted )); then
IFS= read -r current || true
else
current=$(gum input --password --header "$(omarchy-i18n drive.currentPassword)") || return 1
fi
old_slot=$(drive_key_slot "$drive" "$current") || status=$?
if (( status == 2 )); then
echo "That password does not open $drive."
Expand All @@ -435,10 +459,18 @@ change_selected_drive() {
fi
fi

new_password=$(gum input --password --header "$(omarchy-i18n drive.newPassword)") || return 1
if (( scripted )); then
IFS= read -r new_password || true
else
new_password=$(gum input --password --header "$(omarchy-i18n drive.newPassword)") || return 1
fi
[[ -n $new_password ]] || { echo "Password cannot be empty."; return 1; }

confirmation=$(gum input --password --header "$(omarchy-i18n drive.confirmNewPassword)") || return 1
if (( scripted )); then
confirmation=$new_password
else
confirmation=$(gum input --password --header "$(omarchy-i18n drive.confirmNewPassword)") || return 1
fi
[[ $new_password == "$confirmation" ]] || { echo "Passwords do not match."; return 1; }
[[ $new_password != "$current" ]] || { echo "The new password is the current one."; return 1; }
# Its slot is how the change is followed, so it must not open one already.
Expand Down Expand Up @@ -479,7 +511,14 @@ if [[ -n $root_drive ]]; then
fi

if change_pending; then
finish_interrupted_change
# Finishing needs whichever password opens the disk now, which only a person
# can tell.
if (( scripted )); then
echo "The last password change for $root_drive stopped part way. Run omarchy-drive-password to finish it first."
exit 1
else
finish_interrupted_change
fi
else
change_selected_drive
fi
8 changes: 8 additions & 0 deletions bin/omarchy-menu-timezone
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

set -e

# The time zone is the whole machine's. Omarchy's passwordless rule for it
# covers wheel only, and a menu action has no terminal for sudo to ask in, so
# anyone else would pick a zone and see nothing happen.
if ! omarchy-sudo-allowed; then
omarchy-notification-send "$(omarchy-i18n timezone.adminOnly)"
exit 1
fi

timezone=$(timedatectl list-timezones | omarchy-menu-select "$(omarchy-i18n timezone.setTitle)" -- --width 520 --maxheight 520) || exit 1
sudo timedatectl set-timezone "$timezone"
omarchy-shell -q omarchy.clock refresh
Expand Down
88 changes: 86 additions & 2 deletions bin/omarchy-migrate
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ done
OMARCHY_PATH="${OMARCHY_PATH:-/usr/share/omarchy}"
STATE_DIR="${OMARCHY_MIGRATION_STATE:-$HOME/.local/state/omarchy/migrations}"
MIGRATIONS_DIR="$OMARCHY_PATH/migrations"
# The migrations administrators' runs have finished, for the whole machine:
# systemd-tmpfiles makes it writable by wheel and readable by everyone
# (etc/tmpfiles.d/omarchy-admin-migrations.conf).
RECORD_DIR="${OMARCHY_MIGRATION_RECORD:-/var/lib/omarchy/admin-migrations}"
# The record starts with the migration that creates it; the ones before it run
# as they did before it existed.
RECORD_SINCE=1792864545.sh

administrator=false
if omarchy-sudo-allowed; then
administrator=true
fi

migration_entries() {
[[ -d $MIGRATIONS_DIR ]] || return 0
Expand All @@ -44,12 +56,41 @@ migration_entries() {
done
}

# An account that isn't an administrator runs a migration only once an
# administrator's run has, so its own part follows the machine-wide one, and
# stops at the first an administrator hasn't run yet. A machine without the
# record runs them as before.
waits_for_administrator() {
[[ $administrator == false && -d $RECORD_DIR && $1 > $RECORD_SINCE && ! -e $RECORD_DIR/$1 ]]
}

# An administrator's run records each migration it runs, before marking it
# done, so one it couldn't record stays pending and runs again. The record
# exists for every migration after the one that creates it, which fails rather
# than leave it out. A file another administrator's run created is theirs, so
# it is left as it is.
record_run() {
if [[ $administrator == true && -d $RECORD_DIR && ! -e $RECORD_DIR/$1 ]]; then
touch "$RECORD_DIR/$1"
fi
}

# Pending for this account: not marked done here, or, for an administrator, a
# newer migration the record lacks (lost to a rollback of / that kept /home,
# say), which runs again to restore it.
is_pending() { # NAME MARKER
[[ ! -f $2 ]] && return 0
[[ $administrator == true && -d $RECORD_DIR && $1 > $RECORD_SINCE && ! -e $RECORD_DIR/$1 ]]
}

# The pending migrations this account can run now, in order.
pending_migrations() {
local name file marker

while IFS=$'\t' read -r name file marker; do
[[ -n $name ]] || continue
if [[ ! -f $marker ]]; then
if is_pending "$name" "$marker"; then
waits_for_administrator "$name" && break
printf '%s\n' "$name"
fi
done < <(migration_entries)
Expand Down Expand Up @@ -80,22 +121,65 @@ wait_for_pacman_transaction() {
exit 0
}

# An administrator's run holds the machine-wide update lock, so two
# administrators' updates or migrations never run the same migration at once:
# both could rebuild one boot image or add one line twice. omarchy update
# already holds it when it runs this. Other accounts' migrations change only
# their own files and lock nothing, as before.
if omarchy-update-lock shared && ! omarchy-update-lock held; then
exec omarchy-update-lock run "$0"
fi

# The update that installs the machine-wide lock holds only this account's
# own, and the lock can appear before this run or during it.
# Carry that update onto the machine's lock for the rest of it as soon as this
# run sees the lock: at the start, after each migration, and at the end.
# Another account's run holding it by then stops this one.
carried=false
carry_update() {
[[ $carried == false ]] || return 0
local status=0
omarchy-update-lock carry 3<&- || status=$?
case $status in
0) ;;
3) carried=true ;;
*) exit 1 ;;
esac
}
carry_update

wait_for_pacman_transaction

# An account that isn't an administrator applies only its own part of each
# migration. The machine-wide steps are an administrator's, done by their own
# run of the same migration, so here sudo and pkexec run nothing and report
# success instead of asking for a password sudo would refuse.
if [[ $administrator == false ]]; then
PATH="$OMARCHY_PATH/default/omarchy/migrate-limited:$PATH"
fi

mkdir -p "$STATE_DIR"
[[ -d $MIGRATIONS_DIR ]] || exit 0

while IFS=$'\t' read -r name file marker <&3; do
[[ -n $name ]] || continue

if [[ ! -f $marker ]]; then
if is_pending "$name" "$marker"; then
if waits_for_administrator "$name"; then
echo "The remaining migrations wait for an administrator to run them first."
break
fi
echo -e "\e[32m\nRunning migration (${name%.sh})\e[0m"
OMARCHY_PATH="$OMARCHY_PATH" bash -euo pipefail "$file" 3<&-
record_run "$name"
mkdir -p "$(dirname "$marker")"
touch "$marker"
carry_update
fi
done 3< <(migration_entries)

carry_update

# Clear a login-time notification the user left sitting there and then resolved
# by running migrations some other way. The substring matches both the current
# and legacy notification titles.
Expand Down
51 changes: 22 additions & 29 deletions bin/omarchy-migrate-notify
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,28 @@

set -euo pipefail

update_in_progress() {
local lock="${XDG_RUNTIME_DIR:-}/omarchy-update.lock"

[[ -n ${XDG_RUNTIME_DIR:-} && -f $lock ]] || return 1

# flock -n only fails here when the lock is held, since the file is ours.
! flock -n "$lock" true 2>/dev/null
}

if update_in_progress; then
exit 0
fi

pending_migrations=$(omarchy-migrate --pending 2>/dev/null) || exit 0
pending_count=$(printf '%s\n' "$pending_migrations" | sed '/^[[:space:]]*$/d' | wc -l)

message=$(omarchy-i18n --count "$pending_count" migrate.clickToRun "$pending_count")

# This runs from omarchy-migrate-notify.service after graphical-session.target,
# but the target can be reached before the shell has claimed
# org.freedesktop.Notifications. Without the wait the toast is sent into the
# void and the user never learns about their pending migrations.
omarchy-notification-wait || true

# That wait is long enough for an update to start underneath us, and the count
# above is already stale by then, so re-check before spending the toast.
if update_in_progress; then
exit 0
fi
# Never while an update or migration holds a lock this account takes: its own
# update applies its migrations itself, and another administrator's would turn
# a run away. Waiting instead of leaving keeps the prompt for migrations still
# pending afterwards, such as a second administrator's own.
while :; do
omarchy-update-lock wait

pending_migrations=$(omarchy-migrate --pending 2>/dev/null) || exit 0
pending_count=$(printf '%s\n' "$pending_migrations" | sed '/^[[:space:]]*$/d' | wc -l)

message=$(omarchy-i18n --count "$pending_count" migrate.clickToRun "$pending_count")

# This runs from omarchy-migrate-notify.service after graphical-session.target,
# but the target can be reached before the shell has claimed
# org.freedesktop.Notifications. Without the wait the toast is sent into the
# void and the user never learns about their pending migrations.
omarchy-notification-wait || true

# That wait is long enough for an update to start underneath us, and the count
# above is already stale by then, so wait it out and count again.
omarchy-update-lock busy || break
done

# The shell keeps the click command with the toast, so this oneshot can hand the
# invitation over and exit instead of staying activated until it is answered.
Expand Down
3 changes: 3 additions & 0 deletions bin/omarchy-pkg-add
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
if omarchy-pkg-missing "$@"; then
if (( EUID == 0 )); then
pacman -S --noconfirm --needed -- "$@" || exit 1
elif ! omarchy-sudo-allowed; then
echo "Only an administrator can install software." >&2
exit 1
else
sudo pacman -S --noconfirm --needed -- "$@" || exit 1
fi
Expand Down
7 changes: 6 additions & 1 deletion bin/omarchy-pkg-aur-add
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
# omarchy:args=<packages...>

if omarchy-pkg-missing "$@"; then
yay -S --noconfirm --needed -- "$@" || exit 1
if ! omarchy-sudo-allowed; then
echo "Only an administrator can install software." >&2
exit 1
else
yay -S --noconfirm --needed -- "$@" || exit 1
fi
fi

for pkg in "$@"; do
Expand Down
Loading