fix(onboard): use sudo lsof fallback to identify root-owned port blockers (fixes #726)#745
fix(onboard): use sudo lsof fallback to identify root-owned port blockers (fixes #726)#745kagura-agent wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
…kers (fixes NVIDIA#726) Non-root users cannot see root-owned listeners with lsof, causing the onboard preflight to fall through to the net probe which can only report EADDRINUSE without process details. Users then see a generic 'Could not identify the process' message suggesting 'lsof -i :PORT' which also returns empty without sudo. Changes: - preflight.js: When lsof returns empty, retry with 'sudo lsof' to identify root-owned listeners (e.g., docker-proxy, leftover gateway) before falling through to the net probe - onboard.js: Update the user-facing hint to suggest 'sudo lsof' instead of plain 'lsof'
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe changes add a Changes
Sequence Diagram(s)sequenceDiagram
participant Onboard as Onboarding
participant Preflight as Preflight Check
participant lsof as lsof (unprivileged)
participant sudolsof as lsof (with sudo)
participant netprobe as Net Probe Fallback
Onboard->>Preflight: Check port availability
Preflight->>lsof: Run lsof -i :port -sTCP:LISTEN
lsof-->>Preflight: Empty or header-only response
Preflight->>sudolsof: Retry with sudo lsof -i :port -sTCP:LISTEN
alt sudo lsof succeeds with data
sudolsof-->>Preflight: Process and PID data
Preflight->>Preflight: Parse first data row
Preflight-->>Onboard: Return unavailable (process identified)
Onboard->>Onboard: Display process info in error message
else sudo lsof fails or returns no data
sudolsof-->>Preflight: No usable data or error
Preflight->>netprobe: Fallback to net probe detection
netprobe-->>Preflight: Detection result
Preflight-->>Onboard: Return result
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Thanks for submitting this PR, it improves the onboarding process by using sudo lsof fallback to identify root-owned port blockers, which could improve the user experience and prevent potential issues for new users. |
Fixes #726
Problem
When a non-root user runs NemoClaw onboarding and port 8080 is occupied by a root-owned process (e.g.,
docker-proxy, leftover gateway),lsofreturns empty output because non-root users cannot see root-owned listeners. The preflight falls through to the net probe which detectsEADDRINUSEbut cannot identify the blocking process. The user sees:Running that command also returns empty without
sudo, leaving the user stuck.Solution
preflight.js: When regularlsofreturns empty, automatically retry withsudo lsofto identify root-owned listeners before falling through to the net probe. This gives users actionable process info (name + PID) instead of a generic EADDRINUSE message.onboard.js: Update the user-facing hint to suggestsudo lsofinstead of plainlsof.Testing
All existing preflight tests pass (9/9). The sudo fallback is skipped when
lsofOutputis injected (test mode), so no test changes needed.Summary by CodeRabbit
Release Notes
Bug Fixes