Skip to content

Commit 845c3eb

Browse files
author
User
committed
fix(setup): use Alpine base image so stderr reaches /dev/console
FROM scratch has no shell, so exec binary 2>/dev/console is not possible there. Alpine provides /bin/sh and mounts devtmpfs so /dev/console is accessible. The nautilus musl-static binary runs unchanged inside Alpine. This makes tracing output and vsock bind errors visible on the Nitro debug console (nitro-cli console --enclave-id <id>).
1 parent 09de244 commit 845c3eb

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

enclave-setup.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,13 @@ PYEOF
230230
fi
231231
sleep 0.5
232232
fi
233+
# After unloading nitro_enclaves, also cycle vsock so the kernel's
234+
# vsock transport table is reset. Without this, re-loading
235+
# nitro_enclaves may silently fail to re-register its transport and
236+
# every subsequent AF_VSOCK connect returns ENODEV.
237+
rmmod vsock 2>/dev/null || true
238+
sleep 0.3
239+
modprobe vsock 2>/dev/null || true
233240
# Re-online any CPUs the previous module load took offline.
234241
# rmmod does not always restore CPU online state; if they're still
235242
# offline when we modprobe, the driver returns EINVAL.
@@ -288,10 +295,13 @@ step "Building Docker image for EIF"
288295
# The host-side socat bridges: TCP-LISTEN:3000 → VSOCK-CONNECT:CID:3000.
289296
# FROM scratch keeps the EIF minimal and the PCR measurements stable.
290297
cat > "$BUILD_DIR/Dockerfile" <<'EOF'
291-
FROM scratch
298+
FROM alpine:3.19
299+
RUN apk add --no-cache ca-certificates
292300
COPY slcl-nautilus /app/slcl-nautilus
293301
ENV PORT=3000
294-
ENTRYPOINT ["/app/slcl-nautilus"]
302+
# Shell wrapper: redirect stderr to /dev/console so tracing output and any
303+
# startup errors are visible on the nitro-cli debug console.
304+
ENTRYPOINT ["/bin/sh", "-c", "exec /app/slcl-nautilus 2>/dev/console"]
295305
EOF
296306

297307
docker build -t slcl-nautilus:latest "$BUILD_DIR/" 2>&1 | grep -v "^#" | tail -5

0 commit comments

Comments
 (0)