Brain Structural Validation / Validate Markdown Structure & Links (push) Successful in 6s
4.5 KiB
4.5 KiB
type, project, date, tags
| type | project | date | tags | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| debug | homelab | 2026-09-21 |
|
Remediation: Gitea Actions Nix Container FHS and Entrypoint Failure
Problem Statement
After switching the validate CI job in homelab-core to run inside a container (nixos/nix:latest), Gitea Actions workflows consistently failed during the container setup step:
failed to start container: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: exec: "/bin/sleep": stat /bin/sleep: no such file or directory
Research & Hypotheses
- Act Runner Entrypoint Invariant: Gitea's
act_runner(based onnektos/act) initiates job containers withentrypoint: ["/bin/sleep", "10800"]to keep the background container process alive while executing subsequent step commands viadocker exec. - Non-FHS NixOS Container Layout: The official
nixos/nixcontainer image provides a minimal Nix store environment where standard utilities reside in/root/.nix-profile/bin/rather than/bin/or/usr/bin/(only/bin/shand/usr/bin/envare symlinked), resulting instat /bin/sleep: no such file or directory. - Step Runtime Requirements: Actions steps like
actions/checkout@v4are JavaScript actions executed vianodewithin the container context, requiring a Node.js runtime and standard POSIX tools. In addition, single-user Nix inside unprivileged containers requiresbuild-users-group =to evaluate derivations without missingnixbldgroup errors.
Diagnostics & Findings
- Container Path Inspection:
docker run --rm --entrypoint /bin/sh nixos/nix:latest -c "ls -la /bin /usr/bin"confirmed that/bin/sleepis absent innixos/nix:latest.
- Runner Log Analysis:
- Task
#87and#88aborted immediately at container spawn due to missing/bin/sleep. - Task
#89tested withnixery.dev/shell/coreutils/git/nix:latestresolved the container start issue, but failed inactions/checkoutwithexec: "node": executable file not found in $PATH. - Flake checks inside the container threw
error: the group 'nixbld' specified in 'build-users-group' does not existwhenbuild-users-groupwas unset.
- Task
Remediation / Fix
- FHS-Compliant Pre-Baked Toolchain Container:
Updated
.gitea/workflows/ci.yamlto usenixery.dev/shell/coreutils/git/nix/nodejs:latest. This provides standard/bin/sleep,git,bash,nix, andnodebinaries in standard FHS paths. - Nix Flake & Single-User Runner Configuration:
Configured
nix.confwith both flake flags and single-user build group bypass:- name: Configure Git Safe Directory & Nix Flakes run: | git config --global --add safe.directory "$GITHUB_WORKSPACE" mkdir -p ~/.config/nix echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf echo "build-users-group =" >> ~/.config/nix/nix.conf - Documentation & Agent Guidelines:
Updated
Core/docs/gitops.mdandHomelab/AGENTS.mdto document theact_runnerFHS and entrypoint requirements. - Local and Server Verification:
Pre-pulled the image to
server-local, ran local./scripts/test, and pushed commitdc02893toorigin/main.
Results & Verification
- Gitea Actions spawned task
#90onhomelab-runner. - Container
GITEA-ACTIONS-TASK-90-...initialized cleanly with/bin/sleep. actions/checkout@v4executed with Node.js and checked out the repository.nix flake checkevaluated all 35 tests, NixOS server flake definitions, and architecture invariants cleanly.- Job succeeded with exit code 0 (
🏁 Job succeeded).
Takeaways & Prevention
- Act Runner Expects FHS Binaries: Any container specified under
container: { image: ... }in Gitea Actions /act_runnermust include/bin/sleep,sh, andnode(if running JS-based GitHub/Gitea actions). - Use Nixery for Composable CI Toolchains:
nixery.dev/shell/coreutils/git/nix/nodejsprovides an ad-hoc, declarative container image that satisfies both FHS runner requirements and hermetic Nix flake toolchains without maintaining separate custom Dockerfiles. - Set
build-users-group =in Single-User Containers: Without the nix-daemon andnixbldsystem group, containerized Nix builds require an emptybuild-users-groupinnix.conf.