Error relocating /usr/bin/node: _ZSt28__throw_bad_array_new_lengthv: symbol not found
thisismydesign opened this issue · 15 comments
Version
16.13.1
Platform
Linux e395c1ec1266 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 Linux
Subsystem
No response
What steps will reproduce the bug?
I'm installing node on an alpine image. Since the recent release of 16.13.1
I'm facing this issue, it was working fine with 16.13.0
but unfortunately, that version is gone from Alpine's registry.
FROM ruby:3.0.3-alpine
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main/ nodejs
node -v
Error relocating /usr/bin/node: _ZSt28__throw_bad_array_new_lengthv: symbol not found
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response
It seems to be okay in the upstream alpine:3.15
container:
➜ docker run -it ruby:3.0.3-alpine cat /etc/alpine-release
3.15.0
➜ docker run -it alpine:3.15.0
/ # apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main/ nodejs
fetch http://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
(1/7) Installing ca-certificates (20191127-r7)
(2/7) Installing nghttp2-libs (1.46.0-r0)
(3/7) Installing brotli-libs (1.0.9-r5)
(4/7) Installing c-ares (1.18.1-r0)
(5/7) Installing libgcc (11.2.1_git20211128-r0)
(6/7) Installing libstdc++ (11.2.1_git20211128-r0)
(7/7) Installing nodejs (16.13.1-r0)
Executing busybox-1.34.1-r3.trigger
Executing ca-certificates-20191127-r7.trigger
OK: 47 MiB in 21 packages
/ # node -v
v16.13.1
So I am (perhaps wrongly) assuming it is being caused by something in the Ruby image build (https://github.com/docker-library/ruby/blob/master/3.0/alpine3.15/Dockerfile).
Thanks @BethGriggs! I should copy the rest of my Dockerfile. Standard Rails setup, but I guess it's possible that this is due to some interaction with other installs.
FROM madnight/docker-alpine-wkhtmltopdf as wkhtmltopdf_image
FROM ruby:3.0.3-alpine
RUN apk --update add --no-cache \
# Build & runtime tools
build-base imagemagick git \
# Required for Docker port scanning
netcat-openbsd \
# Required by Rails
tzdata \
# Required for PostgreSQL
postgresql-dev postgresql-client
# Fonts for PDF generation
RUN apk add --no-cache \
--repository http://dl-cdn.alpinelinux.org/alpine/v3.13/main/ \
ttf-ubuntu-font-family
# Required for wicked_pdf: https://github.com/mileszs/wicked_pdf/issues/841#issuecomment-507759176
COPY --from=wkhtmltopdf_image /bin/wkhtmltopdf /bin/
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main/ nodejs
Doing a apk upgrade
before installing nodejs fixed this issue for me. It seems like the latest nodejs package depends on some libraries to be updated.
Doing a
apk upgrade
before installing nodejs fixed this issue for me. It seems like the latest nodejs package depends on some libraries to be updated.
Hey guys, I added apk ugrade to my Dockerfile , but it didnt seem to help .
I still get _ZSt28__throw_bad_array_new_lengthv: symbol not found
This is really strange , I see that alpine haven't updated the repository with a new nodejs package for some reason.
I thought maybe they have a bad nodejs package and would have replaced it, since it was added on Dec 01.
http://dl-4.alpinelinux.org/alpine/edge/main/x86_64/
this is what I did in my Dockerfile but it didnt seem to help.
RUN apk upgrade
RUN apk -UvX http://dl-4.alpinelinux.org/alpine/edge/main add nodejs
I have this exact same issue, tried adding the apk upgrade and it didn't work as well.
I'm using the alpine image of nginx
I agree with @BethGriggs - the problem is in ruby alpine images.
It seems nodejs from alpine package requires libstdc++.so
with version 6.0.29, but version of libstdc++.so
is 6.0.28 in ruby image because of gmp-dev
package
$ docker run -it --rm ruby:2.7.5-alpine3.15 sh
/ # ls -al /usr/lib/ | grep libstdc++
lrwxrwxrwx 1 root root 19 Nov 30 09:19 libstdc++.so.6 -> libstdc++.so.6.0.28
-rwxr-xr-x 1 root root 1690200 Oct 27 12:50 libstdc++.so.6.0.28
/ # apk del libstdc++
World updated, but the following packages are not removed due to:
libstdc++: gmp-dev
/ # apk add --update --no-cache --repository http://nl.alpinelinux.org/alpine/edge/main nodejs
fetch http://nl.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
(1/4) Installing nghttp2-libs (1.46.0-r0)
(2/4) Installing brotli-libs (1.0.9-r6)
(3/4) Installing c-ares (1.18.1-r0)
(4/4) Installing nodejs (16.13.1-r1)
Executing busybox-1.34.1-r3.trigger
OK: 59 MiB in 40 packages
/ # node -v
Error relocating /usr/bin/node: _ZSt28__throw_bad_array_new_lengthv: symbol not found
My workaround:
$ docker run -it --rm ruby:2.7.5-alpine3.15 sh
/ # apk del gmp-dev libstdc++ && apk add --update --no-cache --repository http://nl.alpinelinux.org/alpine/edge/main libstdc++ gmp-dev
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.15/main: No such file or directory
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.15/community: No such file or directory
(1/4) Purging gmp-dev (6.2.1-r0)
(2/4) Purging libgmpxx (6.2.1-r0)
(3/4) Purging libstdc++ (10.3.1_git20211027-r0)
(4/4) Purging libgcc (10.3.1_git20211027-r0)
OK: 17 MiB in 32 packages
fetch http://nl.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
(1/4) Installing libgcc (11.2.1_git20211128-r3)
(2/4) Installing libstdc++ (11.2.1_git20211128-r3)
(3/4) Installing libgmpxx (6.2.1-r0)
(4/4) Installing gmp-dev (6.2.1-r0)
OK: 20 MiB in 36 packages
/ # ls -al /usr/lib/ | grep libstdc++
lrwxrwxrwx 1 root root 19 Dec 19 07:54 libstdc++.so.6 -> libstdc++.so.6.0.29
-rwxr-xr-x 1 root root 1915480 Dec 16 17:46 libstdc++.so.6.0.29
/ # apk add --update --no-cache --repository http://nl.alpinelinux.org/alpine/edge/main nodejs
fetch http://nl.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
(1/4) Installing nghttp2-libs (1.46.0-r0)
(2/4) Installing brotli-libs (1.0.9-r6)
(3/4) Installing c-ares (1.18.1-r0)
(4/4) Installing nodejs (16.13.1-r1)
Executing busybox-1.34.1-r3.trigger
OK: 59 MiB in 40 packages
/ # node -v
v16.13.1
In Dockerfile:
FROM ruby:2.7.5-alpine3.15
RUN apk del gmp-dev libstdc++ && \
apk add --update --no-cache --repository http://nl.alpinelinux.org/alpine/edge/main gmp-dev libstdc++ nodejs
Strange thing.
I just checked alpine repo
http://dl-4.alpinelinux.org/alpine/edge/main/x86_64/
and saw that the nodejs version was updated
nodejs-16.13.1-r1.apk on 18th Dec
I built a new image from scratch to make sure it uses the new version .
And still get the same error. I doubled checked and saw in /usr/bin that the its the node from 18th Dec.
Error relocating /usr/bin/node: _ZSt28__throw_bad_array_new_lengthv: symbol not found
So even though they are using a new node version the problem persists.
@ryan65 in that case it's probably best to open an issue at https://gitlab.alpinelinux.org/alpine/aports/-/issues
I built a new image from scratch to make sure it uses the new version .
@ryan65 Can you show your Dockerfile please?
I built a new image from scratch to make sure it uses the new version .
@ryan65 Can you show your Dockerfile please?
Nothing special , the relevant part is just
FROM postgres:12.4-alpine
RUN apk -UvX http://dl-4.alpinelinux.org/alpine/edge/main add nodejs
@ryan65 Try this approach:
Dockerfile:
FROM alpine:3.15 as libstdc-donor
RUN apk add --no-cache --repository http://nl.alpinelinux.org/alpine/edge/main libstdc++
FROM postgres:12.4-alpine
COPY --from=libstdc-donor /usr/lib/libstdc++.so.6.0.29 /usr/lib/libstdc++.so.6.0.29
RUN rm /usr/lib/libstdc++.so.6 && ln -s /usr/lib/libstdc++.so.6.0.29 /usr/lib/libstdc++.so.6
RUN apk -UvX http://dl-4.alpinelinux.org/alpine/edge/main add nodejs
$ docker build -f Dockerfile -t test .
$ docker run -it --rm test sh -c 'node -v'
v16.13.1
@ryan65 Try this approach:
Dockerfile:
FROM alpine:3.15 as libstdc-donor RUN apk add --no-cache --repository http://nl.alpinelinux.org/alpine/edge/main libstdc++ FROM postgres:12.4-alpine COPY --from=libstdc-donor /usr/lib/libstdc++.so.6.0.29 /usr/lib/libstdc++.so.6.0.29 RUN rm /usr/lib/libstdc++.so.6 && ln -s /usr/lib/libstdc++.so.6.0.29 /usr/lib/libstdc++.so.6 RUN apk -UvX http://dl-4.alpinelinux.org/alpine/edge/main add nodejs
$ docker build -f Dockerfile -t test . $ docker run -it --rm test sh -c 'node -v' v16.13.1
Hi igor
Yes I saw your previous post and indeed it works, Thanks :-) question is, this workaround is pretty "hacky", trying to understand if this regression is here to stay or something that should be fixed in the alpine repo.
@ryan65 After reading documentation for apk add
I think I found the proper way to upgrade libstdc++ :)
Dockerfile:
FROM postgres:12.4-alpine
RUN apk -UvX http://dl-4.alpinelinux.org/alpine/edge/main add -u nodejs
$ docker run -it --rm postgres:12.4-alpine sh -c 'apk -UvX http://dl-4.alpinelinux.org/alpine/edge/main add -u nodejs && node -v'
fetch http://dl-4.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
The following packages will be REMOVED:
libtls-standalone
The following NEW packages will be installed:
libretls ca-certificates nghttp2-libs brotli-libs c-ares nodejs
The following packages will be upgraded:
musl libgcc libstdc++ libcrypto1.1 libssl1.1 busybox ca-certificates-bundle ssl_client
After this operation, 39 MiB of additional disk space will be used.
(1/15) Upgrading musl (1.1.24-r9 -> 1.2.2-r7)
(2/15) Upgrading libgcc (9.3.0-r2 -> 11.2.1_git20211128-r3)
(3/15) Upgrading libstdc++ (9.3.0-r2 -> 11.2.1_git20211128-r3)
(4/15) Upgrading libcrypto1.1 (1.1.1g-r0 -> 1.1.1m-r1)
(5/15) Upgrading libssl1.1 (1.1.1g-r0 -> 1.1.1m-r1)
(6/15) Upgrading busybox (1.31.1-r19 -> 1.34.1-r5)
Executing busybox-1.34.1-r5.post-upgrade
stat: can't stat 'usr/bin/last': No such file or directory
stat: can't stat 'usr/bin/who': No such file or directory
(7/15) Upgrading ca-certificates-bundle (20191127-r4 -> 20191127-r7)
(8/15) Installing libretls (3.4.2-r0)
(9/15) Upgrading ssl_client (1.31.1-r19 -> 1.34.1-r5)
(10/15) Installing ca-certificates (20191127-r7)
(11/15) Installing nghttp2-libs (1.46.0-r0)
(12/15) Installing brotli-libs (1.0.9-r6)
(13/15) Installing c-ares (1.18.1-r0)
(14/15) Installing nodejs (16.13.1-r1)
(15/15) Purging libtls-standalone (2.9.1-r1)
Executing busybox-1.34.1-r5.trigger
Executing ca-certificates-20191127-r7.trigger
OK: 38 packages, 159 dirs, 1555 files, 148 MiB
v16.13.1
@ryan65 After reading documentation for
apk add
I think I found the proper way to upgrade libstdc++ :)Dockerfile:
FROM postgres:12.4-alpine RUN apk -UvX http://dl-4.alpinelinux.org/alpine/edge/main add -u nodejs
$ docker run -it --rm postgres:12.4-alpine sh -c 'apk -UvX http://dl-4.alpinelinux.org/alpine/edge/main add -u nodejs && node -v' fetch http://dl-4.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz The following packages will be REMOVED: libtls-standalone The following NEW packages will be installed: libretls ca-certificates nghttp2-libs brotli-libs c-ares nodejs The following packages will be upgraded: musl libgcc libstdc++ libcrypto1.1 libssl1.1 busybox ca-certificates-bundle ssl_client After this operation, 39 MiB of additional disk space will be used. (1/15) Upgrading musl (1.1.24-r9 -> 1.2.2-r7) (2/15) Upgrading libgcc (9.3.0-r2 -> 11.2.1_git20211128-r3) (3/15) Upgrading libstdc++ (9.3.0-r2 -> 11.2.1_git20211128-r3) (4/15) Upgrading libcrypto1.1 (1.1.1g-r0 -> 1.1.1m-r1) (5/15) Upgrading libssl1.1 (1.1.1g-r0 -> 1.1.1m-r1) (6/15) Upgrading busybox (1.31.1-r19 -> 1.34.1-r5) Executing busybox-1.34.1-r5.post-upgrade stat: can't stat 'usr/bin/last': No such file or directory stat: can't stat 'usr/bin/who': No such file or directory (7/15) Upgrading ca-certificates-bundle (20191127-r4 -> 20191127-r7) (8/15) Installing libretls (3.4.2-r0) (9/15) Upgrading ssl_client (1.31.1-r19 -> 1.34.1-r5) (10/15) Installing ca-certificates (20191127-r7) (11/15) Installing nghttp2-libs (1.46.0-r0) (12/15) Installing brotli-libs (1.0.9-r6) (13/15) Installing c-ares (1.18.1-r0) (14/15) Installing nodejs (16.13.1-r1) (15/15) Purging libtls-standalone (2.9.1-r1) Executing busybox-1.34.1-r5.trigger Executing ca-certificates-20191127-r7.trigger OK: 38 packages, 159 dirs, 1555 files, 148 MiB v16.13.1
Sure does work :-). Nice !! , And Thanks.
Doing a
apk upgrade
before installing nodejs fixed this issue for me. It seems like the latest nodejs package depends on some libraries to be updated.
worked for me,thanks a lot