Bug 155104 - "bad interpreter" error running script
"bad interpreter" error running script
Product: Fedora
Classification: Fedora
Component: bash (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Ben Levenson
Depends On:
  Show dependency treegraph
Reported: 2005-04-16 06:32 EDT by Ricardo Fernández Pascual
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-04-25 07:59:16 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Ricardo Fernández Pascual 2005-04-16 06:32:49 EDT
Description of problem:

When trying to execute any shell script, it fails with "bad interpreter" error:
[ricardo@hal musica]$ ./listas.sh
bash: ./listas.sh: /bin/sh: bad interpreter: Permission denied

However, if i copy the very same script to another directory (like /tmp or ~/),
it works! 

The only difference that occurs to me between the two dirrectories is that the
one which fails is on an external usb harddrive.

Version-Release number of selected component (if applicable):
[ricardo@hal musica]$ rpm -q bash kernel

How reproducible:
Comment 1 Tim Waugh 2005-04-17 07:27:23 EDT
What does 'mount' say?
Comment 2 Ricardo Fernández Pascual 2005-04-22 15:06:29 EDT
It says:

[ricardo@hal ~]$ mount
/dev/hda3 on / type ext3 (rw)
none on /proc type proc (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/hda1 on /boot type ext3 (rw)
/dev/hda4 on /mnt/aux5 type ext3 (rw)
none on /dev/shm type tmpfs (rw)
/dev/hdc1 on /mnt/aux8 type ext3 (rw)
/dev/sda1 on /mnt/ext1 type ext3 (rw,noexec,nosuid,nodev)
/dev/sda2 on /mnt/ext2 type vfat (rw,noexec,nosuid,nodev,dmask=000,fmask=111)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
[ricardo@hal ~]$

Now I see it says "noexec" as an option. But why? In /etc/fstab I don't have it:

/dev/sda1               /mnt/ext1               auto    user,defaults      0 0

If I add "exec" after defaults, it works. So now I'm not sure if this is a bug
or the intended behavior, but if it is intended, it is very confusing (why
should this act this way?).

Also, the error message is really wrong and misleading.

Thank you for looking at this.
Comment 3 Tim Waugh 2005-04-25 07:59:16 EDT
The error message is entirely correct: you don't have permission to execute the
interpreted script.

External storage is intended to be mounted noexec.

Note You need to log in before you can comment on or make changes to this bug.