Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when building the honeypot locally #16

Open
lorenzo-dev1 opened this issue Dec 25, 2023 · 2 comments
Open

Error when building the honeypot locally #16

lorenzo-dev1 opened this issue Dec 25, 2023 · 2 comments

Comments

@lorenzo-dev1
Copy link

lorenzo-dev1 commented Dec 25, 2023

I am trying to build the honeypot locally. Following the readme, I am executing:

docker buildx bake --load

Which failts with output:

[+] Building 2.6s (12/19)                                                                                                    docker:default
 => [dapp internal] load .dockerignore                                                                                                 0.0s
 => => transferring context: 2B                                                                                                        0.0s
 => [dapp internal] load build definition from Dockerfile                                                                              0.0s
 => => transferring dockerfile: 696B                                                                                                   0.0s
 => CANCELED [wrapped] resolve image config for docker.io/docker/dockerfile:1.4                                                        1.3s
 => CACHED [dapp] docker-image://docker.io/docker/dockerfile:1.4@sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0  0.0s
 => [dapp internal] load metadata for docker.io/riscv64/ubuntu:22.04                                                                   0.9s
 => CACHED [dapp dapp 1/3] FROM docker.io/riscv64/ubuntu:22.04@sha256:f31546bc71659c643837d57f09a161f04e866b59da4f418e064082a756c4c23  0.0s
 => [dapp internal] load build context                                                                                                 0.0s
 => CANCELED [dapp] https://github.com/cartesi/image-kernel/releases/download/v0.16.0/linux-headers-5.15.63-ctsi-2.tar.xz              0.3s
 => CACHED [dapp dapp 2/3] WORKDIR /home/dapp                                                                                          0.0s
 => ERROR [dapp builder 2/8] RUN <<EOF (apt-get update...)                                                                             0.3s
 => [wrapped internal] load .dockerignore                                                                                              0.0s
 => => transferring context: 2B                                                                                                        0.0s
 => [wrapped internal] load build definition from Dockerfile                                                                           0.0s
 => => transferring dockerfile: 4.03kB                                                                                                 0.0s
------
 > [dapp builder 2/8] RUN <<EOF (apt-get update...):
0.288 exec /bin/sh: exec format error
------
Dockerfile:4
--------------------
   3 |     ENV SOURCE_DATE_EPOCH=1692902406
   4 | >>> RUN <<EOF
   5 | >>> apt-get update
   6 | >>> apt-get install -y --no-install-recommends \
   7 | >>>     build-essential=12.9ubuntu3 \
   8 | >>>     clang-tidy=1:14.0-55~exp2
   9 | >>> rm -rf /var/lib/apt/lists/*
  10 | >>> EOF
  11 |
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get update\napt-get install -y --no-install-recommends \\\n    build-essential=12.9ubuntu3 \\\n    clang-tidy=1:14.0-55~exp2\nrm -rf /var/lib/apt/lists/*\n" did not complete successfully: exit code: 1

Is it due to the fact that the image is for the riscv64 architecture and I am trying to use it on a amd64 machine? Should I build it inside an emulator?

I thought it would work since I managed to run the echo-python example, which if I understood correctly uses the cartesi VM which runs in a riscv64 emulator.

@Yp3rion
Copy link

Yp3rion commented Dec 31, 2023

Although it does not seem to be explicitly mentioned in the README, the error exec /bin/sh: exec format error seems to be related to either the kernel capability binfmt_misc being disabled on the host Linux system or, more likely, to the required QEMU binaries (which in this case should be qemu-riscv64-static) not being available, as either of these would make it impossible to run executables meant for a different architecture.

I was able to fix this error and successfully complete the build process by installing the qemu-user-static package, which also includes qemu-riscv64-static and I don't think is typically present by default on any system.

I would suggest adding the above information to the README as it is not easy to understand what is going on from the error itself; I would be happy to do it myself via a pull request if that is also ok.

@lorenzo-dev1
Copy link
Author

I was able to fix this error and successfully complete the build process by installing the qemu-user-static package, which also includes qemu-riscv64-static and I don't think is typically present by default on any system.

That solved it for myself as well.

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

No branches or pull requests

2 participants