Find the answer to your Linux question:
Results 1 to 4 of 4
Hi Community, got message "cannot execute binary file" when trying to start a simple bash script. I know all linux forums good advices towards this theme. But these did not ...
  1. #1
    Just Joined!
    Join Date
    Sep 2005
    Posts
    6

    "cannot execute binary file" bash script

    Hi Community,

    got message "cannot execute binary file" when trying to start a simple bash script. I know all linux forums good advices towards this theme. But these did not help. To come to the point: I had edited and saved the script with OpenOfficeWriter. MousePad and Pico alias Nano did not show any text format problem. But my way of fixing the Bug proved: It must have been just that. I deleted the file and wrote it completely new using MousePad. That solved the Problem. Hope I can help someone with this posting.

    Best regards,

    hans1967

  2. #2
    Just Joined! vigour's Avatar
    Join Date
    Oct 2007
    Posts
    68
    Check the permitions of the file and whether you have the executable flag set. Also make sure you have:

    Code:
    #!/bin/bash
    at the beginnig

  3. #3
    Linux Engineer
    Join Date
    Nov 2004
    Location
    Ft. Polk, LA
    Posts
    796
    What could have happened is OpenOffice put a character which was undisplayable by your editors in the file, and because of that it was thought to be something that it wasn't. Things like that can sometimes get confusing.

  4. #4
    Just Joined!
    Join Date
    Nov 2010
    Posts
    1
    You will also experience this problem if you mounted your partition as noexec.

    fanus@schoonees:~$ ls -l toets.sh
    -rwxr-xr-x 1 fanus fanus 43 2011-01-21 17:28 toets.sh

    fanus@schoonees:~$ ./toets.sh
    bash: ./toets.sh: Permission denied

    fanus@schoonees:~$ mount | grep sda8
    /dev/sda8 on /home type ext3 (rw,noexec,nosuid,nodev)

    fanus@schoonees:~$ cat /etc/fstab | grep sda8
    /dev/sda8 /home ext3 user,rw 0 2

    Reason:
    noexec Do not allow direct execution of any binaries on the mounted
    filesystem. (Until recently it was possible to run binaries
    anyway using a command like /lib/ld*.so /mnt/binary. This trick
    fails since Linux 2.4.25 / 2.6.0.)


    Problem solved by remounting the partition with /etc/fstab:

    fanus@schoonees:~$ cat /etc/fstab | grep sda8
    /dev/sda8 /home ext3 users,exec,dev,suid 0 2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...