Skip to content

[BUG] Nix image lacks /usr/bin/env — breaks #!/usr/bin/env shebangs for all consumers #727

Closed

Description

@c-vigo

Description

The Nix-built devcontainer image (dockerTools.buildLayeredImage, flake.nix packages.devcontainerImage) does not provide /usr/bin/env — in fact /usr/bin does not exist at all. env is only available at /bin/env.

The canonical portable shebang #!/usr/bin/env <interp> (used by virtually every Node, Python, Ruby, etc. CLI) therefore fails inside the image. This blocks essentially every Node/TypeScript (and many other) downstream consumers running in devcontainer/image mode.

Discovered while live-testing the migration against the commit-action consumer.

Steps to Reproduce

  1. just build (loads ghcr.io/vig-os/devcontainer:dev).
  2. Run a Node/TS project in the image, e.g.:
    podman run --rm -v <commit-action>:/workspace/commit_action -w /workspace/commit_action \
      ghcr.io/vig-os/devcontainer:dev bash -lc 'npm ci && npm run build'
    
  3. Observe tsc (and any local node_modules/.bin/*) fail.

Expected Behavior

/usr/bin/env exists, so #!/usr/bin/env node (and other interpreters) resolve and locally-installed CLIs run.

Actual Behavior

sh: /workspace/commit_action/node_modules/.bin/tsc: /usr/bin/env: bad interpreter: No such file or directory
$ ls -l /usr/bin/env   # No such file or directory   (/usr/bin does not exist)
$ ls -l /bin/env       # /bin/env -> coreutils

Confirmed fix in-container: after mkdir -p /usr/bin && ln -sf /bin/env /usr/bin/env, npm run build succeeds and the full commit-action Jest suite passes (80/80).

Environment

  • OS: NixOS (host); image is hermetic Nix (no base distro)
  • Container Runtime: Podman 5.8.2
  • Image Version/Tag: dev (locally built from feature/625-nix-claude-migration via just build)
  • Architecture: AMD64

Additional Context

Part of the Nix migration master issue #625 / image task #634. Likely a hard blocker for the publish-cutover (#639). Distinct from #687 (which is about #!/bin/bash in host scripts).

Possible Solution

Add the standard /usr/bin/env (and /usr/bin, /bin/sh) symlinks in the image. nixpkgs dockerTools provides helpers exactly for this — include pkgs.dockerTools.usrBinEnv (and binSh) in the image contents, or add an extraCommands/fakeRootCommands step that symlinks usr/bin/env -> /bin/env.

Changelog Category

Fixed

Activity

  1. added
    bug
    priority:high
    area:image
    effort:small
    semver:patch
    on Jun 29, 2026
  2. added 3 commits that reference this issue on Jun 29, 2026
    ef1309d
    31c77a5
    63d6b33
  3. c-vigo commented on Jun 30, 2026

    @c-vigo
    ContributorAuthor

    Resolved by #730 (f5679cd) on the Nix-migration branch (epic #625, PR #670). Closing as part of post-merge backlog hygiene (#677).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:imagebugeffort:smallpriority:highsemver:patch

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions