Text file busy Linux Origin: Platform & cloud Last updated 13 Oct 2026

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.

Exact message you may see Text file busycp: cannot create regular file: Text file busy
Seen on: Linux

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

  1. Write to a temp file and mv it into place (atomic rename)
  2. Stop the process before replacing
  3. Wait for the writer to close the file

Detailed fix by platform

Linux

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

  1. Users — fuser -v /usr/local/bin/app
  2. 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:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

0x80070020 — 0x80070020: The process cannot access the file because it is being used by another process (Windows)0x80070020Argument list too long — bash: /bin/rm: Argument list too long (Linux)Argument list too longCannot allocate memory — fork: Cannot allocate memory / ENOMEM (Linux)Cannot allocate memorycannot execute binary file — cannot execute binary file: Exec format error (Linux)cannot execute binary…command not found — bash: command not found (Linux)command not founderror while loading shared libraries — error while loading shared libraries: libX.so.N: cannot open shared object file: No such file or directory (Linux)error while loading s…GLIBC_2.xx not found — /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (Linux)GLIBC_2.xx not foundMSB3027 — error MSB3027: Could not copy "obj\...\App.dll" to "bin\...\App.dll". Exceeded retry count of 10. The file is locked by: "App (1234)" (.NET)MSB3027Text file…

Explore the map of this error Full error map →

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