← Back to issue list

cli: error/warn when using sudo

View original Github issue

Metadata

Project
snapcraft
Number
#3150
Type
pull request
State
merged
Author
cjp256
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #3150 as commit 84891da30, adding sudo errors for LXD/Multipass/remote-build, a warning for host cleanup, and sudo test-environment updates to reduce Sentry permission-error reports.

Resolution: closed resolved

Reason: The PR was merged into master as commit 84891da30 after approval by sergiusens. It implemented sudo detection that exits with an error for lxd/multipass/remote-build and warns host-mode users to also use sudo when cleaning, with spread tests updated to use 'env -i'.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Sentry is filled with bug reports resulting from permission errors due to mixed usage of sudo in different environments. By checking for use of sudo, we can prevent most of these errors from occurring. - For lxd, multipass & remote-build users, exit with an error if user is using sudo. - For host (destructive-mode) users, warn if sudo is detected, suggesting that the user also use sudo when cleaning. Update spread tests to use `env -i` when using sudo.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #3150 as commit 84891da30, adding sudo errors for LXD/Multipass/remote-build, a warning for host cleanup, and sudo test-environment updates to reduce Sentry permission-error reports.
stealth/space-bunny-alpha — closed resolved Merged PR #3150 as commit 84891da30, adding sudo errors for LXD, Multipass and remote-build, a warning for host cleanup, and sudo test-environment updates.
stealth/space-bunny-alpha — closed resolved Merged PR #3150 as commit 84891da30, adding sudo errors for LXD, Multipass and remote-build, a warning for host cleanup, and sudo test-environment updates.
qwen/qwen3.6-35b-a3b — — Merged PR #3150 into master. Adds CLI checks to error on sudo for LXD, Multipass, and remote-build, while warning host and destructive-mode users. Updates spread tests to prevent permission errors.
qwen3.6-35b-a3b-mtp-q6 — — Merged into master. Implements CLI checks to error out for LXD, Multipass, and remote-build, and warn for host mode when sudo is detected, preventing permission errors. Updated spread tests to use env -i. Code coverage increased by 0.00%.

Update history

No update history recorded yet.

Related work

  • Related To: snapcraft#3159 (confidence 95%)

    Follow-up PR (commit a68a23f0e) refining the same sudo detection with an effective-UID check to avoid false warnings/errors.

  • Related To: snapcraft#3275 (confidence 90%)

    Follow-up PR (commit cb23c00a5) suppressing the sudo warning when the Multipass provider is used.

  • Related To: snapcraft#3240 (confidence 70%)

    Follow-up commit e622647f3 limiting the sudo warning to a check-only warning.

Related issues

Issue Project State Summary Similarity
#54 lxd instance: drop sudo usage (CRAFT-289) craft-providers merged Merged PR #54 via fa985d0, removing sudo from LXD instance operations so builds no longer require sudo in buildd images.
71%
#3275 cli: ignore sudo warning when using multipass snapcraft merged Merged #3275 in commit cb23c00a5, suppressing Snapcraft's sudo warning when the Multipass build provider is used.
70%