refactor: Use chroot instead of systemd-nspawn for workspace entry

- Replace systemd-nspawn with chroot to avoid nested container audit errors
- Add manual bind mount setup for /home/ai:/root sharing
- Add mount and chroot to sudoers permissions
- chroot avoids kernel audit subsystem conflicts in nested containers
This commit is contained in:
Claude
2025-11-07 18:59:08 +00:00
parent 66a5c6d16f
commit 30ebfcf933
2 changed files with 6 additions and 2 deletions

View File

@@ -75,7 +75,11 @@ if [[ -o login ]] && [[ -o interactive ]]; then
if [[ -z "$INSIDE_WORKSPACE" ]]; then
# Running as ai user on aios OS - enter workspace container
export INSIDE_WORKSPACE=1
exec sudo systemd-nspawn -q -D /var/lib/machines/workspace /bin/zsh
# Setup bind mount for shared user directory
sudo mkdir -p /var/lib/machines/workspace/root 2>/dev/null || true
sudo mount --bind /home/ai /var/lib/machines/workspace/root 2>/dev/null || true
# Enter workspace via chroot (avoiding nested systemd-nspawn audit issues)
exec sudo chroot /var/lib/machines/workspace /bin/zsh
else
# Running as root inside workspace container - start claude
if command -v claude &>/dev/null; then