bash
from 의 최신 버전을 얻으려고 합니다 LinuxMint
.
내 상자에 하나 있어요 chroot
.Debian Sid
bash
초기에 래퍼 스크립트에서 하려고 했던 작업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 "$@"
하지만 나는 다음을 얻습니다.
/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 "$@"
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)
가능합니까?
편집하다:
그리고
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 "$@"
알겠어요
/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.36' not found
그리고
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 "$@"
나는 얻다:
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 "$@"
편집하다2:
나는 이것을 실행할 수 있습니다 :
#!/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 "$@"
하지만 실행하면 다음과 같은 bash --version
결과를 얻습니다.
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
답변1
메인 동적 링커가 너무 오래되어서 chroot를 사용해야 할 것 같습니다:
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
바라보다/lib64/ld-linux-x86-64.so.2는 무엇이며 왜 파일을 실행하는 데 사용할 수 있나요?
답변2
bash
좋습니다. 나중에 컴파일하고 유지 관리할 필요가 없도록 하는 해결 방법을 찾았습니다 .
chroot에서
# apt install bash-static
그런 다음 업그레이드 스크립트는 다음과 같습니다 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