/usr/bin/perl:错误的解释器:文本文件忙

发布于 2024-08-04 03:58:37 字数 255 浏览 7 评论 0原文

这对我来说是一个新问题:这个错误表明什么?

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

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

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

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.

Running Ubuntu 9.04, file system is ext3.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

↘紸啶 2024-08-11 03:58:37

我猜你遇到了

当您尝试执行 Perl 脚本(或任何其他类型的脚本)时,如果您的 Perl 脚本(或任何其他类型的脚本)处于打开状态以供写入,Linux 内核将生成一个 bad Interpreter: Text file busy 错误。

您没有说明磁盘密集型进程在做什么。其中之一是否有可能打开脚本进行读+写访问(即使它实际上没有写任何内容)?

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

看透却不说透 2024-08-11 03:58:37

发生这种情况是因为脚本文件已打开以供写入,可能是由尚未终止的恶意进程造成的。

解决方案:检查哪个进程仍在访问该文件,然后终止它。

例如:

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

在脚本名称上运行 lsof(列出打开的文件命令):

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

通过 PID 杀死进程:

kill -9 4416

现在尝试再次运行该脚本。现在可以了。

# /root/wordpress_plugin_updater/updater.pl --wp-path=/www/htdocs
Wordpress Plugin Updater script v3.0.1.0.
Processing 24 plugins from

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
纸伞微斜 2024-08-11 03:58:37

如果脚本是在 Windows 或任何其他具有不同“本机”行结尾的操作系统中编辑的,则它可能就像在第一行末尾“隐藏”CR(^M) 一样简单。 Vi 改进可以设置隐藏这个非本地行结尾。就我而言,我只需在 VI 中重新输入有问题的第一行,错误就消失了。

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.

洋洋洒洒 2024-08-11 03:58:37

这始终与 perl 解释器 (/usr/bin/perl) 无法访问有关。事实上,当 shell 脚本或 awk 或 #! 上的任何内容运行时,就会发生这种情况。脚本顶部的行。

原因可能有很多……权限、锁定文件、文件系统脱机等等。

这显然取决于问题发生时您运行它时发生的情况。但我希望答案就是您所寻找的。

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.

烟沫凡尘 2024-08-11 03:58:37

如果您使用的是 gnu parallel 并且看到此错误,则可能是因为您从写入文件的同一位置流式传输文件...

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

诗化ㄋ丶相逢 2024-08-11 03:58:37

我遇到了同样的问题,并且 grep 来查看正在使用该文件的内容不起作用。事实证明我只需要重新启动 Droplet,Viola 脚本现在就可以工作了。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文