views:

2298

answers:

9

Not exactly programming related...

I've built the program, some basic opengl, then run it and sh: /blabla permission denied. How can I make that dissaper?

the program just makes a rotating square and I have ubuntu 9.4

just found out that even int main(){} doesn't work

A: 

G'day,

Couple of questions:

  1. Are the permissions set correctly on the file?
  2. Is the path to any interpreter set correctly?
Rob Wells
I don't know about those things... it only happens on the new computerI had same compilaer same ubuntu and there it just runs
csiz
+1  A: 

How are you compiling it? Can you post the makefile? If you run

chmod +x myPorgram
./myProgram

something changes?

Paolo Tedesco
I'm compiling with codeblocks. And I tried that nothing, tried with sudo and still nothing.
csiz
A: 

Apart from the above mentioned chmod +x file, another problem might be a missing library. To check the required libraries, use ldd:

$ ldd /bin/sh
    linux-vdso.so.1 =>  (0x00007fffb43fe000)
    libc.so.6 => /lib/libc.so.6 (0x00007fc4abe11000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fc4ac183000)

If one of these lines shows a missing library, you'll know what needs to be installed before you can run your program.

Another possibility is if your program is a script (shell, perl, python or other text-based program). The first line looks like:

#!/usr/bin/perl

If that file cannot be found, you'll get a permission denied error.

Eric Darchis
not a dynamic executable hmmm but in the permission page the executable option is marked and also i did the chmod +x on it... Though I doubt there are extra libraries needed for int main(){}
csiz
"Not a dynamic executable" ?Can you show us how you are compiling your program ?Please also do a "file yourexefile", this should say something like $ file /bin/bash /bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, strippedRegarding the extra libraries, having just main(){} doesn't mean anything, if it was compiled with the opengl libs, they'll be required to run the program.
Eric Darchis
I'm hitting the build button in codeblocks... that worked on the other computer untill now, I also compiled without any libraries linked and it didn't run. The file test : test: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
csiz
A: 

Try executing the command with strace to trace the successful system calls it makes and where it stops.

This is how you might launch it,

strace ./blabla

Do you get a "permission denied" error or something like "exec format error"? With chmod +rx on the file you should not hit "permission denied".

nik
A: 

You should also make sure that your username is in the video group. Check the /etc/group and make sure that your username appears on the "video" line.

Eric
+1  A: 

Check the mountpoint to see if it's mounted as noexec by running "mount"

Paul Betts
A: 

You also get this problem when trying to execute 32-bit apps on a 64-bit system. Execute:

a. file (executable name) b. uname -a

and check that both are either "i386" or "amd64".

If they are not the same, have a look at this article:

http://www.markusbe.com/2009/09/about-running-32-bit-programs-on-64-bit-ubuntu-and-shared-libraries/#comment-279

Charl
+1  A: 

I had the same problem and it appeared that my partition was mounted as noexec cat /etc/mtab

When I configured options in /etc/fstab I wrote exec,user but it appears that "user" option by default sets up "noexec". When I changed the order of these two to user,exec everything went back to normal!

Hope it helps.

KermiDT
A: 

I use CodeBlocks on Ubuntu and have had this exact problem MANY times. what KermiDT said is exactly the solution (if i had enough rep points, i would have voted it up)
The "user" option by default sets up "noexec".
so in /etc/fstab just add ,exec after user. i.e. mine looks like this:
/dev/sda6 /media/DATA vfat uid=kenny,gid=kenny,users,user,exec 0 0
Though, the spacingis a bit off... but you get the idea.

KennyCason