[BUG] Unable to run claude code in FreeBSD Linux emulator jail
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?
Created a Linux jail in FreeBSD, this is like running on Ubuntu 22.04, it should work, but it fails.
```root@aitools:/# curl -fsSL https://claude.ai/install.sh | bash
Setting up Claude Code...
6 | // and may be used to improve Anthropic's products, including training models.
7 | // You are responsible for reviewing any code suggestions before use.
8 |
9 | // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
10 |
11 | var nfB=Object.create;var{getPrototypeOf:rfB,defineProperty:Fe,getOwnPropertyNames:spH,getOwnPropertyDescriptor:ofB}=Object,epH=Object.prototype.hasOwnProperty,mA=(H,$,A)=>{for(let L of spH($))if(!epH.call(H,L)&&L!=="default")Fe(H,L,{get:()=>$[L],enumerable:!0});if(A){for(let L of spH($))if(!epH.call(A,L)&&L!=="default")Fe(A,L,{get:()=>$[L],enumerable:!0});return A}},R=(H,$,A)=>{A=H!=null?nfB(rfB(H)):{};let L=$||!H||!H.__esModule?Fe(A,"default",{value:H,enumerable:!0}):A;for(let I of spH(H))if(!epH.call(L,I))Fe(L,I,{get:()=>H[I],enumerable:!0});return L},ukA=new WeakMap,Lb=(H)=>{var $=ukA.get(H),A;if($)return $;if($=Fe({},"__esModule",{value:!0}),H&&typeof H==="object"||typeof H==="function")spH(H).map((L)=>!epH.call($,L)&&Fe($,L,{get:()=>H[L],enumerable:!(A=ofB(H,L))||A.enumerable}));return ukA.set(H,$),$},N=(H,$)=>()=>($||H(($={exports:{}}).exports,$),$.exports);var UD=(H,$)=>{for(var A in $)Fe(H,A,{get:$[A],enumerable:!0,configurable:!0,set:(L)=>$[A]=()=>L})};var K=(H,$)=>()=>(H&&($=H(H=0)),$);var gkA=N((f | ... truncated
ENOENT: no such file or directory, lstat '/'
path: "/",
syscall: "lstat",
errno: -2,
code: "ENOENT"
at ymA (/$bunfs/root/claude:11:30009)
at <anonymous> (/$bunfs/root/claude:11:40632)
at <anonymous> (/$bunfs/root/claude:11:1003)
at <anonymous> (/$bunfs/root/claude:12:167)
at <anonymous> (/$bunfs/root/claude:11:1003)
at <anonymous> (/$bunfs/root/claude:14:238)
at <anonymous> (/$bunfs/root/claude:11:1003)
at <anonymous> (/$bunfs/root/claude:14:9079)
at <anonymous> (/$bunfs/root/claude:11:1003)
Bun v1.3.5 (Linux x64 baseline)```
What Should Happen?
It should work
Error Messages/Logs
Steps to Reproduce
FreeBSD Version
Latest FreeBSD FreeBSD 15.0-RELEASE
Enable Linux Compatibility
sysrc linux_enable="YES"
service linux start
echo 'linux64_load="YES"' >> /boot/loader.conf
Bootstrap Linux Userland with Debootstrap
pkg install debootstrap
# Create jail directory
mkdir -p /jails/aitools
# Bootstrap Ubuntu 22.04 (jammy) into the jail
debootstrap --arch=amd64 jammy /jails/aitools http://archive.ubuntu.com/ubuntu
Jail creation
# /etc/jail.conf
aitools {
# HOSTNAME/PATH
host.hostname = "aitools.jail";
path = "/jails/aitools";
# NETWORK - inherit host's network stack (simplest, has full internet access)
ip4 = inherit;
ip6 = inherit;
# LOGGING
exec.consolelog = "/var/log/jail_console_${name}.log";
# Mount devfs
mount.devfs;
devfs_ruleset = 4;
# Allow Linux compatibility mounts
allow.mount;
allow.mount.devfs;
allow.mount.fdescfs;
allow.mount.procfs;
allow.mount.linprocfs;
allow.mount.linsysfs;
allow.mount.tmpfs;
enforce_statfs = 1;
# Networking
allow.raw_sockets;
# For Linux jails: no FreeBSD rc scripts
exec.start = "";
exec.stop = "";
# Persist
persist;
}
Enable the jail service:
sysrc jail_enable="YES"
sysrc jail_parallel_start="YES"
Configure the Linux Jail
Set up basic configuration inside the jail:
# Set up DNS resolution
echo "nameserver 1.1.1.1" > /jails/aitools/etc/resolv.conf
# Set hostname
echo "aitools" > /jails/aitools/etc/hostname
# Configure apt sources
cat > /jails/aitools/etc/apt/sources.list << 'EOF'
deb http://archive.ubuntu.com/ubuntu jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu jammy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu jammy-security main restricted universe multiverse
EOF
Mount Required Filesystems
Create a script to mount Linux filesystems before starting the jail. Add to /etc/fstab.aitools:
linprocfs /jails/aitools/proc linprocfs rw 0 0
linsysfs /jails/aitools/sys linsysfs rw 0 0
tmpfs /jails/aitools/dev/shm tmpfs rw,mode=1777 0 0
devfs /jails/aitools/dev devfs rw 0 0
Create mount points and mount:
mkdir -p /jails/aitools/proc /jails/aitools/sys /jails/aitools/dev/shm
mount -F /etc/fstab.aitools -a
Start and Enter the Jail
Start the jail:
service jail start aitools
Enter the jail using Linux shell:
jexec aitools /bin/bash
Update and Install Essential Packages
Inside the jail, update the system and install prerequisites:
# Update package lists
apt update
# Upgrade existing packages
apt upgrade -y
# Install essential tools
apt install -y curl wget ca-certificates gnupg
Claude installation
root@aitools:/# curl -fsSL https://claude.ai/install.sh | bash
Setting up Claude Code...
6 | // and may be used to improve Anthropic's products, including training models.
7 | // You are responsible for reviewing any code suggestions before use.
8 |
9 | // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
10 |
11 | var nfB=Object.create;var{getPrototypeOf:rfB,defineProperty:Fe,getOwnPropertyNames:spH,getOwnPropertyDescriptor:ofB}=Object,epH=Object.prototype.hasOwnProperty,mA=(H,$,A)=>{for(let L of spH($))if(!epH.call(H,L)&&L!=="default")Fe(H,L,{get:()=>$[L],enumerable:!0});if(A){for(let L of spH($))if(!epH.call(A,L)&&L!=="default")Fe(A,L,{get:()=>$[L],enumerable:!0});return A}},R=(H,$,A)=>{A=H!=null?nfB(rfB(H)):{};let L=$||!H||!H.__esModule?Fe(A,"default",{value:H,enumerable:!0}):A;for(let I of spH(H))if(!epH.call(L,I))Fe(L,I,{get:()=>H[I],enumerable:!0});return L},ukA=new WeakMap,Lb=(H)=>{var $=ukA.get(H),A;if($)return $;if($=Fe({},"__esModule",{value:!0}),H&&typeof H==="object"||typeof H==="function")spH(H).map((L)=>!epH.call($,L)&&Fe($,L,{get:()=>H[L],enumerable:!(A=ofB(H,L))||A.enumerable}));return ukA.set(H,$),$},N=(H,$)=>()=>($||H(($={exports:{}}).exports,$),$.exports);var UD=(H,$)=>{for(var A in $)Fe(H,A,{get:$[A],enumerable:!0,configurable:!0,set:(L)=>$[A]=()=>L})};var K=(H,$)=>()=>(H&&($=H(H=0)),$);var gkA=N((f | ... truncated
ENOENT: no such file or directory, lstat '/'
path: "/",
syscall: "lstat",
errno: -2,
code: "ENOENT"
at ymA (/$bunfs/root/claude:11:30009)
at <anonymous> (/$bunfs/root/claude:11:40632)
at <anonymous> (/$bunfs/root/claude:11:1003)
at <anonymous> (/$bunfs/root/claude:12:167)
at <anonymous> (/$bunfs/root/claude:11:1003)
at <anonymous> (/$bunfs/root/claude:14:238)
at <anonymous> (/$bunfs/root/claude:11:1003)
at <anonymous> (/$bunfs/root/claude:14:9079)
at <anonymous> (/$bunfs/root/claude:11:1003)
Bun v1.3.5 (Linux x64 baseline)
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.16
Platform
Anthropic API
Operating System
Other
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