Skip to content

fix(uninstall): don't abort POSIX uninstaller when sudo fails on apt/dnf removal - #230

Open
emohack wants to merge 1 commit into
monk-io:mainfrom
emohack:fix/uninstall-sudo-guard
Open

fix(uninstall): don't abort POSIX uninstaller when sudo fails on apt/dnf removal#230
emohack wants to merge 1 commit into
monk-io:mainfrom
emohack:fix/uninstall-sudo-guard

Conversation

@emohack

@emohack emohack commented Aug 2, 2026

Copy link
Copy Markdown

Context

In remove_runtime_linux() every step is wrapped in || true (systemctl stop/disable/daemon-reload, monk machine stop, brew uninstall), but the two package removals are not:

  • sudo apt-get remove -y monk
  • sudo dnf remove -y monk

The script runs with set -eu (line 2). When sudo is unavailable (minimal/root container) or non-interactive without passwordless sudo, the failing sudo aborts the whole script after the agent files were already removed, so the user gets a non-zero exit and no "uninstall complete." message while the Monk runtime is left half-removed.

Change

Wrap both package removals in || true, matching the surrounding guards.

Verification

sh -n passes; diff is 2 lines.

…dnf removal

The rest of remove_runtime_linux() wraps every step in `|| true` (systemctl stop/disable/daemon-reload, monk machine stop, brew uninstall), but the package removals are not. With set -eu, a failing `sudo apt-get remove` / `sudo dnf remove` (no sudo installed, or non-interactive without passwordless sudo) aborts the script after the agent files were already removed — user sees a non-zero exit and no completion message while the Monk runtime is left half-removed.

Match the surrounding guards with `|| true`.
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.

1 participant