that problem just drives me crazy. All my Python and Perl scripts are simply NOT iterpreted via shebang. Never. But they work as expected when I explicitly call the binary. I double checked my Perl and Python installations, it is just too strange: they shebang-way execution works very well in the target system chroot on a sane host but not in the actual running system. I'm desperate now!I work on a homemade Linux system which worked just great before that problem appeared. See by yourself: A test on the 'xscreensaver-text' Perl program, once via shebang then with the interpreter on the CLI:$ LC_ALL=C LANG=C /usr/bin/xscreensaver-text/usr/bin/xscreensaver-text: line 23: require: command not found/usr/bin/xscreensaver-text: line 25: use: command not found/usr/bin/xscreensaver-text: line 29: BEGIN: command not found/usr/bin/xscreensaver-text: line 31: use: command not found/usr/bin/xscreensaver-text: line 32: syntax error near unexpected token `('/usr/bin/xscreensaver-text: line 32: `use POSIX qw(strftime);'$ LC_ALL=C LANG=C perl /usr/bin/xscreensaver-textpoopyLinux 3.11.1Sat Oct  5 23:07:33 2013up 11:35,  2 usersload average: 0.09, 0.08, 0.06SO this for Perl programs but the same happens with Python scripts. We've been messing with encodings and terminfo's and different kernel, still no success. I've even rebuilt my entire system. It works just great in a chroot env, but once I boot it I have this problem.Here's an strace output:$ LC_ALL=C LANG=C strace /usr/bin/xscreensaver-textexecve(/usr/bin/xscreensaver-text, [/usr/bin/xscreensaver-text], [/* 50 vars */]) = -1 ENOEXEC (Exec format error)write(2, strace: exec: Exec format error\n, 32strace: exec: Exec format error) = 32exit_group(1)                           = ?+++ exited with 1 +++$ LC_ALL=C LANG=C strace perl /usr/bin/xscreensaver-textexecve(/usr/bin/perl, [perl, /usr/bin/xscreensaver-text], [/* 50 vars */]) = 0brk(0)                                  = 0x601000mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff12e312000access(/etc/ld.so.preload, R_OK)      = -1 ENOENT (No such file or directory)open(/etc/ld.so.cache, O_RDONLY|O_CLOEXEC) = 3fstat(3, {st_mode=S_IFREG|0644, st_size=240674, ...}) = 0mmap(NULL, 240674, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7ff12e2d7000close(3)                                = 0open(/usr/lib64/libc.so.6, O_RDONLY|O_CLOEXEC) = 3read(3, \177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \37\2\0\0\0\0\0..., 832) = 832fstat(3, {st_mode=S_IFREG|0755, st_size=1868472, ...}) = 0mmap(NULL, 3981888, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7ff12dd24000mprotect(0x7ff12dee6000, 2097152, PROT_NONE) = 0mmap(0x7ff12e0e6000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c2000) = 0x7ff12e0e6000mmap(0x7ff12e0ec000, 16960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7ff12e0ec000close(3)                                = 0mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff12e2d6000mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff12e2d4000arch_prctl(ARCH_SET_FS, 0x7ff12e2d4740) = 0mprotect(0x7ff12e0e6000, 16384, PROT_READ) = 0mprotect(0x7ff12e313000, 4096, PROT_READ) = 0munmap(0x7ff12e2d7000, 240674)          = 0brk(0)                                  = 0x601000brk(0x622000)                           = 0x622000clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff12e2d4a10) = 5680wait4(5680, poopyLinux 3.11.1Sat Oct  5 23:11:49 2013up 11:39,  2 usersload average: 0.08, 0.12, 0.08[{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 5680--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=5680, si_status=0, si_utime=2, si_stime=0} ---exit_group(0)                           = ?+++ exited with 0 +++Contents (only the beginning) of the script : $ cat /usr/bin/xscreensaver-text#!/usr/bin/perl -w# Copyright  2005-2013 Jamie Zawinski ### Created: 19-Mar-2005.require 5;#use diagnostics;   # Fails on some MacOS 10.5 systemsuse strict;# Some Linux systems don't install LWP by default!# Only error out if we're actually loading a URL instead of local data.BEGIN { eval 'use LWP::UserAgent;' }--*snip*--I will give any extra info needed (as this is my third headache week). Thanks!
Perl and Python wrongly interpreted via shebang on Linux
linux;bash;shebang;interpreter
Your kernel was compiled without CONFIG_BINFMT_SCRIPT=y.  This setting controls shebang support.From make menuconfig:Symbol: BINFMT_SCRIPT [=y]                                                Type  : tristate                                                       Prompt: Kernel support for scripts starting with #!                      Location:                                                            (1) -> Executable file formats / Emulations                              Defined at fs/Kconfig.binfmt:68                                   Reconfigure and recompile your kernel.  (Technically, it can also be built as a module, but there's no point in doing that for something as fundamental as #! support.)