Skip to content

Add omarchy-server uninstall - #10

Merged
MyOwnDataCenter merged 3 commits into
MyOwnDataCenter:mainfrom
nixfred:feature/uninstall
Nov 15, 2026
Merged

MyOwnDataCenter merged 3 commits into
MyOwnDataCenter:mainfrom
nixfred:feature/uninstall

Conversation

@nixfred

@nixfred nixfred commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

What this changes

Adds omarchy-server uninstall [--purge] [-y], as discussed on #5.

  • Default: stops and disables the three services and removes their unit files, the launcher entries, the top-bar icon, the omarchy-server command (only if it is our link), the storage helper and its sudoers rule, the firewall rules the installer added, and the program folder. The account, apps and their data, and machines and their disks stay, so installing again picks up where you left off. Apps and machines that are still running are listed, because they keep running.
  • --purge: also deletes the data folder. It refuses, and changes nothing, while any app (compose project omarchy-*) or machine (libvirt session domain omarchy-*) still exists, and also when podman or libvirt is installed but cannot answer. App folders go through podman unshare rm -rf, as the server does, because they can belong to the apps' own user ids.
  • It asks you to type uninstall (or delete) unless -y is given, and refuses to run without a terminal and without -y. It never touches your files, ~/Pools, the installed packages or the "run while logged out" setting.
  • README: a line on how to remove it.

How you tested it

  • npm run typecheck, npm run build and npm test pass (132 tests, 8 of them new in test/uninstall.test.mjs, which runs the real script in a temporary home with stand-ins for sudo, systemctl, ufw, podman and virsh). I broke the command on purpose three ways (no command, --purge not refusing, default run wiping the data folder) and each makes a test fail.
  • Tried on a throwaway Omarchy VM (clean desktop, brought up to date with pacman -Syu, installed with install.sh from this branch, firewall on):
    1. --purge -y with a real leftover compose project and a real libvirt domain: refused, named both, nothing changed (machine state before and after identical).
    2. Typing the wrong word: "Nothing was changed".
    3. Default uninstall, typing uninstall: services, unit files, port 7780, command, launchers, program folder, helper, sudoers rule, all 8 firewall rules and the top-bar icon gone. Account, apps and machines data kept; the leftover app and machine untouched; an unrelated firewall rule kept; shell.json still valid.
    4. Installing again: the account step was skipped, accounts.json byte for byte the same, machine state identical to the first install.
    5. --purge with app files owned by uid 100004, where a plain rm -rf fails with permission denied: removed through podman unshare, data folder gone, ~/Pools kept.

Anything to know

  • A first version indexed .Labels in a podman ps --format template, which errors on podman 6.1.4. Because errors were hidden, --purge would have read that as "no apps". The VM caught it; apps are now read from podman's JSON, and --purge refuses when it cannot ask.
  • Not tried: an app installed from the web app, or a machine with a disk (I used a real compose project and domain with the same names), and an older Omarchy that uses Waybar.
  • widget off leaves shell.json.omarchy-server.bak behind (existing behaviour, not changed here).
  • Noticed and left alone: the password prompt in omarchyd/cli.mjs (askHidden) compares each chunk of input with \r, so a password pasted together with its Enter is taken as password text, \r included, and the prompt keeps waiting. I hit it while scripting the VM install.
  • Version number and What's New left alone, as CONTRIBUTING asks.

Closes #5

🤖 Generated with Claude Code

https://claude.ai/code/session_01BXN1v3McRXvDta1mtsKJkR

There was no way to remove Omarchy Server. The new command takes it off the
machine and keeps the user's data by default, as discussed on issue MyOwnDataCenter#5.

omarchy-server uninstall [--purge] [-y]

Default: stops and disables the three user services and removes their unit
files, the launcher entries, the top-bar icon, the omarchy-server command (only
if it is our link), the storage helper and its sudoers rule, the firewall rules
the installer added, and the program folder. The account, apps and their data,
machines and their disks stay, so installing again picks up where it left off.
Apps and machines that are still running are listed, because they keep running.

--purge: also deletes the data folder. It refuses, and changes nothing, while
any app (a compose project named omarchy-*) or machine (a libvirt session
domain named omarchy-*) still exists, so those go through the web app first.
It also refuses when podman or libvirt is installed but cannot answer, because
"could not ask" must never be read as "nothing there". App folders are removed
with `podman unshare rm -rf`, as the server does, because they can belong to the
apps' own user ids.

