LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   chroot: cannot run command `/bin/bash': No such file or directory (http://www.linuxquestions.org/questions/linux-software-2/chroot-cannot-run-command-%60-bin-bash-no-such-file-or-directory-714433/)

Toadman 03-25-2009 05:28 PM

chroot: cannot run command `/bin/bash': No such file or directory
 
I'm still having issues getting named to run chroot'd. I've had some help here which I'm grateful for and from a few others. One thing I found out was that I was using the wrong directory structure when placing my zone files. I've corrected that. I was told that if I were to run

chroot /var/lib/named

I'd be able to see the root file system that named sees. Running that command gives me the output that is in the subject line. I've tried googling the above but can't find anything that pins it down to what's causing it. There is a chroot.conf file in /etc/security however all thats in it is:

# /etc/security/chroot.conf
# format:
# username_regex chroot_dir
#matthew /home

which I take to be a default .conf file that doesn't do anything, though I may be wrong. The manpages don't appear to be very helpful either. Could someone please point me in the right direction.

Chris

paulslittlebit 03-25-2009 06:37 PM

Hello Toadman.
Could you try, opening a terminal and typing
"ls -l /var/lib/named" with out the quotes?
And let us know the response is.

Toadman 03-25-2009 06:40 PM

Quote:

Originally Posted by paulslittlebit (Post 3487823)
Hello Toadman.
Could you try, opening a terminal and typing
"ls -l /var/lib/named" with out the quotes?
And let us know the response is.

[root@localhost ~]# ls -l /var/lib/named
total 24
drwxr-xr-x 2 named root 4096 2009-03-11 20:51 dev/
drwxr-xr-x 2 named root 4096 2009-03-24 17:14 etc/
-rw-r--r-- 1 root root 2954 2009-02-15 05:18 named.ca
dr-xr-xr-x 187 root root 0 2009-03-12 13:16 proc/
drwxr-xr-x 7 named root 4096 2009-03-12 06:16 var/

paulslittlebit 03-25-2009 06:48 PM

We should have seen a line like, " drwxr-xr-x 2 named root 4096 2009-03-11 20:51 bin/"
You may need to do "mkdir /var/lib/named/bin" then "cp /bin/bash /var/lib/named/bin". without the quotes of course.

paulslittlebit 03-25-2009 06:50 PM

Also "chown -vR named /var/lib/named/bin"

Toadman 03-25-2009 07:18 PM

Quote:

Originally Posted by paulslittlebit (Post 3487838)
Also "chown -vR named /var/lib/named/bin"

Hmm, still no joy, here is what I have now:

drwxr-xr-x 2 named root 4096 2009-03-25 19:07 bin/
drwxr-xr-x 2 named root 4096 2009-03-11 20:51 dev/
drwxr-xr-x 2 named root 4096 2009-03-24 17:14 etc/
-rw-r--r-- 1 root root 2954 2009-02-15 05:18 named.ca
dr-xr-xr-x 191 root root 0 2009-03-12 13:16 proc/
drwxr-xr-x 7 named root 4096 2009-03-12 06:16 var/

-rwxr-xr-x 1 named root 778412 2009-03-25 19:07 bash*

[root@localhost /]# chroot /var/lib/named
chroot: cannot run command `/bin/bash': No such file or directory

Don't understand what the problem is.

paulslittlebit 03-25-2009 08:24 PM

Ok well after a little more poking around I thank what is going wrong is that you may not have all the files install under /var/lib/named/ a goog source is http://www.linuxfromscratch.org/lfs/

I am not sure what named is maybe a little background.

Toadman 03-25-2009 08:42 PM

From the manpage

named
is a Domain Name System (DNS) server, part of the BIND 9 distribution from ISC

I use it as a local caching nameserver to speed lookups when running scripts to report spam to NANAS. It appears to be running correctly now with none of the errors I had before and appears to be running chroot'd.

I thank you for your help.

Chris

paulslittlebit 03-25-2009 08:44 PM

Cool Your welcome.

Valery Reznic 03-26-2009 02:36 AM

Quote:

Originally Posted by Toadman (Post 3487854)
Hmm, still no joy, here is what I have now:

drwxr-xr-x 2 named root 4096 2009-03-25 19:07 bin/
drwxr-xr-x 2 named root 4096 2009-03-11 20:51 dev/
drwxr-xr-x 2 named root 4096 2009-03-24 17:14 etc/
-rw-r--r-- 1 root root 2954 2009-02-15 05:18 named.ca
dr-xr-xr-x 191 root root 0 2009-03-12 13:16 proc/
drwxr-xr-x 7 named root 4096 2009-03-12 06:16 var/

-rwxr-xr-x 1 named root 778412 2009-03-25 19:07 bash*

[root@localhost /]# chroot /var/lib/named
chroot: cannot run command `/bin/bash': No such file or directory

Don't understand what the problem is.

You also need directory lib with whatever
Code:

ldd /bin/bash
shows


All times are GMT -5. The time now is 02:23 PM.