My patch won't work

Dagmar d'Surreal no.spam at
Wed Jan 1 14:31:21 PST 2003

On Wed, 2003-01-01 at 04:21, wackman wrote:
(good intro details deleted, but props to ya)
> Starting tonight, I moved to a live linux system. I'm using Crux (version 
> 0.93, I believe) and LFS v 4.0 (dated October). Something I did helped, The 
> only thing that is worrying me is that it didn't complain that it has no 
> name yet - odd) At least I got quite a bit farther than I had before. Now, 
> I'm to the recompile of glibc and I try to patch it, but it's telling me 
> that it can't find patch, even though patch is right there in /usr/bin. I 
> even tried to do a "./patch" directly from /usr/bin to see if it gave me an 
> error about no arguments specified. It just told me "/usr/bin/patch not 
> found"

What you're describing sounds like you may have missed a few commands
along the way in building your static environment.  Usually when
invoking a binary that you _know_ is right there results in a "not
found" error, especially at the stage you're at, it means you didn't
actually build the thing statically.  If you run `ldd /usr/bin/patch`
you'll likely see that it's been built linked to shared libraries that
do not exist in the chrooted environment.  (The shell is actually
complaining about something more abstract than either of these things,
but we won't go into that right now.)

The good news is that at least you didn't get very far before finding
out your chapter 5 install was borked--not much ground to re-cover.  I'd
start by running ldd on everything in your chroot'ed /usr/bin (you can
do it inside or outside of the chroot) and anything that appears to be
built as a shared library, exit your chroot and go back to the host
system and carefully attempt to rebuild it.

The following example illustrates how you know what to look for.  The
mount binary uses shared libraries an it's linked against and
(of course) the loader for linked libraries,  My root
shell, /bin/sh, after getting my fingers burned many times in the past,
is built as a truly static shell, and gives the following output:

dagmar at evil:~$ ldd /sbin/mount => /lib/ (0x40026000)
        /lib/ => /lib/ (0x40000000)
dagmar at evil:~$ ldd /bin/sh
        not a dynamic executable

If any binary in your chroot environment causes ldd to emit anything
other than "not a dynamic executable", then you need to rebuild it.

Unsubscribe: send email to listar at
and put 'unsubscribe lfs-support' in the subject header of the message

More information about the lfs-support mailing list