Text file busy (ETXTBSY) when replacing or running a binary
You tried to overwrite an executable that is currently running, or run one that is still open for writing.
Text file busycp: cannot create regular file: Text file busy Meaning
Linux won’t let a running program’s file be modified in place. Deploy scripts that cp over a running binary, or scripts executed right after being written (still open), hit ETXTBSY.
Common causes
- Overwriting a running binary with cp
- Executing a file another process still has open for writing
- Copying a script and running it immediately in parallel
⚡ Quick fix
- Write to a temp file and mv it into place (atomic rename)
- Stop the process before replacing
- Wait for the writer to close the file
Detailed fix by platform
Linux
- bash
cp app.new /usr/local/bin/app.tmp && mv /usr/local/bin/app.tmp /usr/local/bin/app sudo systemctl restart app
How to diagnose
- Users — fuser -v /usr/local/bin/app
- Deploy — cp or mv?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Linux
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 13 Oct 2026