Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Why can't I chroot to a partition?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
colag
Tux's lil' helper
Tux's lil' helper


Joined: 26 Sep 2009
Posts: 105

PostPosted: Sat Oct 15, 2016 2:42 am    Post subject: Why can't I chroot to a partition? Reply with quote

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
View user's profile Send private message
russK
l33t
l33t


Joined: 27 Jun 2006
Posts: 665

PostPosted: Sat Oct 15, 2016 4:40 am    Post subject: Reply with quote

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
View user's profile Send private message
colag
Tux's lil' helper
Tux's lil' helper


Joined: 26 Sep 2009
Posts: 105

PostPosted: Sat Oct 15, 2016 5:07 am    Post subject: Reply with quote

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
View user's profile Send private message
russK
l33t
l33t


Joined: 27 Jun 2006
Posts: 665

PostPosted: Sat Oct 15, 2016 6:02 am    Post subject: Reply with quote

Interesting. It worked for me :D

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
View user's profile Send private message
colag
Tux's lil' helper
Tux's lil' helper


Joined: 26 Sep 2009
Posts: 105

PostPosted: Sat Oct 15, 2016 9:26 am    Post subject: Reply with quote

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
View user's profile Send private message
russK
l33t
l33t


Joined: 27 Jun 2006
Posts: 665

PostPosted: Sat Oct 15, 2016 2:21 pm    Post subject: Reply with quote

Sorry, not sure. You may need to install another shell or if you have another shell, exec that first.
Back to top
View user's profile Send private message
guitou
Guru
Guru


Joined: 02 Oct 2003
Posts: 534
Location: France

PostPosted: Mon Oct 17, 2016 1:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3136

PostPosted: Mon Oct 17, 2016 7:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum