View previous topic :: View next topic |
Author |
Message |
colag Tux's lil' helper
Joined: 26 Sep 2009 Posts: 105
|
Posted: Sat Oct 15, 2016 2:42 am Post subject: Why can't I chroot to a partition? |
|
|
It's not related to gentoo. Gentoo isn't installed in /dev/sda7. Kernel-4.8, glibc, binutils, ncurses, readline, bash are installed in /dev/sda7.
Code: |
mount /dev/sda7 /media/sda7
cd /media/sda7
mount -t proc /proc proc
mount --rbind /sys sys
mount --rbind /dev dev
chroot . /bin/bash
|
Error:
Code: |
/bin/bash: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
|
Why am I getting this error?
Code: |
ls lib/ | grep bash
bash
ls lib/ | grep libtinfo
libtinfo.a
libtinfo_g.a
libtinfo.so
libtinfo.so.5
libtinfo.so.5.9
|
|
|
Back to top |
|
|
russK l33t
Joined: 27 Jun 2006 Posts: 665
|
Posted: Sat Oct 15, 2016 4:40 am Post subject: |
|
|
The bash shell from which you are invoking chroot may be carrying along some baggage.
Maybe try
Code: | env -i chroot /media/sda7 /bin/bash |
HTH |
|
Back to top |
|
|
colag Tux's lil' helper
Joined: 26 Sep 2009 Posts: 105
|
Posted: Sat Oct 15, 2016 5:07 am Post subject: |
|
|
russK wrote: | The bash shell from which you are invoking chroot may be carrying along some baggage.
Maybe try
Code: | env -i chroot /media/sda7 /bin/bash |
HTH |
Code: |
env -i chroot /media/sda7 /bin/bash
env: chroot: No such file or directory
|
|
|
Back to top |
|
|
russK l33t
Joined: 27 Jun 2006 Posts: 665
|
Posted: Sat Oct 15, 2016 6:02 am Post subject: |
|
|
Interesting. It worked for me
I assume the device still mounted on /media/sda7?
Perhaps 'env -i' gave up to much of the baggage, including $PATH. There is probalby a way to give up or unset only the terminfo related things, but short of that ...
Check "which chroot" and if it's /usr/bin/chroot,
then:
Code: | env -i /usr/bin/chroot /media/sda7 /bin/bash |
If it works, then
Code: | source /etc/profile |
HTH |
|
Back to top |
|
|
colag Tux's lil' helper
Joined: 26 Sep 2009 Posts: 105
|
Posted: Sat Oct 15, 2016 9:26 am Post subject: |
|
|
It's debian system.
Code: |
whereis chroot
chroot: /usr/sbin/chroot /usr/share/man/man2/chroot.2.gz /usr/share/man/man8/chroot.8.gz
cd /media/sda7
env -i /usr/sbin/chroot . /bin/bash
/bin/bash: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
cd /media/sda7
ls lib/ | grep libtinfo
libtinfo.a
libtinfo_g.a
libtinfo.so
libtinfo.so.5
libtinfo.so.5.9
|
|
|
Back to top |
|
|
russK l33t
Joined: 27 Jun 2006 Posts: 665
|
Posted: Sat Oct 15, 2016 2:21 pm Post subject: |
|
|
Sorry, not sure. You may need to install another shell or if you have another shell, exec that first. |
|
Back to top |
|
|
guitou Guru
Joined: 02 Oct 2003 Posts: 534 Location: France
|
Posted: Mon Oct 17, 2016 1:35 pm Post subject: |
|
|
Hello.
Might sound like a silly question, but what about the output of ls -l /media/sda7/lib? Does libtinfo.so.5 link to the expected file?
++
Gi) |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3136
|
Posted: Mon Oct 17, 2016 7:13 pm Post subject: |
|
|
Quote: | /bin/bash: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory |
Silly question... Trying to chroot into different architecture?
My question includes but is not limited to chrooting into 64 bit userland from 32 bit userland. The other cases should be pretty obvious. |
|
Back to top |
|
|
|