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

Solve issues in docker multi architecture builds (linux/arm/v7, linux/arm64/v8, linux/ppc64le) #6

Open
viferga opened this issue Oct 15, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@viferga
Copy link
Member

viferga commented Oct 15, 2024

linux/arm/v7

It seems this issue depends on the kernel image, we should investigate it further:

          # guix error: cloning builder process: Invalid argument (https://lists.gnu.org/archive/html/help-guix/2017-12/msg00023.html)
          # { docker: linux/arm/v7, guix: armhf-linux },

Reference:
https://lists.gnu.org/archive/html/help-guix/2017-12/msg00023.html

linux/arm64/v8, linux/ppc64le

For OOM, we should find a way to tweak QEMU options and truly investigate if the OOM is reached due to QEMU limits or the VM from GitHub itself. Here's the reference:

          # ERROR: failed to solve: ResourceExhausted: process "/bin/sh -c sh -c '/entry-point.sh guix pull ..." did not complete successfully: cannot allocate memory
          # { docker: linux/arm64/v8, guix: aarch64-linux },
          # { docker: linux/ppc64le, guix: powerpc64le-linux }

Reference:
https://github.com/docker/setup-qemu-action
https://hub.docker.com/r/tonistiigi/binfmt
https://github.com/tonistiigi/binfmt

@viferga viferga added enhancement New feature or request good first issue Good for newcomers labels Oct 15, 2024
@Bcoderx6
Copy link

Bcoderx6 commented Oct 16, 2024

I’ve attempted several strategies to resolve the multi-architecture build issues, including:

1. Limiting Guix to a single job (Guix=jobs=1)

  • In the Dockerfile, I set the GUIX_JOBS environment variable to limit the number of jobs to 1:
    ENV GUIX_JOBS=1

2. Increasing the swap space to 16GB

  • I added a step in the Docker workflow to increase the swap space before running the build:
    sudo fallocate -l 16G /swapfile
    sudo chmod 600 /swapfile
    sudo mkswap /swapfile
    sudo swapon /swapfile
  • Verified the swap space with:
    swapon --show
    free -h

3. Setting memory limits to 4GB for Docker containers

  • In the Docker run command, I limited the memory to 4GB:
    docker run --memory=4g ...

4. Splitting commands in the Dockerfile

  • To optimize the build process, I split the RUN commands in the Dockerfile to isolate steps and reduce the chance of failures:
    RUN guix pull
    RUN guix package --fallback -i nss-certs

5. Commenting out other platforms

  • To focus exclusively on arm64/v8, I commented out the other platforms in the Docker build command:
    docker buildx build --platform linux/arm64/v8 --push ...

6. Trying different base images

  • I tested different base images such as debian:bookworm and debian:bookworm-slim by modifying the FROM line in the Dockerfile:
    FROM debian:bookworm
    or
    FROM debian:bookworm-slim

7. Installing Guix via the official Guix script

  • I also attempted to install Guix using the official installation script:
    wget https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh
    sudo bash guix-install.sh

Despite trying all these solutions, the problem is still not resolved. Any further advice or suggestions would be really helpful.

@viferga
Copy link
Member Author

viferga commented Oct 16, 2024

@Bcoderx6 thank you so much for the investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants