Skip to content

bug: virtiofs mounted source tree can make tar fail with Bad file descriptor #18

Description

@ZhiXiao-Lin

Summary

While trying to run ShuanOS verification inside a3s-box, copying a host-mounted repository tree from the guest with tar failed with Cannot close: Bad file descriptor for files under the mounted source tree.

This makes the box unreliable for CI-style verification workflows that mount a repo read-only and copy it into a guest-local temporary workspace before installing Linux-native dependencies.

Environment

  • Host: macOS, /Users/roylin/code/os
  • a3s-box version: 3.0.8
  • Image: docker.io/library/node:24-bookworm
  • Volume: -v /Users/roylin/code/os:/workspace
  • Workdir: /workspace

Reproduction

a3s-box run --rm \
  --cpus 4 \
  --memory 6g \
  --package-cache pnpm \
  -v /Users/roylin/code/os:/workspace \
  -w /workspace \
  docker.io/library/node:24-bookworm -- \
  bash -lc 'set -euxo pipefail; rm -rf /tmp/os-check; mkdir -p /tmp/os-check; tar --exclude=./node_modules --exclude=./.git --exclude=./dist --exclude=./temp --exclude=./storage --exclude=./.pnpm-store -cf - . | tar -C /tmp/os-check -xf -; cd /tmp/os-check; corepack enable; pnpm install --frozen-lockfile --prefer-offline; pnpm exec biome --version'

Actual result

The copy failed inside the mounted tree:

tar: ./apps/api/storage/git-cache/repositories/29e48e48-42ad-431d-a480-472fb4765010.git/hooks/pre-merge-commit.sample: Cannot close: Bad file descriptor
tar: ./apps/api/storage/git-cache/repositories/616d184f-1a33-4fbf-b982-b18da059b0c4.git/hooks/pre-push.sample: Cannot close: Bad file descriptor
tar: ./apps/api/builtin-assets/agents/legal/contract-review/web/node_modules/resolve/test/dotdot/index.js: Cannot close: Bad file descriptor
tar: ./apps/api/builtin-assets/agents/legal/contract-review/server/node_modules/@angular-devkit/schematics/node_modules/rxjs/dist/cjs/internal/observable/fromEvent.js: Cannot close: Bad file descriptor
tar: Exiting with failure status due to previous errors

Expected result

Reading regular files from a mounted source tree should not fail with Bad file descriptor. If a host-side file changes during traversal, the error should be explicit and limited to that race, not a generic close failure.

Notes

A workaround for this deploy was to avoid a3s-box for verification and use Docker on the server, but this blocks using A3S Box as the default build/release environment for this repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/buildDockerfile build and image constructionarea/logsLogs, diagnostics, and failure evidencebugSomething isn't workingpriority/highHigh priority regression or production blocker

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions