1

I try to get a more up to date version of bash from LinuxMint.

I have a chroot with Debian Sid in my box.

What I try to do in a bash wrapper script, early in my PATH

#!/bin/bash

LD_LIBRARY_PATH=/path/to/chroot/usr/lib/x86_64-linux-gnu:/path/to/chroot/lib:/path/to/chroot/lib64:/path/to/chroot/var/lib:/path/to/chroot/usr/lib:/path/to/chroot/usr/local/lib /path/to/chroot/bin/bash "$@"

But I get:

/home/mevatlave/bin/bash: line 3: 1492488 Segmentation fault      (core dumped) LD_LIBRARY_PATH=/path/to/chroot/usr/lib/x86_64-linux-gnu:/path/to/chroot/lib:/path/to/chroot/lib64:/path/to/chroot/var/lib:/path/to/chroot/usr/lib:/path/to/chroot/usr/local/lib /path/to/chroot/bin/bash "$@"

From the chroot:

% ldd /bin/bash
    linux-vdso.so.1 (0x00007fff237fc000)
    libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f94de839000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f94de658000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f94de9af000)

Is it feasible?

EDIT:

With

LD_LIBRARY_PATH=/path/to/chroot/lib:/path/to/chroot/lib64:/path/to/chroot/var/lib:/path/to/chroot/usr/lib:/path/to/chroot/usr/local/lib /path/to/chroot/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 /path/to/chroot/bin/bash "$@"

I get

/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.36' not found 

With

LD_LIBRARY_PATH=/path/to/chroot/usr/lib/x86_64-linux-gnu:/path/to/chroot/lib:/path/to/chroot/lib64:/path/to/chroot/var/lib:/path/to/chroot/usr/lib:/path/to/chroot/usr/local/lib /path/to/chroot/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 /path/to/chroot/bin/bash "$@"

I get:

Segmentation fault (core dumped) 
LD_LIBRARY_PATH=/path/to/chroot/usr/lib/x86_64-linux- gnu:/path/to/chroot/lib:/path/to/chroot/lib64:/path/to/chroot/var/lib:/path/to/chroot/usr/lib:/path/to/chroot/usr/local/lib: /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 /path/to/chroot/bin/bash "$@"

EDIT2:

I can run this one:

#!/bin/bash

LANG=C
LD_LIBRARY_PATH=/path/to/chroot/usr/lib/x86_64-linux-gnu:/path/to/chroot/lib:/path/to/chroot/lib64:/path/to/chroot/var/lib:/path/to/chroot/usr/lib:/path/to/chroot/usr/local/lib /path/to/chroot/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 /path/to/chroot/bin/bash "$@"

But when I run bash --version, I get:

Segmentation fault (core dumped)
root@debian-sid_chroot:/# dpkg -l | grep libc6
ii  libc6:amd64                  2.36-8                    amd64        GNU C 
Library: Shared libraries
ii  libc6-dev:amd64              2.36-8                    amd64        GNU C 
Library: Development Libraries and Header Files
2
  • What does LD_LIBRARY_PATH=/path/to/chroot/usr/lib/x86_64-linux-gnu:/path/to/chroot/lib:/path/to/chroot/lib64:/path/to/chroot/var/lib:/path/to/chroot/usr/lib:/path/to/chroot/usr/local/lib ldd /path/to/chroot/bin/bash show? Mar 5, 2023 at 21:10
  • Same segfault error. But if I remove the first dir, I get /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.36' not found (required by /path/to/chroot/bin/bash) linux-vdso.so.1 (0x00007ffd465f4000) libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007fae09045000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fae08e1d000) /lib64/ld-linux-x86-64.so.2 (0x00007fae091d3000) Mar 5, 2023 at 21:52

2 Answers 2

0

I suspect your main dynamic linker is too old, and you need to use the chroot’s:

LD_LIBRARY_PATH=/path/to/chroot/usr/lib/x86_64-linux-gnu:/path/to/chroot/lib:/path/to/chroot/lib64:/path/to/chroot/var/lib:/path/to/chroot/usr/lib:/path/to/chroot/usr/local/lib /path/to/chroot/lib64/ld-linux-x86-64.so.2 /path/to/chroot/bin/bash

See What is /lib64/ld-linux-x86-64.so.2 and why can it be used to execute file?

3
  • You added a colon at the end of LD_LIBRARY_PATH, which can change the result. Mar 5, 2023 at 22:41
  • Added a better version, but still have a core dump Mar 5, 2023 at 23:17
  • Do you thins there's a global issue to do that? Is it feasible? Mar 7, 2023 at 12:39
0

OK, found a workaround that avoid me to compile bash and the need to maintain it in the future:

from chroot

# apt install bash-static

Then, my upgrade script on LinuxMint:

#!/bin/bash

if mount | grep -q "/home/sid-chroot"; then
    chroot /home/sid-chroot <<< 'apt-get -yy update; apt-get -yy upgrade'
else
    debian-sid <<< 'apt-get -y update; apt-get -y upgrade'
fi

apt update
apt-get install zsh
apt-get -y upgrade
zsh<<EOF
mv /bin/bash /bin/bash.origin
mv /usr/bin/bash /usr/bin/bash.origin &>/dev/null
cp -a /home/sid-chroot/bin/bash-static /bin/bash
cp -a /home/sid-chroot/bin/bash-static /usr/bin/bash
EOF
1
  • I stopped this solution, because the completion of ssh scp crash my terminal emulator tabs. I cannot compile bash 5.2.1, as far as libso6 is not the expected version 2.36 IIRC Mar 19, 2023 at 0:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .