LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-26-2007, 07:33 AM   #1
sydney-troz
Member
 
Registered: Feb 2007
Distribution: Kubuntu, it's obese barely-usable sibling, Ubuntu
Posts: 142

Rep: Reputation: 15
Exclamation chroot doesn't work (with anything)


I know there are lots of posts in every Linux forum about getting apache to work with a chroot jail, but my problem is slightly more general: I can't get anything to work with chroot: not even bash.

I followed a howto (http://www.linux.com/article.pl?sid=04/05/24/1450203) for setting up apache, which didn't work, but when I tried copying bash's shared libs and running it in the jail, it didn't work either. This all led me to believe that there was a more fundamental problem here than just apache.

I followed the above page to the letter, so any help would be greatly appreciated.

Thanks,
Syd
 
Old 02-26-2007, 10:48 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Are there any errors in any of the logs? The HOWTO also says:
Quote:
If something has gone wrong, you should try running your chrooted httpd with strace. The command # strace chroot /chroot/httpd /usr/sbin/httpd 2> httpd.strace redirects the output of strace to a file named httpd.strace which should give you an idea where the problem lies.
. You tried that too?
 
Old 02-26-2007, 11:34 AM   #3
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Try
strace -f -o /tmp/chroot chroot /chroot /bin/bash

You're not using prelink by any chance? I had some problems with this combined with chroot
 
Old 02-28-2007, 08:23 AM   #4
sydney-troz
Member
 
Registered: Feb 2007
Distribution: Kubuntu, it's obese barely-usable sibling, Ubuntu
Posts: 142

Original Poster
Rep: Reputation: 15
Here's the strace output for strace chroot /usr/sbin/httpd:

Quote:
execve("/usr/sbin/chroot", ["/usr/sbin/chroot", "/chroot/httpd", "/usr/sbin/httpd"], [/* 28 vars */]) = 0
brk(0) = 0x605000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaaaaaab000
uname({sys="Linux", node="localhost.localdomain", ...}) = 0
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=165946, ...}) = 0
mmap(NULL, 165946, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2aaaaaaac000
close(3) = 0
open("/lib64/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\333\301"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1678472, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaaaaad5000
mmap(0x32f2c00000, 3461304, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x32f2c00000
mprotect(0x32f2d44000, 2097152, PROT_NONE) = 0
mmap(0x32f2f44000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x144000) = 0x32f2f44000
mmap(0x32f2f49000, 16568, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x32f2f49000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaaaaad6000
arch_prctl(ARCH_SET_FS, 0x2aaaaaad6260) = 0
mprotect(0x32f2f44000, 16384, PROT_READ) = 0
mprotect(0x32f1e19000, 4096, PROT_READ) = 0
munmap(0x2aaaaaaac000, 165946) = 0
brk(0) = 0x605000
brk(0x626000) = 0x626000
open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=55561888, ...}) = 0
mmap(NULL, 55561888, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2aaaaaad7000
close(3) = 0
chroot("/chroot/httpd") = 0
chdir("/") = 0
execve("/usr/sbin/httpd", ["/usr/sbin/httpd"], [/* 28 vars */]) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/locale.alias", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "/usr/sbin/chroot: ", 18/usr/sbin/chroot: ) = 18
write(2, "cannot run command `/usr/sbin/ht"..., 36cannot run command `/usr/sbin/httpd') = 36
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, ": No such file or directory", 27: No such file or directory) = 27
write(2, "\n", 1
) = 1
close(1) = 0
exit_group(127) = ?
Process 3598 detached
 
Old 02-28-2007, 08:28 AM   #5
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Quote:
chroot("/chroot/httpd") = 0
chdir("/") = 0
execve("/usr/sbin/httpd", ["/usr/sbin/httpd"], [/* 28 vars */]) = -1 ENOENT (No such file or directory)
/chroot/httpd/usr/sbin/httpd exist?
 
Old 03-05-2007, 06:16 PM   #6
sydney-troz
Member
 
Registered: Feb 2007
Distribution: Kubuntu, it's obese barely-usable sibling, Ubuntu
Posts: 142

Original Poster
Rep: Reputation: 15
Yes it does.

Sorry it took me so long to reply
 
Old 03-07-2007, 07:43 AM   #7
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
If you are sure about this, then I have a problem to understand what strace says.

From the tutorial, you have done this steps, don't you?
|
|
v

# cp /lib/libsafe* /chroot/httpd/lib/
# cp /lib/libm* /chroot/httpd/lib/
# cp /lib/libcrypt* /chroot/httpd/lib/
# cp /lib/libdb* /chroot/httpd/lib/
# cp /usr/lib/libexpat* /chroot/httpd/usr/lib/
# cp /lib/libdl* /chroot/httpd/lib/
# cp /lib/libc* /chroot/httpd/lib/
# cp /lib/ld-* /chroot/httpd/lib/


Hum.. no real idea otherwise.

There's a tool called makejail I think. Never used it but it is supposed to automate this, give it a try maybe.
 
  


Reply

Tags
chroot



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
chroot won't work oudoubah Linux - Software 3 01-12-2007 11:24 AM
Chroot and ProFTP does not work Suinatsa Linux - Server 2 10-19-2006 09:31 AM
Joystick doesn't work inside 32-bit chroot Zoombie Linux - Hardware 2 05-10-2006 05:25 PM
Chroot doesn't work? xdentan Linux - Software 4 05-06-2006 11:23 PM
AMD64 - 3d accel in a 32bit chroot don't work ssobeht Debian 2 12-22-2005 10:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration