| name | sandboxxer-linux-troubleshoot |
| description | Use when user encounters problems with native Linux/WSL2 Claude Code setup - diagnose and fix bubblewrap, PATH, authentication, or WSL2-specific issues |
| whenToUse | - Bubblewrap sandbox failures or permission errors
- Claude Code CLI not found or installation failures
- PATH environment configuration issues
- WSL2-specific problems (networking, file permissions, distro issues)
- Git or GitHub CLI authentication problems
- Claude API authentication failures
- System package installation errors (apt, yum, pacman)
- Sudo permission issues or credential timeout problems
- Native Linux performance issues or crashes
|
Native Linux/WSL2 Troubleshooting Assistant
Overview
Diagnoses and resolves common issues with Claude Code CLI running natively on Linux/WSL2 (without Docker containers). This skill focuses on bubblewrap sandboxing, environment configuration, WSL2-specific issues, and authentication problems.
When to Use This Skill
Use this skill when:
- Bubblewrap sandbox failures or permission errors
- Claude Code CLI not found or installation failures
- PATH environment issues
- WSL2-specific problems (networking, file permissions, distro issues)
- Git or GitHub CLI authentication problems
- Claude API authentication failures
- System package installation errors
- Sudo permission issues or credential timeout problems
Do NOT use this skill when:
- Setting up a new native Linux installation (use
/sandboxxer:yolo-linux-maxxing instead)
- Working with Docker-based sandboxes (use
/sandboxxer:troubleshoot instead)
- Auditing security (use
/sandboxxer:audit instead)
Usage
Via slash command:
/sandboxxer:linux-troubleshoot
Via natural language:
- "Claude Code not found after installation"
- "Bubblewrap permission denied"
- "WSL2 networking issues"
- "Can't authenticate Claude"
- "PATH not working on Linux"
Examples
Example: Claude Code Not Found
User: "I installed Claude Code but the command isn't found"
Assistant: "I'll help troubleshoot the PATH configuration issue."
The skill will:
- Check if Claude Code binary exists
- Verify PATH configuration in ~/.bashrc
- Test shell environment loading
- Provide commands to fix PATH
- Verify the fix works
Example: Bubblewrap Permission Error
User: "Getting permission denied when running bubblewrap"
Assistant: "Let's diagnose the bubblewrap sandbox issue."
The skill will:
- Verify bubblewrap installation
- Test basic bubblewrap functionality
- Check kernel user namespace support
- Identify permission issues
- Provide specific fix based on error
Troubleshooting Workflow
1. Identify the Problem Category
Ask user to describe the issue, then categorize:
- Bubblewrap Issues: Sandbox failures, permission errors, kernel limitations
- Claude CLI Issues: Installation failures, command not found, API errors
- WSL2-Specific Issues: Networking, file permissions, systemd problems
- PATH/Environment Issues: Tools not found after installation
- Git/GitHub CLI Issues: Authentication, configuration problems
- Authentication Issues: Claude auth login failures, API key problems
- Sudo/Permission Issues: Credential timeouts, sudoers access, privilege errors
2. Gather Diagnostic Information
Run appropriate diagnostic commands:
Bubblewrap Issues:
bwrap --version
bwrap --ro-bind / / --dev /dev --proc /proc --tmpfs /tmp -- echo "test"
cat /proc/sys/kernel/unprivileged_userns_clone
ls -la $(which bwrap)
Claude CLI Issues:
which claude
claude --version
echo $PATH | tr ':' '\n' | grep -i claude
ls -la ~/.local/bin/claude /usr/local/bin/claude 2>/dev/null
cat ~/.bashrc | grep -E "(PATH|claude)"
WSL2-Specific Issues:
cat /proc/version | grep -i microsoft
wsl.exe --status 2>/dev/null
ping -c 1 google.com
nslookup google.com
ls -la /etc/resolv.conf
PATH/Environment Issues:
echo $PATH
cat ~/.bashrc
cat ~/.bash_profile 2>/dev/null
cat ~/.profile 2>/dev/null
source ~/.bashrc && echo "Reload successful"
echo $SHELL
Git/GitHub CLI Issues:
git --version
gh --version
git config --global --list
gh auth status
git config --global credential.helper
Authentication Issues:
claude auth whoami
ls -la ~/.claude/
curl -I https://api.anthropic.com/
3. Apply Systematic Fixes
Based on the diagnostic results, apply fixes:
Bubblewrap Permission Denied
Issue: bwrap: setting up uid map: Permission denied
Fix 1 - Enable user namespaces (Debian/Ubuntu):
cat /proc/sys/kernel/unprivileged_userns_clone
sudo sysctl -w kernel.unprivileged_userns_clone=1
echo "kernel.unprivileged_userns_clone=1" | sudo tee -a /etc/sysctl.conf
bwrap --ro-bind / / --dev /dev --proc /proc --tmpfs /tmp -- echo "Success!"
Fix 2 - WSL2-specific (if Fix 1 doesn't work):
sudo tee /etc/wsl.conf > /dev/null <<EOF
[boot]
systemd=true
[user]
default=$(whoami)
EOF
wsl.exe --shutdown
Fix 3 - Reinstall bubblewrap with proper permissions:
sudo apt-get remove bubblewrap -y
sudo apt-get update
sudo apt-get install bubblewrap -y
Claude Code Not Found
Issue: bash: claude: command not found
Fix 1 - Reload shell configuration:
source ~/.bashrc
which claude
claude --version
Fix 2 - Fix PATH in ~/.bashrc:
echo $PATH | grep -E "(\.local/bin|usr/local/bin)"
echo 'export PATH="$HOME/.local/bin:/usr/local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
which claude
Fix 3 - Reinstall Claude Code CLI:
curl -fsSL https://claude.ai/install.sh | bash
source ~/.bashrc
claude --version
Fix 4 - Check binary exists:
find ~ -name "claude" -type f 2>/dev/null
chmod +x ~/.local/bin/claude
export PATH="$HOME/.local/bin:$PATH"
WSL2 Networking Issues
Issue: Can't reach external sites or DNS resolution fails
Fix 1 - Reset DNS configuration:
sudo rm /etc/resolv.conf
sudo tee /etc/resolv.conf > /dev/null <<EOF
nameserver 8.8.8.8
nameserver 8.8.4.4
EOF
sudo chattr +i /etc/resolv.conf
ping -c 1 google.com
Fix 2 - Restart WSL networking (from Windows PowerShell):
wsl --shutdown
# Wait 10 seconds, then restart WSL
wsl
Fix 3 - Disable WSL DNS generation:
sudo tee /etc/wsl.conf > /dev/null <<EOF
[network]
generateResolvConf = false
EOF
Git/GitHub CLI Authentication
Issue: Git push fails or GitHub CLI not authenticated
Fix 1 - Configure Git:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
git config --global credential.helper store
git config --global --list
Fix 2 - Authenticate GitHub CLI:
gh auth login
gh auth status
Fix 3 - Generate SSH key for Git:
ssh-keygen -t ed25519 -C "your.email@example.com"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub
Claude Authentication Failures
Issue: claude auth login fails or API errors
Fix 1 - Re-authenticate:
claude auth logout
claude auth login
claude auth whoami
Fix 2 - Clear authentication cache:
rm -rf ~/.claude/
claude auth login
claude auth whoami
Fix 3 - Check network connectivity to Anthropic API:
curl -I https://api.anthropic.com/
System Package Installation Failures
Issue: apt-get install fails or packages not found
Fix 1 - Update package lists:
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install <package-name> -y
Fix 2 - Fix broken packages:
sudo apt-get install -f
sudo dpkg --configure -a
sudo apt-get clean
sudo apt-get autoclean
sudo apt-get update
Fix 3 - Check disk space:
df -h
sudo apt-get autoremove -y
sudo apt-get clean
df -h
Sudo Credential Timeout During Installation
Issue: Installation steps hang or fail waiting for sudo password mid-way through setup
Cause: The yolo-linux-maxxing installation validates sudo credentials at the start, but credentials expire after ~15 minutes (default timestamp_timeout). If you take time between steps, subsequent sudo commands will prompt for password again.
Prevention - Refresh credentials before each step:
sudo -v
Fix 1 - Enter password when prompted:
If a command hangs, it may be waiting for your sudo password. Type your password and press Enter.
Fix 2 - Refresh sudo credentials manually:
sudo -v
Fix 3 - Extend sudo timeout temporarily:
sudo visudo
User Not in Sudoers Group
Issue: sudo: user not in sudoers file
Cause: Your user account doesn't have sudo privileges
Fix 1 - Add user to sudo group (requires root access):
su -
usermod -aG sudo your_username
exit
Fix 2 - WSL2: Reset to default user:
# From Windows PowerShell (as Admin)
wsl -d Ubuntu -u root
usermod -aG sudo your_username
exit
Partial GitHub CLI Installation (Cleanup)
Issue: GitHub CLI installation failed partway through, leaving orphaned files
Cause: Sudo timeout or network failure during the multi-step gh installation
Fix - Clean up and retry:
sudo rm -f /etc/apt/keyrings/githubcli-archive-keyring.gpg
sudo rm -f /etc/apt/sources.list.d/github-cli.list
sudo apt update
Seccomp Filter Not Detected
Issue: /sandbox shows "seccomp filter: not installed" after running npm install
Cause: On Debian/Ubuntu, npm global packages require sudo to install to /usr/lib/node_modules. Without sudo, the package installs to user directories but the seccomp filter binary is not placed in the system location where Claude Code expects it.
Fix 1 - Install with sudo:
sudo npm install -g @anthropic-ai/sandbox-runtime
npm list -g @anthropic-ai/sandbox-runtime
Fix 2 - If Node.js not installed first:
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
node --version
npm --version
sudo npm install -g @anthropic-ai/sandbox-runtime
npm list -g @anthropic-ai/sandbox-runtime
Fix 3 - Reinstall if already installed without sudo:
npm uninstall -g @anthropic-ai/sandbox-runtime
sudo npm install -g @anthropic-ai/sandbox-runtime
npm list -g @anthropic-ai/sandbox-runtime
4. Verify the Fix
After applying fixes, verify:
- Tools are accessible via command line
- Authentication works
- Bubblewrap can run sandboxed commands
- Networking is functional
- Original error is resolved
Provide verification commands:
claude --version
claude auth whoami
bwrap --version
bwrap --ro-bind / / --dev /dev --proc /proc --tmpfs /tmp -- echo "Sandbox working!"
git --version
gh auth status
ping -c 1 google.com
curl -I https://api.anthropic.com/
echo $PATH
which claude
which git
which gh
Common Issues Quick Reference
"sudo: a password is required"
Cause: Sudo credentials expired during multi-step installation
Fix: Run sudo -v to refresh credentials, then retry the command
"sudo: user not in sudoers file"
Cause: User account lacks sudo privileges
Fix: Add user to sudo group via su - or WSL root access
"claude: command not found"
Cause: PATH not configured or shell not reloaded
Fix: Run source ~/.bashrc and verify PATH includes Claude install location
"bwrap: Permission denied"
Cause: User namespaces disabled in kernel
Fix: Enable with sudo sysctl -w kernel.unprivileged_userns_clone=1
"Network unreachable" in WSL2
Cause: WSL DNS configuration issues
Fix: Reset /etc/resolv.conf with Google DNS (8.8.8.8)
"gh auth status" shows not authenticated
Cause: GitHub CLI not logged in
Fix: Run gh auth login and authenticate via browser
"claude auth login" fails
Cause: Network issues or expired credentials
Fix: Check network connectivity, clear ~/.claude/ and re-authenticate
Package installation hangs
Cause: Stale apt cache or network issues
Fix: Run sudo apt-get update and retry
Bubblewrap works but Claude doesn't
Cause: Claude CLI installation incomplete
Fix: Reinstall with curl -fsSL https://claude.ai/install.sh | bash
Changes to ~/.bashrc not taking effect
Cause: Shell not reloaded or wrong shell configuration file
Fix: Run source ~/.bashrc or restart terminal
"seccomp filter: not installed"
Cause: npm package not installed globally with sudo, or Node.js not installed
Fix: Run sudo npm install -g @anthropic-ai/sandbox-runtime (requires Node.js 20+ installed first)
Reset Everything (Last Resort)
If nothing works, provide nuclear option:
sudo apt-get remove bubblewrap socat git gh -y
rm -rf ~/.claude/
rm -rf ~/.local/bin/claude
sudo apt-get autoremove -y
sudo apt-get clean
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install bubblewrap socat git curl wget unzip -y
(type -p wget >/dev/null || (sudo apt update && sudo apt install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
&& cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
curl -fsSL https://claude.ai/install.sh | bash
echo 'export PATH="$HOME/.local/bin:/usr/local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
bwrap --version
socat -V
git --version
gh version
claude --version
claude auth login
gh auth login
Warning: This removes all configurations. Back up important data first.
WSL2-Specific Troubleshooting
Identifying WSL2 Environment
cat /proc/version | grep -i microsoft
wsl.exe --status
cat /etc/os-release | grep PRETTY_NAME
Common WSL2 Issues
Issue 1: Systemd not available
sudo tee /etc/wsl.conf > /dev/null <<EOF
[boot]
systemd=true
EOF
wsl.exe --shutdown
Issue 2: File permissions incorrect
chmod -R u+rwX,go+rX-w .
sudo tee -a /etc/wsl.conf > /dev/null <<EOF
[automount]
options = "metadata"
EOF
Issue 3: Slow file access
cp -r /mnt/c/Users/YourName/project ~/project
cd ~/project
Key Principles
- Systematic approach - Run diagnostic commands before guessing
- One fix at a time - Test after each change
- Verify assumptions - Check actual state, not expected state
- Document what worked - Help user understand the fix
- Explain root cause - Teach, don't just fix
- Environment-specific - Recognize WSL2 vs native Linux differences
Reference Documentation
For detailed setup instructions, see:
Footer