Skip to content

fix(alpine): fix glibc busybox sync and missing /usr/bin/ionice+nice for musl builds - #3598

Open
AdaAibaby wants to merge 2 commits into
e2b-dev:mainfrom
AdaAibaby:fix/alpine-sync-ionice-nice
Open

fix(alpine): fix glibc busybox sync and missing /usr/bin/ionice+nice for musl builds#3598
AdaAibaby wants to merge 2 commits into
e2b-dev:mainfrom
AdaAibaby:fix/alpine-sync-ionice-nice

Conversation

@AdaAibaby

@AdaAibaby AdaAibaby commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Problem

Fixes #3597

Three bugs cause Alpine template builds/sandboxes to fail.

Changes

1. sandboxtools/command.go — fix SyncChangesToDisk for musl/Alpine

SyncChangesToDisk was invoking /usr/bin/busybox sync (glibc-linked, injected by e2b). On Alpine (musl libc) this binary cannot be executed. Replace with plain sync + an explicit PATH so any distro's native sync is found.

2. distro/init.go — add /usr/bin/{ionice,nice} symlinks in Alpine InitOpenRC

envd's OOM wrapper hard-codes /usr/bin/ionice and /usr/bin/nice. On Alpine:

  • util-linux-misc installs ionice to /bin/ionice (not /usr/bin/ionice)
  • nice is only at /bin/nice (busybox symlink)

Verified: docker run --rm alpine:3.22 sh -c 'apk add --no-cache util-linux-misc >/dev/null 2>&1; ls /usr/bin/ionice /usr/bin/nice 2>&1' → both No such file or directory. Without symlinks every command envd spawns during the step layer exits 127.

3. distro/init.go — mount devpts + ensure /dev/ptmx exists at boot

Without devpts mounted at /dev/pts, opening /dev/ptmx fails with ENOENT, breaking all PTY/terminal connections (e2b sbx cr returns open /dev/ptmx: no such file or directory).

On Alpine with busybox init + OpenRC: devtmpfs may not auto-mount /dev/ptmx, and OpenRC's devfs service does not mount devpts. Add an early ::sysinit inittab entry (runs before openrc sysinit) that:

  1. Mounts devpts at /dev/pts
  2. Creates /dev/ptmx via mknod as a fallback if devtmpfs hasn't created it

Test plan

  • Build an Alpine 3.22 template — base layer and step layer complete without exit status 127
  • e2b sbx cr <alpine-template> — terminal connects successfully (no /dev/ptmx error)
  • Verify Debian/Ubuntu templates still work (sync + PTY unaffected)

Two bugs that cause Alpine template builds to fail at the base layer:

1. SyncChangesToDisk called rootfs.SandboxBusyBoxPath (glibc-linked /usr/bin/busybox)
   which cannot execute on Alpine musl; replace with plain "sync" + explicit PATH.

2. envd OOM wrapper hard-codes /usr/bin/ionice and /usr/bin/nice. util-linux-misc
   installs ionice to /bin/ionice (not /usr/bin) and busybox ships nice to /bin/nice.
   Add symlinks in the Alpine InitOpenRC provisioning step so the paths resolve.
Without devpts mounted at /dev/pts, opening /dev/ptmx fails with ENOENT.
Add an early ::sysinit inittab entry (before OpenRC sysinit) that mounts
devpts and creates /dev/ptmx via mknod as a fallback if devtmpfs did not
auto-create it. Required for e2b terminal / PTY connections to work.
@AdaAibaby

Copy link
Copy Markdown
Contributor Author

template built successfully and can derive sandboxes normally
image

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.

Alpine template builds fail: glibc busybox in SyncChangesToDisk + missing /usr/bin/ionice and /usr/bin/nice

2 participants