0

I would like to use glibc version 2.31 for both ubuntu 20.04 and ubuntu 18.04 with the condition that it should not be installed in a system directory. However, I get an error.

I have Dockerfile:

FROM ubuntu:20.04 as container_20_04

WORKDIR /root
RUN apt update && apt download libc6
RUN dpkg-deb -x libc6_2.31-0ubuntu9.2_amd64.deb /root/debs-install
RUN LD_LIBRARY_PATH=/root/debs-install/lib/x86_64-linux-gnu mkdir some_dir

FROM ubuntu:18.04
WORKDIR /root
COPY --from=container_20_04 /root/debs-install /root/debs-install
RUN LD_LIBRARY_PATH=/root/debs-install/lib/x86_64-linux-gnu mkdir some_dir

Note that the same command LD_LIBRARY_PATH=/root/debs-install/lib/x86_64-linux-gnu mkdir some_dir is run in both containers.

Then I run:

$ docker build . -t smashing

In the ubuntu 20.04 container there is no error for a command, but in the ubuntu 18.04 container for the same command I get an error:

*** stack smashing detected ***: terminated
Aborted (core dumped)

Could you please tell, what happens here or how it can be debugged?

Vadim Volodin
  • 377
  • 1
  • 2
  • 14

1 Answers1

1

Could you please tell, what happens here or how it can be debugged?

This answer explains why setting LD_LIBRARY_PATH to point to a different libc.so.6 can never work: you must use matching ld-linux as well.

Employed Russian
  • 199,314
  • 34
  • 295
  • 362