/usr/bin/perl: bad interpreter: Text file busy

后端 未结 6 1456
挽巷
挽巷 2020-12-14 06:06

This is a new one for me: What does this error indicate?

  /usr/bin/perl: bad interpreter: Text file busy

There were a couple of disk-inte

相关标签:
6条回答
  • 2020-12-14 06:47

    If the script was edited in Windows, or any other OS with different "native" line endings, it could be as simple as a CR(^M) "hiding" at the end of the first line. Vi improved can be set up to hide this non native line ending. In my case I simply re-typed the offending first line in VI and the error went away.

    0 讨论(0)
  • 2020-12-14 06:52

    This always has to do with the perl interpreter (/usr/bin/perl) being inaccessible. In fact, it happens when a shell script is running or awk or whatever is on the #! line at the top of the script.

    The cause can be many things ... perms, locked file, filesystem offline, and on and on.

    It would obviously depend on what was happening at the exact moment you ran it when the problem occured. But I hope the answer is what you were looking for.

    0 讨论(0)
  • 2020-12-14 06:56

    I'd guess you encountered this issue.

    The Linux kernel will generate a bad interpreter: Text file busy error if your Perl script (or any other kind of script) is open for writing when you try to execute it.

    You don't say what the disk-intensive processes were doing. Is it possible one of them had the script open for read+write access (even if it wasn't actually writing anything)?

    0 讨论(0)
  • 2020-12-14 07:01

    I had this same issue and grepping to see what was using the file didnt work. turns out i just needed to restart the droplet and viola script now works.

    0 讨论(0)
  • 2020-12-14 07:06

    If you are using gnu parallel and you see this error then it may be because you are streaming a file in from the same place that you are writing the file out...

    0 讨论(0)
  • 2020-12-14 07:10

    This happens because the script file is open for writing, possibly by a rogue process which has not terminated.

    Solution: Check what process is still accessing the file, and terminate it.

    Eg:

    # /root/wordpress_plugin_updater/updater.pl --wp-path=/var/www/virtual/joel.co.in/drjoel.in/htdocs
    -bash: /root/wordpress_plugin_updater/updater.pl: /root/perl/bin/perl: bad interpreter: Text file busy
    

    Run lsof (list open files command) on the script name:

    # lsof | grep updater.pl
    sftp-serv 4416            root    3r      REG            144,103    11043   33046751 /root/wordpress_plugin_updater/updater.pl
    

    Kill the process by its PID:

    kill -9 4416
    

    Now try running the script again. It works now.

    # /root/wordpress_plugin_updater/updater.pl --wp-path=/www/htdocs
    Wordpress Plugin Updater script v3.0.1.0.
    Processing 24 plugins from
    
    0 讨论(0)
提交回复
热议问题