Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Error: unable to load seccomp BPF program: Invalid argument #22

Closed
AmitKumarDas opened this issue Apr 11, 2023 · 1 comment
Closed

Error: unable to load seccomp BPF program: Invalid argument #22

AmitKumarDas opened this issue Apr 11, 2023 · 1 comment

Comments

@AmitKumarDas
Copy link

AmitKumarDas commented Apr 11, 2023

I get following error while trying to build a docker image using the README instructions. Note that I am using Docker desktop on Mac.

 => ERROR [build 3/3] RUN   nix-env -f default.nix -iA myEnv --show-trace   && export-profile /dist                          13.1s
------                                                                                                                             
 > [build 3/3] RUN   nix-env -f default.nix -iA myEnv --show-trace   && export-profile /dist:                                      
#7 0.804 installing 'env'                                                                                                          
#7 4.654 these 2 derivations will be built:                                                                                        
#7 4.656   /nix/store/imf2qzrzs0qggbabsn3f5mr3wa5jxhkh-builder.pl.drv                                                              
#7 4.656   /nix/store/k1rhrji3ha5zfhb15q21ki5fds9gr58h-env.drv                                                                     
#7 4.660 these 12 paths will be fetched (10.44 MiB download, 68.78 MiB unpacked):
#7 4.660   /nix/store/526xlkd8f2q5vbdy68rnv4x5d0wzml8w-diffutils-3.8
#7 4.660   /nix/store/576iqyz893c8zg0qy92is04cgcjanqky-file-5.43
#7 4.660   /nix/store/6s9h7vcjxhh76kaa6plickgik9c7rpqj-curl-7.86.0-man
#7 4.660   /nix/store/8dj94g330sk2q5kvji3jy0fpcj5m0kii-stdenv-linux
#7 4.660   /nix/store/8p49h8m12hx1qjxgw98vrx17a6hxcn2z-findutils-4.9.0
#7 4.660   /nix/store/gjyskq701gwzpin34r3rqlcaqif7v3l6-patch-2.7.6
#7 4.660   /nix/store/hnwgz78qripqnnnprar3lzmp7ymkv90x-gnumake-4.3
#7 4.660   /nix/store/hybxi0dm46sd8cf2xw6nhsdy858qlvyf-ed-1.18
#7 4.660   /nix/store/qbbh33w8jwr1pb6vxp2aplcsdlj6hvvk-patchelf-0.15.0
#7 4.661   /nix/store/qs14qs0x86ibndw0j5mwf1v46jxn56ld-gawk-5.1.1
#7 4.661   /nix/store/xdd67g9ps5aripg044v6y4j1qsli76fh-curl-7.86.0-bin
#7 4.661   /nix/store/yxd2rlvzh1n01j1f86zcxlj8xr20kwh5-perl-5.36.0
#7 4.728 copying path '/nix/store/6s9h7vcjxhh76kaa6plickgik9c7rpqj-curl-7.86.0-man' from 'https://cache.nixos.org'...
#7 4.899 copying path '/nix/store/xdd67g9ps5aripg044v6y4j1qsli76fh-curl-7.86.0-bin' from 'https://cache.nixos.org'...
#7 5.017 copying path '/nix/store/526xlkd8f2q5vbdy68rnv4x5d0wzml8w-diffutils-3.8' from 'https://cache.nixos.org'...
#7 5.283 copying path '/nix/store/hybxi0dm46sd8cf2xw6nhsdy858qlvyf-ed-1.18' from 'https://cache.nixos.org'...
#7 5.660 copying path '/nix/store/576iqyz893c8zg0qy92is04cgcjanqky-file-5.43' from 'https://cache.nixos.org'...
#7 6.300 copying path '/nix/store/8p49h8m12hx1qjxgw98vrx17a6hxcn2z-findutils-4.9.0' from 'https://cache.nixos.org'...
#7 6.567 copying path '/nix/store/qs14qs0x86ibndw0j5mwf1v46jxn56ld-gawk-5.1.1' from 'https://cache.nixos.org'...
#7 6.983 copying path '/nix/store/hnwgz78qripqnnnprar3lzmp7ymkv90x-gnumake-4.3' from 'https://cache.nixos.org'...
#7 7.213 copying path '/nix/store/gjyskq701gwzpin34r3rqlcaqif7v3l6-patch-2.7.6' from 'https://cache.nixos.org'...
#7 7.335 copying path '/nix/store/qbbh33w8jwr1pb6vxp2aplcsdlj6hvvk-patchelf-0.15.0' from 'https://cache.nixos.org'...
#7 7.487 copying path '/nix/store/yxd2rlvzh1n01j1f86zcxlj8xr20kwh5-perl-5.36.0' from 'https://cache.nixos.org'...
#7 12.83 copying path '/nix/store/8dj94g330sk2q5kvji3jy0fpcj5m0kii-stdenv-linux' from 'https://cache.nixos.org'...
#7 12.99 error: unable to load seccomp BPF program: Invalid argument
#7 12.99 
#7 12.99        … while setting up the build environment

Below is my Dockerfile

FROM niteo/nixpkgs-nixos-22.11:ea96b4af6148114421fda90df33cf236ff5ecf1d AS build

# Import the project source
COPY default.nix default.nix

RUN \
  # Install the program to propagate to the final image
  nix-env -f default.nix -iA myEnv --show-trace \
  # Exports a root directory structure containing all dependencies
  # installed with nix-env under /run/profile
  && export-profile /dist

# Second Docker stage, we start with a completely empty image
FROM scratch

# Copy the /dist root folder from the previous stage into this one
COPY --from=build /dist /

# Set PATH so Nix binaries can be found
ENV PATH=/run/profile/bin
ENV NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt

Below is the nix file

let
  pkgs = import <nixpkgs> {};
in {
  myEnv = pkgs.buildEnv {
    name = "env";
    paths = with pkgs; [
      curl
      cacert
    ];
  };
}
@AmitKumarDas
Copy link
Author

AmitKumarDas commented Apr 11, 2023

This error was fixed by setting nix-env -f default.nix -iA myEnv --option filter-syscalls false

refer: NixOS/nix#5258

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant