/usr/bin/perl:糟糕的解释器:文本文件繁忙。

时间:2022-03-02 23:55:28

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-intensive processes running at the time, but I've never seen that message before—in fact, this is the first time that I can remember getting an error when trying to run a Perl script. After a few seconds of waiting, I was able to run it, and haven't seen the issue since, but it would be nice to have an explanation for this.

当时有几个磁盘密集型进程,但我从来没有见过这样的消息——实际上,这是我第一次在尝试运行Perl脚本时遇到错误。等了几秒钟之后,我就能运行它了,从那以后我就再也没见过这个问题了,但是如果能对此做出解释就好了。

Running Ubuntu 9.04, file system is ext3.

运行Ubuntu 9.04,文件系统是ext3。

5 个解决方案

#1


18  

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.

Linux内核将生成一个糟糕的解释器:如果您的Perl脚本(或任何其他类型的脚本)在尝试执行它时,它将会被打开以供编写。

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)?

你不会说什么是磁盘密集型的过程。是否有可能其中一个脚本打开了读+写访问(即使它实际上并没有写任何东西)?

#2


3  

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(列表打开文件命令):

# 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:

用它的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

#3


2  

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...

如果你使用gnu并行,你会看到这个错误,那可能是因为你正在把文件从你正在写文件的地方传送出去……

#4


1  

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.

这总是与perl解释器(/usr/bin/perl)无法访问有关。事实上,当一个shell脚本正在运行或awk或其他的时候,它就会发生。在脚本的顶部行。

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

原因可能很多……perms,锁定文件,文件系统离线,等等。

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.

这显然要取决于你在问题发生时运行它的确切时间。但我希望答案是你想要的。

#5


0  

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.

如果脚本是在Windows中编辑的,或者任何其他具有不同“原生”行结尾的操作系统,那么它可能就像CR(M)一样简单“隐藏”在第一行的末尾。Vi改进可以设置为隐藏非本机的行尾。在我的例子中,我只是简单地重新键入了VI中的违规第一行,错误就消失了。

#1


18  

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.

Linux内核将生成一个糟糕的解释器:如果您的Perl脚本(或任何其他类型的脚本)在尝试执行它时,它将会被打开以供编写。

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)?

你不会说什么是磁盘密集型的过程。是否有可能其中一个脚本打开了读+写访问(即使它实际上并没有写任何东西)?

#2


3  

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(列表打开文件命令):

# 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:

用它的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

#3


2  

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...

如果你使用gnu并行,你会看到这个错误,那可能是因为你正在把文件从你正在写文件的地方传送出去……

#4


1  

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.

这总是与perl解释器(/usr/bin/perl)无法访问有关。事实上,当一个shell脚本正在运行或awk或其他的时候,它就会发生。在脚本的顶部行。

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

原因可能很多……perms,锁定文件,文件系统离线,等等。

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.

这显然要取决于你在问题发生时运行它的确切时间。但我希望答案是你想要的。

#5


0  

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.

如果脚本是在Windows中编辑的,或者任何其他具有不同“原生”行结尾的操作系统,那么它可能就像CR(M)一样简单“隐藏”在第一行的末尾。Vi改进可以设置为隐藏非本机的行尾。在我的例子中,我只是简单地重新键入了VI中的违规第一行,错误就消失了。