Skip to content

fix: mount /etc/hosts in chroot mode for localhost resolution#545

Merged
Mossaka merged 1 commit intomainfrom
fix/chroot-etc-hosts-mount
Feb 6, 2026
Merged

fix: mount /etc/hosts in chroot mode for localhost resolution#545
Mossaka merged 1 commit intomainfrom
fix/chroot-etc-hosts-mount

Conversation

@Mossaka
Copy link
Collaborator

@Mossaka Mossaka commented Feb 6, 2026

Summary

  • In chroot mode with selective /etc mounts, /etc/hosts was not mounted, causing tools like JSDOM/Vitest to fail with getaddrinfo EAI_AGAIN localhost
  • Add a read-only bind mount of /etc/hosts into the chroot (/etc/hosts:/host/etc/hosts:ro)
  • Since /host is the real host root filesystem, a read-only bind mount is the safest approach — no mutation, no cleanup needed

Test plan

  • npm run build compiles
  • npm test — 728 unit tests pass (including new assertion)
  • npm run lint — no errors
  • Verify getent hosts localhost resolves inside chroot

🤖 Generated with Claude Code

In chroot mode with selective /etc mounts, /etc/hosts was not mounted,
causing tools like JSDOM/Vitest to fail with "getaddrinfo EAI_AGAIN
localhost". Add a read-only bind mount of /etc/hosts into the chroot
so hostname resolution works correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 6, 2026 00:58
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Chroot tests failed Smoke Chroot failed - See logs for details.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 82.08% 82.08% ➡️ +0.00%
Statements 82.12% 82.12% ➡️ +0.00%
Functions 81.95% 81.95% ➡️ +0.00%
Branches 75.41% 75.41% ➡️ +0.00%

Coverage comparison generated by scripts/ci/compare-coverage.ts

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in chroot mode where /etc/hosts was not mounted, causing DNS resolution failures for localhost in tools like JSDOM and Vitest. The fix adds a read-only bind mount of /etc/hosts to the selective /etc mounts already in place for chroot mode.

Changes:

  • Add /etc/hosts:/host/etc/hosts:ro mount to chroot mode configuration in docker-manager.ts
  • Add corresponding test assertion to verify the mount is configured correctly

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/docker-manager.ts Adds /etc/hosts to the list of selective /etc mounts for chroot mode with appropriate inline comment
src/docker-manager.test.ts Adds test assertion to verify /etc/hosts is included in volumes when chroot mode is enabled

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Build Test: Node.js - Results

Project Install Tests Status
clsx PASS ✅ PASS
execa PASS ✅ PASS
p-limit PASS ✅ PASS

Overall: ✅ PASS

All Node.js test projects successfully installed dependencies and passed their test suites.

AI generated by Build Test Node.js

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Deno Build Test Results

Project Tests Status
oak 1/1 ✅ PASS
std 1/1 ✅ PASS

Overall: ✅ PASS

All Deno tests completed successfully.

AI generated by Build Test Deno

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Smoke Test: Claude ✅

Last 2 merged PRs:

✅ GitHub MCP
✅ Playwright (page title contains "GitHub")
✅ File write
✅ Bash tool

Status: PASS

AI generated by Smoke Claude

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Smoke Test Results 🚀

Last 2 merged PRs:

✅ GitHub MCP: Working (via list_pull_requests)
✅ Playwright: GitHub homepage verified ("GitHub · Change is constant. GitHub keeps you ahead.")
✅ File Writing: Test file created successfully
✅ Bash Tool: File read verification passed

Overall: PASS

cc: @Mossaka

AI generated by Smoke Copilot

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Go Build Test Results

Project Download Tests Status
color 1/1 PASS ✅
env 1/1 PASS ✅
uuid 1/1 PASS ✅

Overall: PASS ✅

All Go projects successfully downloaded dependencies and passed their tests.

AI generated by Build Test Go

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

C++ Build Test Results

Project CMake Build Status
fmt PASS
json PASS

Overall: PASS

All C++ projects built successfully.

AI generated by Build Test C++

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Build Test: Java - FAILED ❌

Status: ENVIRONMENT ERROR

Unable to execute Java build tests due to broken Java runtime environment in GitHub Actions runner.

Error Details

The Java binary in the runner environment is corrupted or misconfigured:

  • Expected: Java VM executable
  • Actual: Executing bash shell instead
  • Path: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/21.0.10-7/x64/bin/java

Test Results

Project Compile Tests Status
gson N/A BLOCKED
caffeine N/A BLOCKED

Overall: FAIL - Environment Issue

Reproduction

$ java -version
GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)

This test cannot proceed until the Java runtime is fixed in the runner environment.

AI generated by Build Test Java

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Build Test: Bun - FAILED ❌

Environment Issue: Bun runtime cannot function in this containerized environment.

Results

Project Install Tests Status
elysia N/A FAIL
hono N/A FAIL

Overall: FAIL

Error Details

Bun installation succeeded, but bun install fails with:

error: An internal error occurred (NotDir)

Root Cause: Bun requires /proc/cpuinfo and other /proc entries that are not available in this container. The /proc directory only contains self/, lacking essential system information files.

Required Action: This test needs to run in an environment with full /proc filesystem access (non-containerized or with proper mounts).

AI generated by Build Test Bun

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Build Test: Rust - Environment Issue

Status: FAILED

Summary

Unable to execute Rust build and test workflow due to environment configuration issue.

Details

  • ✅ Repository cloned successfully: Mossaka/gh-aw-firewall-test-rust
  • ✅ Rust toolchain installed successfully (rustup 1.93.0)
  • Critical Issue: Rust binaries (cargo, rustup, rustc) cannot be executed with arguments

Technical Details

All attempts to execute Rust tooling result in bash version output instead of the expected tool output:

$ /home/runner/.cargo/bin/cargo build
# Expected: Cargo build output
# Actual: GNU bash, version 5.2.21(1)-release...

$ /home/runner/.cargo/bin/rustup --version
# Expected: rustup version
# Actual: GNU bash, version 5.2.21(1)-release...

This suggests a fundamental issue with how the bash execution environment is passing arguments to Rust binaries in the GitHub Actions runner.

Investigation Attempted

  1. Verified Rust installation (toolchain present at /home/runner/.cargo/bin/)
  2. Tested multiple execution methods (direct path, env variables, Python subprocess)
  3. Checked for aliases, functions, and environment overrides
  4. Verified binary integrity (valid ELF executables with correct permissions)
  5. All approaches resulted in the same behavior

Required Action

This requires investigation into:

  • GitHub Actions runner bash configuration
  • Potential interference from environment setup
  • Compatibility issues between the bash tool execution mechanism and Rust binaries

Cannot complete build/test validation for fd and zoxide projects until this environment issue is resolved.

AI generated by Build Test Rust

@Mossaka Mossaka merged commit 48b61f8 into main Feb 6, 2026
83 of 84 checks passed
@Mossaka Mossaka deleted the fix/chroot-etc-hosts-mount branch February 6, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant