Debian – bad interpreter: Text file busy

500cgidebianperlvi

For ages I've gotten used to editing Perl CGI scripts in "vi" and simultaneously having a browser open to test them. Lately, I've been getting "500" server errors when I do that, and when I run the script from the shell, I get "bad interpreter: Text file busy". The only solution is to exit "vi" whenever I want to test the script, which is a royal pain and should be totally unnecessary. What's up with that? I'm running a Debian server, which I keep updated regularly, and I'm assuming it started with some so-called "upgrade" 🙂

Best Answer

You appear to be having this issue, which is because at some point nvi started opening files O_RDWR instead of O_RDONLY.

If your vi is in fact nvi, I'd try using a different vi, say vim.