Bad interpreter

^^^^

Guy (Decoux) already asked you, but it seems you didn’t read
that, so I’ll insist: what do you have in /usr/bin/ruby? With that size
it must be a script; check it as it is probably broken… Where is your
real ruby binary?

···

On Sun, Jan 12, 2003 at 02:41:49AM +0900, Arnaudo Massimo wrote:

masarn1@gull:~/Ruby$ ./test.rb 2> error.log
masarn1@gull:~/Ruby$ cat error.log
bash: ./test.rb: /usr/local/bin/ruby: bad interpreter: Permission denied
masarn1@gull:~/Ruby$

Maybe ruby is not in /usr/local/bin. Or it is not in your
PATH environment var, so #!/usr/bin/env ruby failed

Thinks to check:
$ whereis ruby - will give you full path to ruby

masarn1@gull:~/Ruby$ which ruby
/usr/local/bin/ruby
masarn1@gull:~/Ruby$ ls -l /usr/local/bin/ruby
masarn1@gull:~/Ruby$ ls -l /usr/local/bin/ruby
lrwxrwxrwx 1 root root 13 dic 24 19:45 /usr/local/bin/ruby → /usr/bin/ruby
masarn1@gull:~/Ruby$ ls -l /usr/bin/ruby
-rwxr-xr-x 1 root root 3136 mar 20 2002 /usr/bin/ruby

_ _

__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

panic(“Foooooooood fight!”);
– In the kernel source aha1542.c, after detecting a bad segment list

bash: ./test.rb: /usr/local/bin/ruby: bad interpreter: Permission denied

Other two questions:

  1. What are the permitions on test.tb? 755 (do you have +x for the current user)
  2. What are the permitions of current partition? - see if you have in /etc/fstab
    something like: … ,noexec for the partition with test.rb

On my perfectly functioning system:

marvin:~$ ls -l /usr/bin/ruby
-rwxr-xr-x 1 root root 3116 Oct 21 01:42 /usr/bin/ruby

Tim Bates

···

On Sun, 12 Jan 2003 07:14 pm, Mauricio Fernández wrote:

-rwxr-xr-x 1 root root 3136 mar 20 2002 /usr/bin/ruby

  			^^^^

Guy (Decoux) already asked you, but it seems you didn’t read
that, so I’ll insist: what do you have in /usr/bin/ruby? With that size
it must be a script; check it as it is probably broken… Where is your
real ruby binary?


tim@bates.id.au

#!/usr/local/bin/ruby

puts “Hello, World”

masarn1@gull:~/Ruby$

I think it is all right. I can not understand why i have this problem

What happens when you call /usr/local/bin/ruby straight from the command
line?

:.! /usr/local/bin/ruby Ruby/test3.rb

Hello, World

It works.

Now i have a doubt: is it a problem of my deb package’s version?

Package: ruby
Versions:
1.6.7-3(/var/lib/apt/lists/Debian%20GNU_Linux%203.0%20r0%20%5fWoody%5f%20-%20Official%20i386%20Binary-2%20(20020718)_dists_unstable_main_binary-i386_Packages)(/var/lib/dpkg/status)

Reverse Depends:
libdebconf-client-ruby,ruby
libsufary-ruby,ruby 1.7
libsufary-ruby,ruby 1.6
erb,ruby 1.6.2
libmysql-ruby,ruby 1.6
debpartial,ruby
drb,ruby 1.6.0
libnet-irc-ruby,ruby 1.7.0-0
libnet-irc-ruby,ruby 1.6.0
rubybook,ruby
ruby-elisp,ruby 1.6.7-3
ruby-examples,ruby 1.6.7-3
ruby-manual,ruby
pdumpfs,ruby 1.6
webrick,ruby 1.6.5
ri,ruby 1.6.2
libromkan-ruby,ruby 1.7
libromkan-ruby,ruby 1.6
libbsearch-ruby,ruby 1.7
libbsearch-ruby,ruby 1.6
migemo,ruby 1.7
migemo,ruby 1.6
elserv,ruby
dpkg-ruby,ruby 1.7
dpkg-ruby,ruby 1.6
mhc-utils,ruby 1.7
mhc-utils,ruby 1.6
racc,ruby 1.7.0-0
racc,ruby 1.6.2-5
rdtool,ruby 1.6.2-5
rubyunit,ruby 1.6.0
docdiff,ruby
ruby-dev,ruby 1.6.7-3
irb,ruby 1.6.7-3
Dependencies:
1.6.7-3 - libc6 (2 2.2.4-4) libruby (2 1.6.7-3) ruby-examples (0 (null)) irb (0 (null))
Provides:
1.6.7-3 -
Reverse Provides:

Ciao
Massimo

···

On Sun, 12 Jan 2003 02:41:49 +0900 > Arnaudo Massimo marnaudo@inwind.it wrote:

E impari che puoi davvero sopportare,
che sei davvero forte,
e che vali davvero.


HomePage: http://spazioinwind.iol.it/arnaudo
LinuxGroup: http://www.lugge.net

masarn1@gull:~/Ruby$ ls -l /usr/bin/ruby
-rwxr-xr-x 1 root root 3136 mar 20 2002 /usr/bin/ruby
^^^^

Guy (Decoux) already asked you, but it seems you didn’t read
that, so I’ll insist: what do you have in /usr/bin/ruby? With that size
it must be a script; check it as it is probably broken… Where is your
real ruby binary?

I, now, understand your answer.
I have find all the possibility for the pattern ruby, but nothing is
interesting:
gull:/usr/bin# find / -name ruby
/usr/bin/ruby
/usr/share/doc/ruby
/usr/doc/ruby
/usr/lib/ruby
/usr/lib/cgi-bin/ruby
/usr/local/bin/ruby ->> the link to /usr/bin/ruby
/home/masarn1/Documentazione/Ruby/num17/ruby
/home/masarn1/Postgres/Archivio_soci/prova/ruby
gull:/usr/bin#

It is interesting that my ruby have a dimension, and yours another one:
it is a bug of my deb ruby file? I have reinstalled it yet.

Ciao
Massimo

···


E impari che puoi davvero sopportare,
che sei davvero forte,
e che vali davvero.


HomePage: http://spazioinwind.iol.it/arnaudo
LinuxGroup: http://www.lugge.net

bash: ./test.rb: /usr/local/bin/ruby: bad interpreter: Permission denied

Other two questions:

  1. What are the permitions on test.tb? 755 (do you have +x for the current user)

-rwxr-xr-x 1 masarn1 masarn1 45 gen 10 22:30 /home/masarn1/Ruby/test3.rb

  1. What are the permitions of current partition? - see if you have in /etc/fstab
    something like: … ,noexec for the partition with test.rb

/dev/hda10 / ext3 errors=remount-ro 0 1
/dev/hda9 /home reiserfs user 0 0

grazie
Massimo

···


E impari che puoi davvero sopportare,
che sei davvero forte,
e che vali davvero.


HomePage: http://spazioinwind.iol.it/arnaudo
LinuxGroup: http://www.lugge.net

Aaaaawww!

batsman@kodos:~/src/ruby-1.6.6/debian$ ls -l /usr/bin/ruby
-rwxr-xr-x 1 root root 3136 jun 12 2002 /usr/bin/ruby

I’ve been looking at the package’s sources but cannot see where this
tiny exec. comes from…

This gets more and more mysterious.
Especially since we’re all using Debian apparently.

···

On Sun, Jan 12, 2003 at 05:47:58PM +0900, Tim Bates wrote:

On Sun, 12 Jan 2003 07:14 pm, Mauricio Fernández wrote:

-rwxr-xr-x 1 root root 3136 mar 20 2002 /usr/bin/ruby

  			^^^^

Guy (Decoux) already asked you, but it seems you didn’t read
that, so I’ll insist: what do you have in /usr/bin/ruby? With that size
it must be a script; check it as it is probably broken… Where is your
real ruby binary?

On my perfectly functioning system:

marvin:~$ ls -l /usr/bin/ruby
-rwxr-xr-x 1 root root 3116 Oct 21 01:42 /usr/bin/ruby


_ _

__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

“You, sir, are nothing but a pathetically lame salesdroid!
I fart in your general direction!”
– Randseed on #Linux

