[BUG] Sandbox does not pass PATH to hook execution and git submodule operations on Fedora (merged-usr distro)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
On Fedora 43 (a merged-usr distro where /bin → /usr/bin), Claude Code's sandbox does not pass PATH to hook execution or internal git operations. This causes three failures:
- All plugin hooks fail — hooks spawn
/bin/sh -c "python3 ..."without any PATH set, sopython3: command not found - Plugin installation fails — git submodule scripts can't find
sed,basename,uname - MCP servers fail —
npm error enoent spawn sh ENOENT
The Bash tool works perfectly — it correctly sources env.sh. Only hook execution, plugin git clones, and MCP spawning are affected.
No shell snapshot is created for zsh. The ~/.claude/shell-snapshots/ directory stays empty after launch, so the sandbox has no environment to inherit.
What Should Happen?
- Hook execution should inherit PATH from the user's shell environment or from
~/.claude/env.sh - Git operations for plugin installation should have access to standard system commands (
sed,basename,uname) - Shell snapshots should be created for zsh shells, not only bash
- The sandbox should work correctly on merged-usr distros where
/binis a symlink to/usr/bin
Error Messages/Logs
SessionStart:startup hook error
PreToolUse:Bash hook error
PostToolUse:Bash hook error
Stop hook error: Failed with non-blocking status code: /bin/sh: line 1: python3: command not found
Error: Failed to clone repository:
/usr/libexec/git-core/git-submodule: line 7: basename: command not found
/usr/libexec/git-core/git-submodule: line 7: sed: command not found
/usr/libexec/git-core/git-sh-setup: line 77: basename: command not found
/usr/libexec/git-core/git-sh-setup: line 77: sed: command not found
/usr/libexec/git-core/git-sh-setup: line 292: uname: command not found
/usr/libexec/git-core/git-submodule: line 671: sed: command not found
/usr/libexec/git-core/git-submodule: line 671: cmd_: command not found
npm error enoent spawn sh ENOENT
npm error path /home/kannan/Projects/Active/tuner
Steps to Reproduce
- Use Fedora 43 (or any merged-usr Linux distro) with zsh as default shell
- Install Claude Code natively:
curl -fsSL https://claude.ai/install.sh | bash - Configure
~/.claude/env.shwith correct absolute paths including/usr/bin,/bin,/sbin - Install
hookifyorsecurity-guidanceplugin (both use Python hooks) - Launch Claude Code
- Observe: hook errors on every tool use, plugin git clone fails, MCP servers fail to spawn
- Verify Bash tool works fine:
which python3 sed basename gitall resolve correctly inside Bash tool - Check
~/.claude/shell-snapshots/— directory is empty, no zsh snapshot created
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.42 (Claude Code)
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
System details:
- Fedora 43, kernel 6.18.9-200.fc43.x86_64
- bubblewrap 0.11.0, socat installed
- Native installation at ~/.local/bin/claude
claude doctorreports clean (no issues)
Root cause analysis:
Fedora uses merged-usr layout: /bin → /usr/bin, /sbin → /usr/sbin. The Bash tool correctly sources env.sh and has full PATH. But hook execution, plugin git clones, and MCP server spawning use a separate code path that does not source env.sh or inherit PATH from the shell.
Additionally, no zsh shell snapshot is created — only old stale bash snapshots existed. Without a snapshot, the sandbox subprocess has no environment to inherit.
Likely affects all merged-usr distros: Fedora, Arch Linux, openSUSE Tumbleweed, recent Debian/Ubuntu.
Workaround: Disable plugins that use hooks (hookify, security-guidance, explanatory-output-style). Core Bash tool functionality is unaffected.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