Skip to content

[client] Stop and remove the daemon on netbird-ui cask uninstall - #6977

Merged
lixmal merged 1 commit into
mainfrom
cask-uninstall-daemon
Jul 30, 2026
Merged

[client] Stop and remove the daemon on netbird-ui cask uninstall#6977
lixmal merged 1 commit into
mainfrom
cask-uninstall-daemon

Conversation

@lixmal

@lixmal lixmal commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Describe your changes

brew uninstall --cask netbird-ui left the daemon running and its LaunchDaemon plist in place, because the cask invoked the bundled uninstaller.sh without sudo and that script only printed instructions. The same fix was merged into the tap in netbirdio/homebrew-tap#6, but the cask is regenerated from this template on every release, so it was overwritten again.

  • Boot out the netbird system daemon and remove /Library/LaunchDaemons/netbird.plist on cask uninstall
  • Run the cleanup with sudo and inline, so it no longer depends on a script bundled inside the .app

Issue ticket number and link

Fixes #5852, #1924, #5135
Tap-side fix: netbirdio/homebrew-tap#6

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • This change does not modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — OR I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). See CONTRIBUTING.md.

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Packaging fix with no user-facing change beyond uninstall behaving as documented.

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • Bug Fixes
    • Improved macOS uninstallation by removing the NetBird system launch daemon and its configuration file.
    • Added elevated permissions and fallback handling to help ensure complete cleanup, even if the service is not currently loaded.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The macOS cask uninstall preflight now uses a privileged shell script to stop the NetBird launch daemon with fallback handling and remove its system plist.

Changes

macOS uninstall cleanup

Layer / File(s) Summary
Launch daemon cleanup
client/ui/netbird-ui.rb.tmpl
The uninstall preflight replaces the bundled uninstaller with privileged launchctl bootout/unload commands and removes /Library/LaunchDaemons/netbird.plist while ignoring command errors.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: uninstall cleanup for the netbird-ui cask.
Description check ✅ Passed The description follows the template and includes changes, issues, checklist, and documentation notes; the stack section is just left blank.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cask-uninstall-daemon

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@client/ui/netbird-ui.rb.tmpl`:
- Around line 32-38: Update the daemon-stop command in the system_command
uninstall block to ignore only expected “service not found” states from
launchctl, while propagating other bootout/unload failures. Ensure rm -f
/Library/LaunchDaemons/netbird.plist runs only after a successful stop or
confirmed absence, and remove the unconditional || true that masks failures.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 914fcb91-47a0-469d-b5ad-dc48b2366144

📥 Commits

Reviewing files that changed from the base of the PR and between 1bf54dd and 6ff9c5e.

📒 Files selected for processing (1)
  • client/ui/netbird-ui.rb.tmpl

Comment thread client/ui/netbird-ui.rb.tmpl
@github-actions

Copy link
Copy Markdown

Release artifacts

Built for PR head 6ff9c5e in workflow run #17280.

Artifact Link
All release artifacts Download
Linux packages Download
Windows packages Download
macOS packages Download
UI artifacts Download
UI macOS artifacts Download

GHCR images (amd64)

This comment is updated by the Release workflow. Artifact links expire according to the workflow retention policy.

@lixmal
lixmal merged commit cff4923 into main Jul 30, 2026
44 of 45 checks passed
@lixmal
lixmal deleted the cask-uninstall-daemon branch July 30, 2026 11:11
@fosskar fosskar Bot mentioned this pull request Aug 1, 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.

[Bug] homebrew/macOS uninstalling netbird is not full

2 participants