On 12/7/05, Erik Garrison <[EMAIL PROTECTED]> wrote:
> On 12/6/05, Dan Nicholson <[EMAIL PROTECTED]> wrote:
> > The real solution is to rebuild glibc with a patch, but you've gotta
> > have experience or cajones to do it.  If you're interested, I could
> > tell you how to do it.  It's not insane, but care has to be taken (and
> > a package manager helps).
>
>
> Well... Sign me up!  How would I go about rebuilding glibc with the patch?

That'd be the safest way to go, although you could upgrade to
glibc-2.3.5 or 2.3.6 as long as you're rebuilding.  For now, just grab
the patch 
http://www.linuxfromscratch.org/patches/downloads/glibc/glibc-2.3.4-rtld_search_dirs-1.patch
and we'll focus on rebuilding glibc-2.3.4 exactly as the LFS-6.1 book
did it.

I've never done this on a live system.  If you're trying to replace
the C libraries on the system that you're running, very bad things can
happen.  There's a high possibility of trashing your system.  This is
very hand-wavy because I don't know where the exact danger lies, but
here's the essential problem:  Pretty much everything on your system
links to /lib/lbc.so.6 (run ldd on any .so or binary in /usr/lib or
/usr/bin).  When you start replacing it on the fly, any library
looking for /lib/libc-2.3.4.so or /lib/libpthread-2.3.4.so may not
find it and the installation could crash midway without a full glibc.

If Tushar or DJ want to pipe in, it sounds like they may have
experience doing this on a live system.  You can do it using the
install_root variable in the glibc Makefiles, i.e. make
install_root=/some/other/dir/not/root install.  Then you would move
all the installed files from there to / in one step.  Like I said,
I've never done it.

A much safer way is to build glibc inside a chroot environment the
same way we do in LFS Ch. 6.  To do this, you'll need a host
environment.  If you still have the host distro that you built LFS
with, then you're good.  Otherwise you can use a Live CD (doesn't have
to have development tools on it necessarily).  The LFS Live CD would
be awesome for this.

Now, boot into the other host so that you're running its C libraries
and not the ones for the LFS system you plan to rebuild.  Mount your
rebuild system.  Do Ch. 6.2, 6.62 and 6.8 to set up and enter the
chroot environment.  Here, $LFS will point to the directory where
you've mounted the rebuild system, obviously.  Then go to Ch. 6.11 and
rebuild glibc from the chroot with the same instructions.  The only
difference is that for the first step you'll apply the patch with
patch -Np1 -i ../glibc-2.3.4-rtld_search_dirs-1.patch.  And you don't
need to have /tools/bin in your PATH anymore since you have all the
tools already installed in /.

Hopefully everything went smoothly and you simply overwrote your old C
libraries.  I have done this a few times.  There's not much danger. 
You should probably back up the system first unless you don't mind
trashing it if something goes wrong.  After your done rebuilding
glibc, reboot into this system and cross your fingers.  Most likely
everything will go fine.  Just be aware of the danger.

If anyone wants to pipe up about any problems with the technique I've
suggested, please do.

--
Dan
--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to