Apps are found from podman's JSON output (the compose project label), because
the text of `podman ps --format` differs between podman versions: a first
version that indexed .Labels in a template failed on podman 6.1.4 in a test VM.

It asks the user to type "uninstall" (or "delete" for --purge) unless -y is
given, and refuses to run without a terminal and without -y. It never touches
the user's files, ~/Pools, the installed packages or the linger setting.

test/uninstall.test.mjs runs the real script in a temporary home folder with
stand-ins for sudo, systemctl, ufw, podman and virsh that only record what they
were asked. It fails if the command is missing, if --purge stops refusing, if
--purge guesses when podman or libvirt cannot answer, or if the default run
touches the data folder.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BXN1v3McRXvDta1mtsKJkR

@MyOwnDataCenter MyOwnDataCenter left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you for this. It's careful, thorough work. The design is what we agreed on in #5: data kept by default, --purge for everything, a typed confirmation. Your testing on a throwaway VM (a real leftover project and domain, files owned by app user ids, a reinstall afterwards) is exactly what something that deletes data needs. Every path matches what install.sh creates, including --data $BASE/omarchyd.

Not merging yet, only because of two things that need fixing first. Both are small.

1. Two of the new tests fail anywhere node isn't in /usr/bin. The tests run the script with PATH: ${box.bin}:/usr/bin:/bin, and leftovers() runs node -e. On GitHub's runners (and my machine) Node lives elsewhere (/opt/node22/bin/node here), so node isn't found:

  • "uninstall leaves a command that is not ours alone…" doesn't list app: nextcloud;
  • "--purge refuses while apps or machines still exist…" goes ahead instead of refusing.

Adding ${dirname(process.execPath)} to those PATHs makes all 8 pass.

2. --purge can delete app data while apps still exist (this one matters). The same failure in real use: if node isn't on the PATH of the shell running the command (for example, Node installed through mise or nvm and not loaded in that shell), leftovers() quietly finds no apps and --purge deletes everything. I reproduced it: with a podman that reports omarchy-demo and no node on PATH, uninstall --purge -y printed "Omarchy Server and its data are gone." and the data folder was deleted. That breaks the rule you set yourself (rightly): couldn't ask must never count as nothing there.

Suggested fix: have can_ask also require command -v node whenever podman is installed, and give that case a test. Alternatively, have leftovers() report failure (exit non-zero) when the parse can't run, and refuse on that.

Smaller things, not blocking, but worth a look while you're in there:

  • sudo failures: with -y and no terminal, the sudo steps fail silently (output goes to /dev/null), and the script still says it's removed while the helper and /etc/sudoers.d/omarchy-server stay. Saying "couldn't remove the storage helper; run sudo rm …" would be clearer.
  • Leftovers outside the installer's rules: the firewall rules for individual app ports (comment 'Omarchy Server app', added by the helper's firewall-open) and the shares rule for 445 aren't removed, and nor are any SMB share settings. For the default mode that's arguably right, since apps stay; for --purge it might be worth listing them.
  • Thanks for flagging the askHidden paste problem in omarchyd/cli.mjs. I'll fix that separately.

Once 1 and 2 are in, I'll rerun everything and merge. Thanks again, this is a really solid feature.


Generated by Claude Code

MyOwnDataCenter pushed a commit that referenced this pull request Nov 14, 2026
- omarchyd used <data>/tls while the web server used ~/.local/share/
  omarchy-server/tls, so app gateways served a certificate from a different
  authority than the one devices trust, and Security settings (always https,
  replace certificate) only reached omarchyd. omarchyd/cli.mjs now passes
  defaultTlsDir(); an "always https" choice from the old folder is carried over.