I have seen this before from bash. I have just dowloaded the
bash-2.05b sources and in execute_cmd.c there is the chunk below.
I don’t know enough to figure out why execve() should fail, but…
Hugh

#define READ_SAMPLE_BUF(file, buf, len)
do
{
fd = open(file, O_RDONLY);
if (fd >= 0)
{
len = read (fd, buf, 80);
close (fd);
}
else
len = -1;
}
while (0)

/* Call execve (), handling interpreting shell scripts, and handling
exec failures. */
int
shell_execve (command, args, env)
char *command;
char **args, **env;
{
struct stat finfo;
int larray, i, fd;
char sample[80];
int sample_len;

SETOSTYPE (0); /* Some systems use for USG/POSIX semantics /
execve (command, args, env);
i = errno; /
error from execve() */
SETOSTYPE (1);

/* If we get to this point, then start checking out the file.
Maybe it is something we can hack ourselves. /
if (i != ENOEXEC)
{
if ((stat (command, &finfo) == 0) && (S_ISDIR (finfo.st_mode)))
internal_error (“%s: is a directory”, command);
else if (executable_file (command) == 0)
{
errno = i;
file_error (command);
}
else
{
/
The file has the execute bits set, but the kernel refuses to
run it for some reason. See why. */
#if defined (HAVE_HASH_BANG_EXEC)
READ_SAMPLE_BUF (command, sample, sample_len);
if (sample_len > 2 && sample[0] == ‘#’ && sample[1] == ‘!’)
{
char *interp;

      interp = getinterp (sample, sample_len, (int *)NULL);
      errno = i;
      sys_error ("%s: %s: bad interpreter", command, interp ? interp : "");
      FREE (interp);
      return (EX_NOEXEC);
    }

#endif
errno = i;
file_error (command);
}
return ((i == ENOENT) ? EX_NOTFOUND : EX_NOEXEC); /* XXX Posix.2 says that exit status is 126 */
}

···

On Wed, 15 Jan 2003, Arnaudo Massimo wrote:

bash: ./test.rb: /usr/local/bin/ruby: bad interpreter: Permission denied

Arnaudo Massimo marnaudo@inwind.it wrote in message news:20030114214704.GB6380@gull.zena.it

bash: ./test.rb: /usr/local/bin/ruby: bad interpreter: Permission denied

Somebody already suggested this, but I didn’t see a reaction:
what does ‘od -c test.rb’ show ?

It must be a line terminating issue.

Cheers,

Han Holl

Must be this!!!

man mount
[…]

          user   Allow an ordinary user to mount  the  file  system. The
                 name  of  the mounting user is written to mtab so that he
                 can unmount the file system again.  This  option implies
                 the  options noexec, nosuid, and nodev (unless overridden
                 by  subsequent   options,   as   in   the   option line
                 user,exec,dev,suid).

[…]

change the second line to
/dev/hda9 /home/ reiserfs user,exec 0 0

or better yet to
/dev/hda9 /home reiserfs defaults 0 0

As you normally won’t need to (un)mount your home partition manually w/
a normal user.

···

On Wed, Jan 15, 2003 at 06:49:21AM +0900, Arnaudo Massimo wrote:

bash: ./test.rb: /usr/local/bin/ruby: bad interpreter: Permission denied

Other two questions:

  1. What are the permitions on test.tb? 755 (do you have +x for the current user)

-rwxr-xr-x 1 masarn1 masarn1 45 gen 10 22:30 /home/masarn1/Ruby/test3.rb

  1. What are the permitions of current partition? - see if you have in /etc/fstab
    something like: … ,noexec for the partition with test.rb

/dev/hda10 / ext3 errors=remount-ro 0 1
/dev/hda9 /home reiserfs user 0 0


_ _

__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

Turn right here. No! NO! The OTHER right!

/dev/hda10 / ext3 errors=remount-ro 0 1
/dev/hda9 /home reiserfs user 0 0

Must be this!!!

Bingo! Now it works!
The problem was in fstab.

thanks everibody tried to help me!

Ciao
Massimo

···


E impari che puoi davvero sopportare,
che sei davvero forte,
e che vali davvero.


HomePage: http://spazioinwind.iol.it/arnaudo
LinuxGroup: http://www.lugge.net