Repository navigation
Suggest sudo when a non-root onctl can't pause/stop a root-owned fc VM - #1142
Merged
Merged
Conversation
Pause, Destroy and Restart surfaced bare 'permission denied' / 'operation not permitted' errors when run without root against a microVM created with sudo. Wrap EACCES/EPERM from the API socket and process signal with a hint to re-run with sudo. Claude-Session: https://claude.ai/code/session_01KTuQfhvGE9iLYpSpvUt1yy
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1142 +/- ##
==========================================
+ Coverage 34.56% 34.65% +0.08%
==========================================
Files 51 51
Lines 5612 5615 +3
==========================================
+ Hits 1940 1946 +6
+ Misses 3672 3669 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A Firecracker microVM created with
sudo onctl createis owned by root: itsfirecrackerprocess and its API socket both belong to root. Runningonctl pauseoronctl deletewithout root against it returns bare errors that don't say what to do:Change
withRootHinthelper inpkg/cloud/fc.go. When an error isos.ErrPermission(EACCES/EPERM), it appends(microVM "<name>" is owned by another user, typically root; re-run with sudo). The original error stays wrapped, soerrors.Ischecks still work.SetStatecall, Pause's stop after the snapshot, Destroy's stop, and Restart's stop.Tests
TestProviderFC_PermissionErrorsSuggestSudosends EACCES and EPERM through Pause, Destroy and Restart and asserts that the hint appears. It also checks that a failed Destroy leaves the VM's files in place, and that non-permission errors get no hint.go test ./pkg/cloud/ ./internal/providerfc/passes, andgo vetis clean for linux and windows.🤖 Generated with Claude Code
https://claude.ai/code/session_01KTuQfhvGE9iLYpSpvUt1yy