- omarchyd/prompt.mjs: the create-owner prompt reads input character by
  character, so a pasted password with its Enter (or both passwords at once)
  works (reported by nixfred in #10).
- cloudUserData ignores a non-list `commands` (noted by nixfred in #9).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011b9fuB8ePE7DYtvvqNj1s2

Copy link
Copy Markdown
Owner

Quick follow-up on the side note: thanks again for reporting the password-paste problem. It's fixed on main in 41385a4. The prompt now reads input one character at a time, so a password pasted with its Enter, or both passwords pasted at once, works. Checked with a real terminal: the old prompt hangs, the new one creates the account. The review points above still stand; I'm looking forward to the update.


Generated by Claude Code

nixfred and others added 2 commits November 14, 2026 15:34
… could not run

Review on the pull request found two things, both fixed here.

1. --purge reads podman's answer with node. If node is not on the PATH of the
   shell running the command (node from mise or nvm that is not loaded there),
   leftovers() quietly found no apps and --purge went ahead and deleted app
   data. can_ask now also requires node whenever podman is installed, so
   "could not ask" still counts as "do not delete". The tests now build their
   PATH from where node really is (the two that failed wherever node is not in
   /usr/bin), and a new test runs --purge with a podman that reports an app and
   no node on the PATH: it must refuse and change nothing.

2. With -y and no terminal the sudo steps failed silently and the script still
   said it was done, leaving the storage helper and /etc/sudoers.d/omarchy-server.
   The root steps now run only when sudo can work (sudo -n, or a terminal to
   type a password in). Otherwise the user-level parts are still removed, the
   exact sudo commands to run by hand are printed, and the exit code is 1. A
   sudo command that fails is reported the same way.

Also from the review: --purge now says that firewall rules for individual app
ports and any SMB shares are not removed, and where to look.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BXN1v3McRXvDta1mtsKJkR
@nixfred

nixfred commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator Author

Thank you for the careful review. Both blocking points are fixed in the new commit on this branch (main is merged in too).

  1. Tests that depend on where Node lives. They now put the directory of the node that runs them on the PATH, so they pass wherever Node is installed. I also ran the uninstall tests with a copy of node outside /usr/bin.
  2. --purge and a missing node. --purge now refuses when node is not on the PATH, as well as when podman or libvirt cannot answer. Your reproduction is a test: a podman that reports an app and no node on the PATH must refuse and change nothing. I repeated it on the test VM with real podman: podman sees the app, node is not on the PATH, and --purge refuses with the data untouched. With the app gone, --purge still runs fully, including app files owned by uid 100004.

From the smaller notes: with -y and no terminal, the root steps now run only when sudo can work. Otherwise the user-level parts are removed, the exact sudo commands to run by hand are printed, and the exit code is 1. --purge now says that firewall rules for individual app ports and any SMB shares are not removed, and where to look.

Checked on this branch on top of main: type check, build and the full suite (149 tests) pass. I also broke each fix on purpose and confirmed a test fails. Thanks for the quick fix to the password prompt, and for crediting the report.

@MyOwnDataCenter
MyOwnDataCenter merged commit e88217b into MyOwnDataCenter:main Nov 15, 2026
1 check passed

Copy link
Copy Markdown
Owner

Thank you. This update addressed everything, and the way you verified it (breaking each fix on purpose to see a test fail, and repeating my reproduction on the VM with real podman) is exactly the care a command that deletes data needs.

Accepted and merged. It ships in 0.9.15 with a What's New entry crediting you. What I checked before merging, on this branch on top of the latest main:

  • Automated checks: type check, build and the full suite (150 tests), twice.
  • --purge refuses and changes nothing in each of these cases, run by hand in a throwaway home folder with stand-in system commands:
    • an app exists but node isn't on the PATH (my earlier reproduction);
    • podman can't answer;
    • libvirt can't answer;
    • an app still exists;
    • a machine still exists.
  • Default uninstall: the program, units, launchers and our link are removed; the account, app data and machine disks stay; someone else's unit, launcher and an omarchy-server command that isn't ours are left alone.
  • Full purge: the data folder goes, while ~/Downloads (reached through the shared-folder link), ~/Documents and ~/Pools are untouched.
  • Confirmation: no terminal without -y refuses; a wrong word changes nothing; "delete" isn't accepted for a plain uninstall; unknown arguments are refused.
  • sudo unavailable: the user-level parts are removed, the exact commands are printed, and the exit code is 1.
  • Installer match: the firewall rules and root paths are the ones install.sh creates.

One thought for later, not a problem with this change: --purge looks for containers and libvirt domains, so an app folder with no container left (a failed install, or containers pruned by hand) is deleted without being listed. The typed confirmation covers it, so I'm leaving it as is.

This closes #5. Thanks again for seeing it through.


Generated by Claude Code

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.

Add an omarchy-server uninstall command

2 participants