Skip to content

Commit 3ec2038

Browse files
authored
[docker image] set filter-syscalls = false in nix.conf to workaround missing seccomp BPF program in arm64 linux (#2665)
## Summary The docker-image is failing to build in GHA: https://github.com/jetify-com/devbox/actions/runs/16204700194/job/47358742840 The error indicates that the seccomp (secure computing mode) BPF (Berkeley Packet Filter) program that Nix tries to load is incompatible with the Docker container environment on ARM64. When filter-syscalls = true (the default), Nix uses seccomp BPF to filter system calls for security sandboxing. Setting filter-syscalls = false disables Nix's syscall filtering, which bypasses the seccomp BPF program entirely and prevents the error. This PR uses the approach from #1811 to fix this for arm64 platforms. ## How was it tested? `docker build --platform linux/arm64 -t devbox-image-arm64 -f /Users/savil/code/jetpack/devbox/internal/devbox/generate/tmpl/DevboxImageDockerfile .` `docker build --platform linux/arm64 -t devbox-image-arm64 -f /Users/savil/code/jetpack/devbox/internal/devbox/generate/tmpl/DevboxImageDockerfileRootUser .` BEFORE: these failed with the error seen in the GHA above AFTER: build successfully Also confirmed that --platform linux/amd64 would build successfully ## Community Contribution License All community contributions in this pull request are licensed to the project maintainers under the terms of the [Apache 2 License](https://www.apache.org/licenses/LICENSE-2.0). By creating this pull request, I represent that I have the right to license the contributions to the project maintainers under the Apache 2 License as stated in the [Community Contribution License](https://github.com/jetify-com/opensource/blob/main/CONTRIBUTING.md#community-contribution-license).
1 parent 4427ad0 commit 3ec2038

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

internal/devbox/generate/tmpl/DevboxImageDockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,27 @@ ARG DEVBOX_USE_VERSION
77
RUN apt-get update
88
RUN apt-get -y install bash binutils git xz-utils wget sudo
99

10-
# Step 1.5: Setting up devbox user
10+
# Step 2: Prepare for Nix
11+
ARG TARGETPLATFORM
12+
RUN mkdir -p /etc/nix/
13+
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ] || [ "$TARGETPLATFORM" = "linux/arm64/v8" ]; then \
14+
echo "filter-syscalls = false" >> /etc/nix/nix.conf; \
15+
fi
16+
17+
# Step 3: Setting up devbox user
1118
ENV DEVBOX_USER=devbox
1219
RUN adduser $DEVBOX_USER
1320
RUN usermod -aG sudo $DEVBOX_USER
1421
RUN echo "devbox ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/$DEVBOX_USER
1522
USER $DEVBOX_USER
1623

17-
# Step 2: Installing Nix
24+
# Step 4: Installing Nix
1825
RUN wget --output-document=/dev/stdout https://nixos.org/nix/install | sh -s -- --no-daemon
1926
RUN . ~/.nix-profile/etc/profile.d/nix.sh
2027

2128
ENV PATH="/home/${DEVBOX_USER}/.nix-profile/bin:$PATH"
2229

23-
# Step 3: Installing devbox
30+
# Step 5: Installing devbox
2431
ENV DEVBOX_USE_VERSION=$DEVBOX_USE_VERSION
2532
RUN wget --quiet --output-document=/dev/stdout https://get.jetify.com/devbox | bash -s -- -f
2633
RUN chown -R "${DEVBOX_USER}:${DEVBOX_USER}" /usr/local/bin/devbox

internal/devbox/generate/tmpl/DevboxImageDockerfileRootUser

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ RUN apt-get update
88
RUN apt-get -y install bash binutils git xz-utils wget sudo
99

1010
# Step 2: Installing Nix
11+
ARG TARGETPLATFORM
1112
RUN mkdir -p /etc/nix/
12-
RUN echo "filter-syscalls = false" >> /etc/nix/nix.conf && wget --output-document=/dev/stdout https://nixos.org/nix/install | sh -s -- --daemon
13+
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ] || [ "$TARGETPLATFORM" = "linux/arm64/v8" ]; then \
14+
echo "filter-syscalls = false" >> /etc/nix/nix.conf; \
15+
fi
16+
RUN wget --output-document=/dev/stdout https://nixos.org/nix/install | sh -s -- --daemon
1317
RUN . ~/.nix-profile/etc/profile.d/nix.sh
1418

1519
ENV PATH="/root/.nix-profile/bin:$PATH"

0 commit comments

Comments
 (0)