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 with some libraries using ruby 3.3.5 on arm platform #473

Open
condef5 opened this issue Oct 9, 2024 · 6 comments
Open

Error with some libraries using ruby 3.3.5 on arm platform #473

condef5 opened this issue Oct 9, 2024 · 6 comments

Comments

@condef5
Copy link

condef5 commented Oct 9, 2024

Hello team,

I'm encountering an error while attempting to build a Docker image for a Ruby 3.3.5 project on an ARM platform. Here are the details:

  • Ruby version: 3.3.5
  • Platform: ARM
  • Process: Building a Docker image
  • Current status: Error during build image
This is my docker file
# syntax=docker/dockerfile:1
# check=error=true

# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
# docker build -t baku .
# docker run -d -p 80:80 -e RAILS_MASTER_KEY=<value from config/master.key> --name baku baku

# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html

# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
ARG RUBY_VERSION=3.3.5
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base

# Rails app lives here
WORKDIR /rails

# Install base packages
RUN apt-get update -qq && \
    apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \
    rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Set production environment
ENV RAILS_ENV="production" \
    BUNDLE_DEPLOYMENT="1" \
    BUNDLE_PATH="/usr/local/bundle" \
    BUNDLE_WITHOUT="development"

# Throw-away build stage to reduce size of final image
FROM base AS build

# Install packages needed to build gems
RUN apt-get update -qq && \
    apt-get install --no-install-recommends -y build-essential git pkg-config && \
    rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Install application gems
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
    rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
    bundle exec bootsnap precompile --gemfile

# Copy application code
COPY . .

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile




# Final stage for app image
FROM base

# Copy built artifacts: gems, application
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
COPY --from=build /rails /rails

# Run and own only the runtime files as a non-root user for security
RUN groupadd --system --gid 1000 rails && \
    useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
    chown -R rails:rails db log storage tmp
USER 1000:1000

# Entrypoint prepares the database.
ENTRYPOINT ["/rails/bin/docker-entrypoint"]

# Start server via Thruster by default, this can be overwritten at runtime
EXPOSE 80
CMD ["./bin/thrust", "./bin/rails", "server"]
I'm getting this error
#0 17.66 Get:88 http://deb.debian.org/debian bookworm/main arm64 libpangoft2-1.0-0 arm64 1.50.12+ds-1 [44.5 kB]
#0 17.70 Get:89 http://deb.debian.org/debian bookworm/main arm64 libpangocairo-1.0-0 arm64 1.50.12+ds-1 [32.0 kB]
#0 17.72 Get:90 http://deb.debian.org/debian bookworm/main arm64 libpoppler126 arm64 22.12.0-2+b1 [1754 kB]
#0 18.71 Get:91 http://deb.debian.org/debian bookworm/main arm64 libpoppler-glib8 arm64 22.12.0-2+b1 [122 kB]
#0 18.93 Get:92 http://deb.debian.org/debian bookworm/main arm64 libreadline8 arm64 8.2-1.3 [155 kB]
#0 19.03 Get:93 http://deb.debian.org/debian bookworm/main arm64 librsvg2-2 arm64 2.54.7+dfsg-1~deb12u1 [2290 kB]
#0 20.06 Get:94 http://deb.debian.org/debian bookworm/main arm64 libvips42 arm64 8.14.1-3+deb12u1 [1171 kB]
#0 20.56 Get:95 http://deb.debian.org/debian bookworm/main arm64 sqlite3 arm64 3.40.1-2 [341 kB]
#0 20.76 Get:46 http://deb.debian.org/debian bookworm/main arm64 librtmp1 arm64 2.4+20151223.gitfa8646d.1-2+b2 [59.4 kB]
#0 20.79 Fetched 41.8 MB in 15s (2727 kB/s)
#0 20.79 E: Failed to fetch http://deb.debian.org/debian/pool/main/libp/libpsl/libpsl5_0.21.2-1_arm64.deb  Hash Sum mismatch
#0 20.79    Hashes of expected file:
#0 20.79     - SHA256:90a68e4a6d9eb95abee32595762dbf67974f13c158e4ce4a05c7c2b54440db73
#0 20.79     - MD5Sum:04b520a58484299c870805248de377d7 [weak]
#0 20.79     - Filesize:58600 [weak]
#0 20.79    Hashes of received file:
#0 20.79     - SHA256:3e90f178d8b83cd5ab0434af3e118bfe96d7ea7f912189b7e59ab81005fdc1bd
#0 20.79     - MD5Sum:59a1a44a14d71a0e4003baeafe1c1721 [weak]
#0 20.79     - Filesize:58600 [weak]
#0 20.79    Last modification reported: Tue, 14 Feb 2023 00:11:08 +0000
#0 20.79 E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
------
Dockerfile:18
--------------------
  17 |     # Install base packages
  18 | >>> RUN apt-get update -qq && \
  19 | >>>     apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \
  20 | >>>     rm -rf /var/lib/apt/lists /var/cache/apt/archives
  21 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get update -qq &&     apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 &&     rm -rf /var/lib/apt/lists /var/cache/apt/archives" did not complete successfully: exit code: 100```

</details>



@tianon
Copy link
Member

tianon commented Oct 9, 2024

I'm guessing you've got something transparently mirroring deb.debian.org for you -- if you try the build again, I bet it completes successfully (assuming a sane caching proxy that will revalidate periodically).

@condef5
Copy link
Author

condef5 commented Oct 9, 2024

