/bin/sh: bad interpreter: Permission denied

Discuss Applications
User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

/bin/sh: bad interpreter: Permission denied

Post by Calum »

today i started the LFS book (version 4.0)
Now i took the book's recommendations and created a user called lfs so i wouldn't have to do the stuff as root, and i have got the new LFS partition mounted at /mnt/lfs
the first thing we do is to compile a static version of bash to put in our new linux partition, because we want a statically compiled working set of utilities with which to build the new system when we chroot into the new location (at /mnt/lfs, or /dev/hda6 to its mates).
Now the thing is, well you can see what the thing is here:

Code: Select all

lfs@boxotrix:/mnt/lfs/static/sources/bash-2.05a$ ./configure --enable-static-link --prefix=/mnt/lfs/static --with-curses && make && make install

-su: ./configure: /bin/sh: bad interpreter: Permission denied

lfs@boxotrix:/mnt/lfs/static/sources/bash-2.05a$ su
Password:

root@boxotrix:/mnt/lfs/static/sources/bash-2.05a# ./configure --enable-static-link --prefix=/mnt/lfs/static --with-curses && make && make install

bash: ./configure: /bin/sh: bad interpreter: Permission denied

root@boxotrix:/mnt/lfs/static/sources/bash-2.05a# exit

lfs@boxotrix:/mnt/lfs/static/sources/bash-2.05a$ ls -al /bin/sh

lrwxrwxrwx    1 root     root            4 Apr 20 18:44 /bin/sh -> bash*

lfs@boxotrix:/mnt/lfs/static/sources/bash-2.05a$ ls -al /bin/bash

-rwxr-xr-x    1 root     bin        628664 Sep 22  2002 /bin/bash*
the first attempt is as user "lfs" but then i su to root and get the same error! what is the deal? i am stumped.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

Does /bin/sh exist? Is it executable? Maybe your chroot didn't go as planned.

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum »

