libpython3.11.so.1.0: pwritev2: symbol not found
jgournet opened this issue · comments
Describe the bug
When using aws-cli, we get this error:
Error loading Python lib '/usr/local/aws-cli/v2/2.15.58/dist/libpython3.11.so.1.0': dlopen: Error relocating /usr/local/aws-cli/v2/2.15.58/dist/libpython3.11.so.1.0: pwritev2: symbol not found
Expected Behavior
Things used to work fine
Current Behavior
> [stage-1 4/4] RUN apk --no-cache add groff && mkdir /.aws && chown nobody:nobody /.aws && aws --version:
0.222 fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/main/x86_64/APKINDEX.tar.gz
0.798 fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/community/x86_64/APKINDEX.tar.gz
1.259 fetch https://apk.corretto.aws/x86_64/APKINDEX.tar.gz
1.513 (1/5) Installing libbz2 (1.0.8-r6)
1.525 (2/5) Installing perl (5.38.2-r0)
2.278 (3/5) Installing libgcc (13.2.1_git20231014-r0)
2.297 (4/5) Installing libstdc++ (13.2.1_git20231014-r0)
2.404 (5/5) Installing groff (1.23.0-r2)
2.601 Executing busybox-1.36.1-r15.trigger
2.605 OK: 378 MiB in 22 packages
2.645 [1] Error loading Python lib '/usr/local/aws-cli/v2/2.15.58/dist/libpython3.11.so.1.0': dlopen: Error relocating /usr/local/aws-cli/v2/2.15.58/dist/libpython3.11.so.1.0: pwritev2: symbol not found
------
Dockerfile:19
--------------------
18 |
19 | >>> RUN apk --no-cache add groff && \
20 | >>> # Create /.aws folder and assign it to nobody, as this is somehow necessary to run some aws commands (at least "aws s3 cp" needs it, and changing AWS_CONFIG_FILE does not work)
21 | >>> mkdir /.aws && chown nobody:nobody /.aws && \
22 | >>> aws --version
--------------------
ERROR: failed to solve: process "/bin/sh -c apk --no-cache add groff && mkdir /.aws && chown nobody:nobody /.aws && aws --version" did not complete successfully: exit code: 255
Reproduction Steps
Use this Dockerfile:
FROM python:3.11-alpine as installer
RUN apk add --no-cache git unzip groff build-base libffi-dev cmake
RUN git clone --recursive --depth 1 --branch v2 --single-branch https://github.com/aws/aws-cli.git
WORKDIR aws-cli
RUN python -m venv venv
RUN . venv/bin/activate
RUN scripts/installers/make-exe
RUN unzip -q dist/awscli-exe.zip
RUN aws/install --bin-dir /aws-cli-bin
RUN /aws-cli-bin/aws --version
FROM amazoncorretto:17-alpine-jdk
# Add aws cli v2:
COPY --from=installer /usr/local/aws-cli/ /usr/local/aws-cli/
COPY --from=installer /aws-cli-bin/ /usr/local/bin/
RUN apk --no-cache add groff && \
# Create /.aws folder and assign it to nobody, as this is somehow necessary to run some aws commands (at least "aws s3 cp" needs it, and changing AWS_CONFIG_FILE does not work)
mkdir /.aws && chown nobody:nobody /.aws && \
aws --version
Possible Solution
No response
Additional Information/Context
No response
CLI version used
latest
Environment details (OS name and version, etc.)
docker linux alpine + docker amazoncorretto alpine
I have the following error
Error relocating /usr/local/lib/libpython3.11.so.1.0: pwritev2: symbol not found Error relocating /usr/local/lib/libpython3.11.so.1.0: preadv2: symbol not found
I was searching for a solution for the same symptom, where I am trying to build my image with Google Cloud SDK, it coincided with the bump in Python docker image last week to support new Alpine version
My solution currently is to pin to Python image to Alpine 3.19
FROM python:3.11.9-alpine3.19
Appears to be an issue with Alpine as noted above. and pinning to Python 3.11.9 works. I think this should continue to be tracked in the issue linked above (docker-library/python#927) going forward.