#10 32.16    Hashes of expected file:
#10 32.16     - SHA256:86348fa5039d908a03ea901a299be74c2ea49ea2b05461667a17cac6ad63d627
#10 32.16     - MD5Sum:d20e0e62f454dfb6eddab883ef86d797 [weak]
#10 32.16     - Filesize:396204 [weak]
#10 32.16    Hashes of received file:
#10 32.16     - SHA256:b3399388cd757b5cd6560b7e654b1f7f784ae54ed30186599d8209df33a80b87
#10 32.16     - MD5Sum:438089d05f7abea01d32b4a8cb4a060b [weak]
#10 32.16     - Filesize:396204 [weak]
#10 32.16    Last modification reported: Sun, 18 Sep 2022 23:28:11 +0000
#10 32.16 E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?```

not working yet

@tianon
Copy link
Member

tianon commented Oct 9, 2024

Are you using a VPN or a corporate network that might be intercepting your traffic in the way I've described above? I'm not able to reproduce the error (and it in fact doesn't have anything to do with the ruby image you're reporting this on -- it's an environmental issue with your access to the Debian mirrors 😬):

$ docker run --rm --pull=always debian:bookworm-slim bash -c 'apt-get update -qq && apt-get install -yV libpsl5'
bookworm-slim: Pulling from library/debian
Digest: sha256:ad86386827b083b3d71139050b47ffb32bbd9559ea9b1345a739b14fec2d9ecf
Status: Image is up to date for debian:bookworm-slim
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
   publicsuffix (20230209.2326-1)
The following NEW packages will be installed:
   libpsl5 (0.21.2-1)
   publicsuffix (20230209.2326-1)
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 185 kB of archives.
After this operation, 445 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main amd64 libpsl5 amd64 0.21.2-1 [58.7 kB]
Get:2 http://deb.debian.org/debian bookworm/main amd64 publicsuffix all 20230209.2326-1 [126 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 185 kB in 0s (3134 kB/s)
Selecting previously unselected package libpsl5:amd64.
(Reading database ... 6089 files and directories currently installed.)
Preparing to unpack .../libpsl5_0.21.2-1_amd64.deb ...
Unpacking libpsl5:amd64 (0.21.2-1) ...
Selecting previously unselected package publicsuffix.
Preparing to unpack .../publicsuffix_20230209.2326-1_all.deb ...
Unpacking publicsuffix (20230209.2326-1) ...
Setting up libpsl5:amd64 (0.21.2-1) ...
Setting up publicsuffix (20230209.2326-1) ...
Processing triggers for libc-bin (2.36-9+deb12u8) ...

@tianon
Copy link
Member

tianon commented Oct 9, 2024

Sorry, here again with arm64 instead:

$ docker run --rm --pull=always --platform=linux/arm64 debian:bookworm-slim bash -c 'apt-get update -qq && apt-get install -yV libpsl5'
bookworm-slim: Pulling from library/debian
14c9d9d19932: Pull complete 
Digest: sha256:ad86386827b083b3d71139050b47ffb32bbd9559ea9b1345a739b14fec2d9ecf
Status: Downloaded newer image for debian:bookworm-slim
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
   publicsuffix (20230209.2326-1)
The following NEW packages will be installed:
   libpsl5 (0.21.2-1)
   publicsuffix (20230209.2326-1)
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 185 kB of archives.
After this operation, 503 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main arm64 libpsl5 arm64 0.21.2-1 [58.6 kB]
Get:2 http://deb.debian.org/debian bookworm/main arm64 publicsuffix all 20230209.2326-1 [126 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 185 kB in 0s (1011 kB/s)
Selecting previously unselected package libpsl5:arm64.
(Reading database ... 6083 files and directories currently installed.)
Preparing to unpack .../libpsl5_0.21.2-1_arm64.deb ...
Unpacking libpsl5:arm64 (0.21.2-1) ...
Selecting previously unselected package publicsuffix.
Preparing to unpack .../publicsuffix_20230209.2326-1_all.deb ...
Unpacking publicsuffix (20230209.2326-1) ...
Setting up libpsl5:arm64 (0.21.2-1) ...
Setting up publicsuffix (20230209.2326-1) ...
Processing triggers for libc-bin (2.36-9+deb12u8) ...

@condef5
Copy link
Author

condef5 commented Oct 9, 2024

I'm getting an error for this libvips:

docker run --rm --pull=always --platform=linux/arm64 debian:bookworm-slim bash -c 'apt-get update -qq && apt-get install -yV libvips'

@tianon
Copy link
Member

tianon commented Oct 9, 2024

Swapped -V for -qq on the apt-get install because there's a lot of output (even with -qq) but it succeeds past the package download step just fine for me here:

$ docker run --rm --pull=always --platform=linux/arm64 debian:bookworm-slim bash -c 'apt-get update -qq && apt-get install -yqq libvips'
bookworm-slim: Pulling from library/debian
Digest: sha256:ad86386827b083b3d71139050b47ffb32bbd9559ea9b1345a739b14fec2d9ecf
Status: Image is up to date for debian:bookworm-slim
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libdbus-1-3:arm64.
(Reading database ... 6083 files and directories currently installed.)
Preparing to unpack .../000-libdbus-1-3_1.14.10-1~deb12u1_arm64.deb ...
Unpacking libdbus-1-3:arm64 (1.14.10-1~deb12u1) ...
Selecting previously unselected package dbus-bin.
Preparing to unpack .../001-dbus-bin_1.14.10-1~deb12u1_arm64.deb ...
Unpacking dbus-bin (1.14.10-1~deb12u1) ...
...

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