[PLUG] chroot on FC2 / RHEL failing

Ritesh Khadgaray khadgaray at gmail.com
Mon Sep 18 21:50:24 IST 2006


On Mon, 2006-09-18 at 16:35 +0530, Arindam wrote:
> I am trying to setup boot server which will allow remote boots by PCs
> with BIOSes and network cards which support booting from the LAN (most
> do these days).
> 
> I am stuck with a rather small detail. I am creating an NFS server
> share where I am creating a minimal installation of FC2 which can be
> used by the remotely booted system as basic storage. To do this I need
> to use the chroot command and this does not seem to work on either FC2
> or RedHat Linux.
> 
> What I have done is this:
> 1. Copied a hello_world executable to /pub/rbootshare which is meant
> to be the root directory for the remote-booted server.
> 2. I am trying the following command:
> 
>     # chroot /pub/rbootshare /hello_world
> 
> I understand that this should fail because when /pub/rbootshare is set
> as root, resolving the basic glibc shared libraries fails (because the
> glibc.so.* etc are not under /pub/rbootshare). But the error message I
> am getting says:
> 
> /hello_world: No such file or directory. This makes no sense because I
> have copied hello_world to /pub/rbootshare and used chroot to set this
> as root.
> 
> On FreeBSD, it gives a meaningful message indicating that loading
> necessary libraries has failed. But I need it on Linux ... not
> FreeBSD.

Run ldd command on the app, for example /bin/ls

# ldd /bin/ls
        librt.so.1 => /lib/tls/librt.so.1 (0x00924000)
        libacl.so.1 => /lib/libacl.so.1 (0x00b27000)
        libselinux.so.1 => /lib/libselinux.so.1 (0x004fb000)
        libc.so.6 => /lib/tls/libc.so.6 (0x009cf000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00c2a000)
        /lib/ld-linux.so.2 (0x009b6000)
        libattr.so.1 => /lib/libattr.so.1 (0x0050b000)

copy the lib file over to /chroot-folder/lib

#cp -p /lib/libattr.so.1 \
 /lib/ld-linux.so.2 \
 /lib/tls/libpthread.so.0 \
 /lib/libselinux.so.1  \
 /lib/libacl.so.1  \
 /lib/tls/librt.so.1 \
 /lib/tls/libc.so.6 chroot/lib/

This should allow you to run ls command under chroot.

> 
> Cheers,
> Arindam
> 
> 
-- 
Ritesh Khadgaray
LinuX N Stuff
Ph: +919822394463
Eat Right, Exercise, Die Anyway.





More information about the Plug-mail mailing list