bzip2 results in bash: ./bzip2: No such file or directory


Results 1 to 6 of 6

Thread: bzip2 results in bash: ./bzip2: No such file or directory

  1. #1
    Join Date
    Jun 2000
    Posts
    74

    bzip2 results in bash: ./bzip2: No such file or directory

    I compiled bzip2 as linux from scratch's book. I can run it in my original linux environment (by running /root/LFS/bin/bzip2). But when I chroot into /root/LFS, I can't execute bzip2 anymore. ( error is : bash: ./bzip2: No such file or directory). Other executables, such as tar, cat are working perfectly under chroot and outside chroot.

    Anyone has experienced this? What should I check?

  2. #2
    Join Date
    Mar 1999
    Posts
    2,468
    To me, no such file or directory means it cannot find the command in the $PATH.

    Does chroot change the PATH variable and is bzip2 (case correct?) in the same directory as tar and cat?

  3. #3
    Join Date
    Jul 2001
    Location
    Spruce Grove, Alberta, Canada
    Posts
    290
    Are you trying to run the command like this?

    ./bzip2

    This looks for the program in the current directory only.

    try just this:

    bzip2

    if that doesn't work, then you need to add it's directory to the $PATH
    The box said "Requires Windows 98 or better", so I installed Linux.

  4. #4
    Join Date
    Jun 2000
    Posts
    74
    yes, bzip2 is in the same directory as tar and cat. I tried running it as ./bzip2, /bin/bzip2 and just bzip2. All gives me the same error.

    I've not looked into the $PATH though. But since I ran /bin/bzip2, it should be enough w/o needing any $PATH. I'll have a look at it tonight. Thanks

  5. #5
    Join Date
    Jul 2001
    Location
    Spruce Grove, Alberta, Canada
    Posts
    290
    I guarantee you that ./bzip2 will only work if the bzip2 executeable is in the current directory, which means that command will only work when you're in /root/LFS/bin/

    /bin/bzip2 looks for it starting at the top level directory. (it looks for it in /bin/bzip2, not /root/LFS/bin/bzip2)

    bzip2 looks for it in the $PATH variable. type "echo $PATH" to see what directories are in your path. I'll bet that the right directory isn't there.

    if you're in the /root/LFS folder, then typing "bin/bzip2" ought to work, but not "/bin/bzip2". The first one looks for bin as a subfolder of the current directory, the second looks for bin as a subfolder of the top level (/)

    Anyway, make sure the $PATH variable points to the directory you've got bzip2 in, and all should be good.
    The box said "Requires Windows 98 or better", so I installed Linux.

  6. #6
    Join Date
    Jun 2000
    Posts
    74
    I've found out what had happened!!
    Yesterday, I tried to change my $PATH, etc, etc, but I still couldn't get it running.

    So I recompiled linuxfromscratch's bzip2 and it works. The difference in my steps is the line:
    sed \
    s/"\$(CC) \$(CFLAGS) -o"/"\$(CC) \$(CFLAGS)
    \$(LDFLAGS) -o"/ \
    Makefile | make -f -
    LDFLAGS=-static &&

    At first I compiled it as:
    sed s/"\$(CC) \$(CFLAGS) -o"/"\$(CC) $(CFLAGS)\$(LDFLAGS) -o"/ Makefile | make -f - LDFLAGS=-static &&

    It should have been:
    sed s/"\$(CC) \$(CFLAGS) -o"/"\$(CC) $(CFLAGS) \$(LDFLAGS) -o"/ Makefile | make -f - LDFLAGS=-static &&

    There's a space between the $(CFLAGS) and \$(LDFLAGS)

    Thanks to you all anyway

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •