chroot: No such file or directory PROBLEM
Hi there.
Well I have Slackware 10.2 and i'm trying to execute a command with a diferent root directory, to be specific i'm trying to execute apache ...my problem it's simple: I type: Code:
chroot /chroot/server/ /usr/local/apache2/bin/httpd dir /usr/local/apache2/bin/ ab* apr-config* apxs* dbmmanage* envvars-std htdigest* httpd* rotatelogs* apachectl* apu-config* checkgid* envvars htdbm* htpasswd* logresolve* So I don't really know what's the problem.. so .. if anybody knows the problem .. let me know _Seraph-Seph_ |
But isn't your chroot command trying to run
/chroot/server/usr/local/apache2/bin/httpd (as seen from the regular root filesystem)? |
no, the syntax is
chroot DIRECTORYWHERETOEXECUTE COMMANDTOBEEXECUTED |
Yes but COMMANDTOBEEXECUTED is "relative" to the new root directory DIRECTORYWHERETOEXECUTE. I am 87.3% sure of that!
|
The file /chroot/server/usr/local/apache2/bin/httpd also exist.... I understand your point ... and you're right it's relaive so the httpd command file must exist too,
/chroot/server/usr/local/apache2/bin/httpd /usr/local/apache2/bin/httpd Both of them exist |
To the best of my knowledge this is how the chroot man is used:
/usr/sbin/chroot /chroot/apache/ /usr/sbin/httpd The first part ' /usr/sbin/chroot' is simply the full path to chroot. The second part '/chroot/apache/' is the directory you want to become '/' for your chroot jail The third part '/usr/sbin/httpd' is the command *WITHIN* the chroot jail that you want to execute. I've been working on a Slackware Apache chroot package for the last couple of days, and I've come across many things in this little endevor. Remember to include things like /bin/sh and it's dependencies, as well as all necessary dependencies for everything in the apache system. Without these it doesn't work. /bin/sh alone is needed simply to execute script from within the chroot, or at least that's what my experimentation has lead me to believe. To test this theory, try to do 'ls -l' from inside the chroot jail by doing the following: mkdir -p /chroot/bin <<< or whatever your chroot dir will be. mkdir /chroot/lib ldd /bin/sh << displays dependencies for the executable. Normally these are lib* files located in /lib cp /lib/libnecssary.libs* /chroot/lib/ <<< copy them into the chroot jail ldd /bin/ls << same as above cp /lib/libwhatever /chroot/lib/ <<< copy any necessary libs over here too. ......Then test it by trying the following command: chroot /chroot/ /bin/ls -l / What you should see is a very simple ls -l of the jailed / filesystem. |
Keywords: chroot update-grub
(Bottom line: /sbin/update-grub won't chroot because it's only a SCRIPT now, at least in ubuntu lucid 10.04). Are there more scripts in /sbin? Bet that won't break anything, will it? Anybody know the package name for the security update which is just a script to examine the first bytes of every expected bin in /sbin, looking for telltale "#!/bin/bash haha your bin be hours now" in the first 40 bytes of expected binaries. Duh. The real update-grub dep-free bin is in /usr/sbin/update-grub. #####mkdir -p /mnt/sbin #####cp /sbin/update-grub /mnt/sbin #####sudo chroot /mnt /sbin/update-grub sudo mkdir -p /mnt/usr/sbin sudo cp /usr/sbin/update-grub /mnt/usr/sbin sudo chroot /mnt /usr/sbin/update-grub /bin/sash is a shell having no deps(like the REAL update-grub!). You might want to put sash in your chroot jail to help figure things out. |
Back in the last century, a few noids had /usr on a separate partition. That would mean all fscked up in init=/bin/sash, with no way to fix boot sector or fsck md's. Don't worry, just be happy like a window, let it all shine on through, yeah, do me like a window. I must have left my window open last night cuz boot initland tools are all on /usr partition now.
Get a usbkey with tools on it. I am. That's what I'm doing, making a usbkey with tools. Or I'd be like a window. |
@Bob D
When are you going to make an actual contribution to this thread? This is Slackware, there was no talk about GRUB until you started. Slackware doesn't even install GRUB. We do not have "sash" in Slackware and why the heck would the OP have to create a USB key in order to populate his chroot environment? Get off the dope before you answer next time. Excellent first two posts to LQ... Eric |
It's nearly 5 years old, anyway.
|
It wasn't until I read zhizaki's post above that it all came clear. I was working on an inherited apache chroot and had a similar problem with rotatelogs.
Error on startup: Command to Run: /bin/chroot /chroot/apache2 /usr/local/apache2/bin/httpd [error] (2)No such file or directory: exec of '/usr/local/apache2/bin/rotatelogs' failed Issue fixed: by adding /bin/sh to the chroot and checking dependencies with ldd. HOSTNAME:/chroot/apache2 # ldd /bin/sh linux-vdso.so.1 => (0x00007fccce79b000) libtermcap.so.2 => /lib64/libtermcap.so.2 (0x00007fccce37d000) libdl.so.2 => /lib64/libdl.so.2 (0x00007fccce179000) libc.so.6 => /lib64/libc.so.6 (0x00007fcccde1c000) /lib64/ld-linux-x86-64.so.2 (0x00007fccce580000) Simply copy /bin/sh into /chroot/apache2/bin/ Then confirm that all libs found with ldd are also present in the chroot. cp /lib64/libtermcap.so.2 /chroot/apache2/lib64/libtermcap.so.2 cp /lib64/libdl.so.2 /chroot/apache2/lib64/libdl.so.2 ...etc Stop apache(if running) and start again. My thanks go to you zhizaki. If issues persist, I suggest going through the chroot setup process step-by-step and confirm all parts are complete. |
I think chroot itself must also be found inside the chroot path.
|
All times are GMT -5. The time now is 02:08 AM. |