Skip to content

fix(install): check for unzip and a C compiler up front (gh#755) - #756

Open
vsbuffalo wants to merge 1 commit into
mainfrom
fix/install-e2e-bwrap-userns
Open

fix(install): check for unzip and a C compiler up front (gh#755)#756
vsbuffalo wants to merge 1 commit into
mainfrom
fix/install-e2e-bwrap-userns

Conversation

@vsbuffalo

Copy link
Copy Markdown
Owner

Fixes #755. install-e2e had never passed — 65 runs, 0 successes, since it was added on 2026-06-23. This branch is the first green run: https://github.com/vsbuffalo/camdl/actions/runs/32994432454

Cause: a preflight gap, reported as the wrong problem

ensure_base_tools checked only make git curl tar. But opam refuses to init without unzip, and the OCaml switch is compiled from source so it needs a C compiler. Neither was checked, and neither was in the test image:

[ERROR] Missing dependencies -- the following commands are required for opam to operate:
  - unzip

install.sh funnels any opam init failure into a catch-all that prints "bubblewrap isn't installed, or your kernel doesn't allow unprivileged user namespaces". bubblewrap was installed and namespaces were not the problem — so the job, and any real user on a minimal box, was sent to debug a nonexistent problem. That misdirection is the substantive half of the bug; it cost me a wrong diagnosis on first read of these logs.

Second, real wall behind it

Once unzip is present, opam init reaches its sandbox check, and that genuinely cannot work in a docker build RUN layer. Verified directly with a minimal image:

context result
bwrap in a docker build RUN layer No permissions to create new namespace
docker run, Docker defaults No permissions to create new namespace
docker run --security-opt seccomp=unconfined --security-opt apparmor=unconfined works

So the install moves out of the image build into docker run (tests/install/run.sh, also the local repro).

That relaxes the container's confinement, not the install's: the image still has no sudo and still runs as the non-root builder user, so the claim the job makes — install.sh needs zero privilege — is unchanged and still enforced. What it buys is that opam's sandbox is genuinely active, which is what real users get.

Deliberately not NO_SANDBOX=1: that would turn the job green by deleting exactly what it verifies.

Worth knowing

Because this job had never passed, nothing downstream of opam init had ever run. This green run is the first time the portable-CMake fetch, the opam prebuilt-binary path, and the glibc-2.27 from-source build have actually been exercised.

`install-e2e` has failed on every run since it was added — 65 runs, 0
successes, back to 2026-06-23 — each in ~45s, far too fast for the
from-source build it claims to exercise.

The cause is a preflight gap, not the sandbox. `ensure_base_tools`
checked only make/git/curl/tar. opam REFUSES to init without `unzip`,
and the OCaml switch is compiled from source so it needs a C compiler;
neither was checked, and neither is in the test image. opam's own
"Missing dependencies -- unzip" then fell into install.sh's catch-all
`opam init` failure branch, which prints a bubblewrap / user-namespace
hint. So the job — and any real user on a minimal box — was told to go
fix an unprivileged-namespace problem that did not exist.

Check both in `ensure_base_tools`, so the failure is named where it
happens, and add them to the image as the "an admin provisioned the box"
prerequisites they are.

Also move the install out of the image build into `docker run`. That is
a genuine second wall, just not the one that was being hit: `opam init`
sandboxes with bubblewrap, which needs an unprivileged user namespace,
and `docker build` cannot grant one (buildkit gates it behind an
`insecure` entitlement needing a custom builder). Verified directly —
bwrap fails in a RUN layer, fails under `docker run` with Docker's
defaults, and succeeds under `docker run --security-opt
seccomp=unconfined --security-opt apparmor=unconfined`.

That relaxes the CONTAINER's confinement, not the install's: no sudo in
the image, still a non-root `builder` user, so the claim the job makes —
install.sh needs zero privilege — is unchanged and still enforced.
Deliberately not `NO_SANDBOX=1`: that would go green by deleting exactly
what the job verifies.

Because the job has never passed, nothing downstream of `opam init` has
ever run — the portable-CMake fetch, the opam prebuilt-binary path and
the glibc-2.27 build remain unverified until it is green.
@vsbuffalo
vsbuffalo force-pushed the fix/install-e2e-bwrap-userns branch from c269d73 to cae5666 Compare August 26, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

install-e2e has never passed: install.sh never checks for unzip or a C compiler, and opam's error is reported as a bubblewrap problem

1 participant