Bug 155104

Summary: "bad interpreter" error running script
Product: [Fedora] Fedora Reporter: Ricardo Fernández Pascual <ricardof>
Component: bashAssignee: Tim Waugh <twaugh>
Status: CLOSED NOTABUG QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 3   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-04-25 11:59:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ricardo Fernández Pascual 2005-04-16 10:32:49 UTC
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
bash-3.0-17
kernel-2.6.11-1.14_FC3

How reproducible:
Always.

Comment 1 Tim Waugh 2005-04-17 11:27:23 UTC
What does 'mount' say?

Comment 2 Ricardo Fernández Pascual 2005-04-22 19:06:29 UTC
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 11:59:16 UTC
The error message is entirely correct: you don't have permission to execute the
interpreted script.

External storage is intended to be mounted noexec.