Subject: SSH not working in container

From: Andrew <[email-masked]>
Date: Fri, 30 Apr 2021 15:46:33 -0400

Hello all,

I have been setting up a container and installed openssh-client , and went to use ssh [email-masked] , but got the following error in response:
/app # which ssh
/usr/bin/ssh
/app # ssh [email-masked]
Error relocating /usr/bin/ssh: reallocarray: symbol not found
/app # alpine
sh: alpine: not found
/app # cat /etc/*release
3.11.5
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.11.5
PRETTY_NAME="Alpine Linux v3.11"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
Is there something that I'm missing here? I have to say, this kind of blindsided me, so I don't know what other info would be helpful.

Regards,

Andrew Cziryak
Sent from Mailspring, the best free email app for work
[email-masked] (mailto:[email-masked])
(614) 680-8599 (tel:(614)%20680-8599)
PO Box 10065 Columbus, OH 43201 (https://maps.google.com/?q=PO%20Box%2010065%20Columbus%2C%20OH%2043201)

---

From: Wolf <[email-masked]>
Date: Sat, 1 May 2021 00:51:26 +0200

On 2021-04-30 15:46:33 -0400, Andrew wrote:
> 
> I have been setting up a container and installed openssh-client , and
> went to use ssh [email-masked] , but got the following error in
> response:
> /app # which ssh
> /usr/bin/ssh

Seems to work for me:

+:( $ podman run -it --rm docker.io/library/alpine:3.11
Trying to pull docker.io/library/alpine:3.11...
Getting image source signatures
Copying blob ddad3d7c1e96 done
Copying config e389ae5892 done
Writing manifest to image destination
Storing signatures
/ # apk add openssh-client
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/5) Installing openssh-keygen (8.1_p1-r0)
(2/5) Installing ncurses-terminfo-base (6.1_p20200118-r4)
(3/5) Installing ncurses-libs (6.1_p20200118-r4)
(4/5) Installing libedit (20191211.3.1-r0)
(5/5) Installing openssh-client (8.1_p1-r0)
Executing busybox-1.31.1-r10.trigger
OK: 10 MiB in 19 packages
/ # ssh [email-masked]
The authenticity of host 'gitlab.com (172.65.251.78)' can't be established.
ECDSA key fingerprint is SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'gitlab.com,172.65.251.78' (ECDSA) to the list of known hosts.
[email-masked]: Permission denied (publickey,keyboard-interactive).
/ #

> sh: alpine: not found

What was this supposed to do?

> Is there something that I'm missing here? I have to say, this kind of
> blindsided me, so I don't know what other info would be helpful.

I think steps to reproduce this would help with giving more useful
advice then "works for me". 

W.

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

---

From: Andrew <[email-masked]>
Date: Fri, 30 Apr 2021 19:06:14 -0400

Of course. Thanks for the response. I believe the following will reproduce the error. I am able to reproduce it on two machines so far:

Here is the Dockerfile which recreates this issue for me:
FROM ruby:2.7.0-alpine3.11
RUN apk add --update --no-cache \
--repository=http://dl-cdn.alpinelinux.org/alpine/edge/main \
openssl openssh-client git tzdata mysql-dev mysql-client nodejs

And here are the results of building and running the resulting container:
➜ tmp docker build .
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM ruby:2.7.0-alpine3.11
---> 77bdcf1a09b8
Step 2/2 : RUN apk add --update --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main openssl openssh-client git tzdata mysql-dev mysql-client nodejs
---> Running in d56e69b0af83
fetch http://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/25) Upgrading libcrypto1.1 (1.1.1d-r3 -> 1.1.1k-r0)
(2/25) Upgrading libssl1.1 (1.1.1d-r3 -> 1.1.1k-r0)
(3/25) Installing brotli-libs (1.0.9-r4)
(4/25) Installing nghttp2-libs (1.43.0-r0)
(5/25) Installing libcurl (7.76.1-r0)
(6/25) Installing expat (2.3.0-r0)
(7/25) Installing pcre2 (10.36-r0)
(8/25) Installing git (2.31.1-r1)
(9/25) Installing mariadb-common (10.5.9-r0)
(10/25) Installing mariadb-client (10.5.9-r0)
(11/25) Installing mysql-client (10.5.9-r0)
(12/25) Installing openssl-dev (1.1.1k-r0)
(13/25) Installing mariadb-connector-c (3.1.12-r0)
(14/25) Installing mariadb-connector-c-dev (3.1.12-r0)
(15/25) Installing libaio (0.3.112-r1)
(16/25) Installing xz-libs (5.2.5-r0)
(17/25) Installing mariadb-embedded (10.5.9-r0)
(18/25) Installing mariadb-dev (10.5.9-r0)
(19/25) Installing c-ares (1.17.1-r1)
(20/25) Installing nodejs (14.16.1-r2)
(21/25) Installing openssh-keygen (8.6_p1-r0)
(22/25) Installing libedit (20210216.3.1-r0)
(23/25) Installing openssh-client (8.6_p1-r0)
(24/25) Installing openssl (1.1.1k-r0)
(25/25) Installing tzdata (2021a-r0)
Executing busybox-1.31.1-r9.trigger
Executing ca-certificates-20191127-r1.trigger
OK: 133 MiB in 59 packages
Removing intermediate container d56e69b0af83
---> a31661c2eff1
Successfully built a31661c2eff1
➜ tmp docker run -it --rm a31661c2eff1 sh
/ # ssh [email-masked]
Error relocating /usr/bin/ssh: reallocarray: symbol not found

Hope that helps!
Regards,

Andrew Cziryak

---

From: Wolf <[email-masked]>
Date: Sat, 1 May 2021 01:23:34 +0200

https://idallen.com/topposting.html

On 2021-04-30 19:06:14 -0400, Andrew wrote:
> Of course. Thanks for the response. I believe the following will
> reproduce the error. I am able to reproduce it on two machines so far:
> 

Mixing alpine versions is not supported. You cannot in general install
package from edge into 3.11 and expect it to work.

W.

---

From: smacz <[email-masked]>
Date: Fri, 30 Apr 2021 22:31:23 -0400

On Fri, Apr 30, 2021, at 7:23 PM, Wolf wrote:
> *Attachments:*
>  * signature.asc
Thanks for pointing that out. After removing the `--repository`  flag, the installed ssh version is pulled from the 3.11 repo. As a result, it is now working.

Thank you for your help.

Regards,
Andrew Cziryak
---
AndrewCz
[email-masked]