Text file busy

From Helpful
Jump to navigation Jump to search
This article/section is a stub — some half-sorted notes, not necessarily checked, not necessarily correct. Feel free to ignore, or tell me about it.

Cannot create regular file: Text file busy

During installation, compilation and such, you may see:

cannot create regular file filename: Text file busy


Most likely, the file you are attempting to replace is an executable, and it is currently being run. (You could check this with fuser or lsof)


Apparently this is cp being careful, figuring this may be a bad idea.

You can tell it that yes, you want to replace it, by using cp -f (force).


That won't have direct effect on the running process, because of OS and filesystem semantics: it mapped the old executable when starting, which will keep existing as a (now filenameless) inode until that file is closed (i.e. the process stops).


It could have indirect effects, e.g. if you replace its dynamically loaded dependencies.

It's up to your informed decision whether to force the copy, or not do the copy, kill the process, or whatnot.

bad interpreter: Text file busy

This article/section is a stub — some half-sorted notes, not necessarily checked, not necessarily correct. Feel free to ignore, or tell me about it.

Pretty much the same situation as above.

But often specifically when a script is currently being written to. That is, chances are it's a script you are trying to run, you have it open an editor, saved it, and switched to trying to run it so quickly it wasn't done saving yet.