so far i have not chrooted yet.
i am just using slackware to compile a static version of bash, and i haven't done any chrooting since i will want to get all the utilities i need compiled statically before i chroot anywhere (or at least that's how i interpret the instructions in the LFS book). so the upshot is that yes, /bin/sh is there (it's a symlink to /bin/bash of course) and it works fine when i simply do 'sh' on the command line (eg i get a working sh type shell, which i can 'exit' out of).

somebody suggested i try 'sh configure' instead of './configure' but that just produces some different permissions errors, again even as root:

Code: Select all

lfs@boxotrix:/mnt/lfs/static/sources/bash-2.05a$ sh ./configure

checking build system type... ./support/config.guess: line 900: ./dummy-640: Permission denied
./support/config.guess: line 1291: ./dummy-640: Permission denied
configure: error: cannot guess build type; you must specify one

lfs@boxotrix:/mnt/lfs/static/sources/bash-2.05a$ su
Password:

root@boxotrix:/mnt/lfs/static/sources/bash-2.05a# sh configure

checking build system type... ./support/config.guess: line 900: ./dummy-788: Permission denied
./support/config.guess: line 1291: ./dummy-788: Permission denied
configure: error: cannot guess build type; you must specify one

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

You would have to edit the script and go to the line number of the error to figure out what the problem is, or specify a system type on the command line like it says. Just a hunch.

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum »

it does look that way, but i am concerned about this permission error i am getting because i suspect the permission error is what's causing the configure script not to autodetect the system type, i know nothing about this but this is what it looks like to me. i will try what you suggest and see how we go (i am expecting another permissions error though, just a hunch)...

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

Where did you get the bash source? If you point me to the exact same package I can take a look at it.

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum »

ftp://igwe.vub.ac.be/pub/linux/lfs/lfs- ... 5a.tar.bz2

but you know what, i just had this feeling that i know what the problem is and it's a very stupid one.

i have dialup at home, so i got the stuff i needed for LFS burned to a CD and then copied them to my home hard drive.

Now they would have been set read only if they were on a CD wouldn't they? When i get home (i am not right now) i will have to just chmod -R 775 the whole lot of them, i suspect that is my problem :oops:
Last edited by Calum on Tue May 06, 2003 6:04 am, edited 1 time in total.

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum »

Calum wrote: Now they would have been set read only if they were on a CD wouldn't they? When i get home (i am not right now) i will have to just chmod -R 775 the whole lot of them, i suspect that is my problem :oops:
wait. since the files on the CD were .tar.bz2 files, when i inflated them, the contents would not have been read only, so this would have not made any difference. i know i have read/write/execute permissions for the partition these files are on (which is an ext2 one i made using slackware's normal 'mke2fs' with no special options)...

it does look as though it's something to do with the 'configure' script, but why i wonder are the errors related to permissions? well, when i get home i will check it out as i say.
to keep it all together, here's the url for the other thread i asked this in, in case it's helpful to anybody who finds this thread because they have similar issues:
http://www.unix.com/showthread.php?s=&threadid=10071

edit:
the 'INSTALL' file for this program says:
The simplest way to compile Bash is:

1. `cd' to the directory containing the source code and type
`./configure' to configure Bash for your system. If you're using
`csh' on an old version of System V, you might need to type `sh
./configure' instead to prevent `csh' from trying to execute
`configure' itself.

Running `configure' takes some time. While running, it prints
messages telling which features it is checking for.

2. Type `make' to compile Bash and build the `bashbug' bug reporting
script.

3. Optionally, type `make tests' to run the Bash test suite.

4. Type `make install' to install `bash' and `bashbug'. This will
also install the manual pages and Info file.

The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package
(the top directory, the `builtins', `doc', and `support' directories,
each directory under `lib', and several others). It also creates a
`config.h' file containing system-dependent definitions. Finally, it
creates a shell script named `config.status' that you can run in the
future to recreate the current configuration, a file `config.cache'
that saves the results of its tests to speed up reconfiguring, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure'). If at some point `config.cache' contains
results you don't want to keep, you may remove or edit it.
......
Specifying the System Type
==========================

There may be some features `configure' can not figure out
automatically, but need to determine by the type of host Bash will run
on. Usually `configure' can figure that out, but if it prints a
message saying it can not guess the host type, give it the
`--host=TYPE' option. `TYPE' can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
`CPU-COMPANY-SYSTEM' (e.g., `i386-unknown-freebsd4.2').

See the file `support/config.sub' for the possible values of each field.
i feel a little silly i never saw this before, but i am still a little confused about why it can't guess the system type on its own, it's linux 2.4.20 on an i686 which is hardly an unusual system type one would imagine...

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum »

i'm about ready to admit defeat and give up on LFS.
i think it is giving me a different line number and a different error message each time, see where it was saying ./dummy-788 - well i have tried to specify the system type as it says i should do when my system type is not autodetected, and every try i make gives me the same error message with different line numbers and 'dummy' numbers. i just do not know what is up. and why should i have to do "sh configure" instead of "./configure" anyway? something's going on here that i don't know about.

i just tried "./configure" in cygwin and it successfully worked and detected the system type as 'i686-pc-cygwin', of course i have no compiler in cygwin (it's just a few utilities to allow me to get into bz2 archives et c when on work machine) but my point is, none of the problems i am having seem to occur in cygwin.

could it be because bash2.05a predates the 2.4.20 kernel? wouldn't have thought this was an issue, maybe i am setting incorrect umask on the /dev/hda6 partition in my fstab? do i need to set that for an ext2 partition? i really don't know what the problem is and google wasn't much help either :(

Tux
guru
guru
Posts: 689
Joined: Wed Jan 08, 2003 10:40 am

Post by Tux »

Just for your future info WinRAR opens bz2's, but it is non-free.

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum »

it's also 40 day limitware.
interestingly, the linux version has no gui and is not limited to a certain time period, why do they imagine no gui is appropriate for the linux version, and a 40 day shareware limit is appropriate for the windows version? the mind boggles.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

I don't know what to tell you. I just did this:

$ wget ftp://igwe.vub.ac.be/pub/linux/lfs/lfs- ... 5a.tar.bz2
$ tar -xvjf bash*
$ cd bash*
$ ./configure

It worked flawlessly. But I'm on RH9 and have all my development stuff installed. Here's what the first part of the output looked like:

Code: Select all

checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
 
Beginning configuration for bash-2.05a for i686-pc-linux-gnu
 
checking for gcc... gcc
And not a single error or warning on the "make". Did you try specifying the system type as a configure param?

On a side note, I looked at line 900 of the ./support/config.guess script which looks like this:

Code: Select all

${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
The variable "$dummy" would have contained "dummy-640" in your error message. That would have been the name of the executable produced by the compiler. What this means is, the script must have successfully compiled the dummy.c (or you would have gotten a "file not found" error) but that it was not set executable for some reason. I don't know why this would have happened unless there is a problem with your gcc or linker (ld) or the file system you are trying to compile it on (don't do this on a FAT file system, make sure it's on ext2/ext3 etc).

Also you need to make sure you have your GLIBC headers installed (on RH this would be the glibc-devel and possibly glibc-kernheaders, among other development tools).

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum »

thanks for looking into it for me.
two things:
1) slack doesn't come with kernel sources, but i know that if you just download and untar the kernel sources, they can be compiled with no problems, does this mean that those kernel headers and devel libs are present on my system?
2) the filesystem is ext2 however i am thinking that there must be something wrong with the way i am mounting it or something because of the permission errors and what have you.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

Calum wrote:thanks for looking into it for me.
two things:
1) slack doesn't come with kernel sources, but i know that if you just download and untar the kernel sources, they can be compiled with no problems, does this mean that those kernel headers and devel libs are present on my system?
2) the filesystem is ext2 however i am thinking that there must be something wrong with the way i am mounting it or something because of the permission errors and what have you.
1) Does what mean that they are installed? I can tell you they aren't installed unless you installed them. I had to help m0r find the package with the GLIBC headers. If you go to the Slackware download site there is a file called "MANIFEST". This file contains a list of all of the slackware packages and what is in them. You need to search it for the one that contains the GLIBC headers and then download/install it. It would be part of the development packages (I don't remember Slackwares names for these off the top of my head).

2) possible but if it's ext2 then I doubt you have it mounted wrong if you are using it for your system partition.

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum »

1) oh. i haven't done that, i haven't downloaded anything from slackware.com except a few X apps, so if it's not on the slack CD then i don't have it. this may be a problem.

2) i've not been using that partition as a system partition, the system partition is /dev/hda7 and it is ext3, the partition i am working on is /dev/hda6 and it is ext2, made using slackware's mke2fs, could this be a problem? probably not, since it wsounds like the above problem is the real problem...

Post Reply