I'm getting the

Cannot save _____ Unexpected error: Error renaming temporary file: Text file busy

in Gedit 2 when I try to save in a shared folder with Virtualbox (Debian). I've searched and apparently it's a Gedit problem. None of the solutions seem ideal or work for me.

Would it be possible to create a shell script (external tools plugin) that saves the file somewhere else, then copies it back in shell? So I'll need to grab wherever Gedit's stored the temporary (live?) file.

Or if this is not possible/won't work/bad practice, does anyone know a good way to get around this? I really like Gedit and prefer to use it.

Currently, this is my script. I tell external tools not to save but pass the document as input (stdin)

while read LINE; do
    echo ${LINE}    # do something with it here

echo $bin > /home/me/data2/test.txt

It works fine except it doesn't preserve tabs. I'my only editing plain text files. Edit: this also seems to skip the last line


I'm currently getting this problem with both gedit and geany, on latest mint-lmde and fedora virtualbox vms on windows 7 host. However Kate, kwrite, gvim/vim, Qtcreator, libre writer are not affected. Geany and gedit both give Error renaming temporary file: text file busy. I'm using virtual box 4.2.16. Searching round on the internet, similar problems seem to have been around for years.

I've found a solution for geany.

with geany 1.23.1 on fedora and 1.22 on mint-lmde

Edit->Preferences->Various tick use_atomic_file_saving

this is supposed to be safer according to the manual. or you can untick use_gio_unsafe_file_saving. Either works, the explanations are in the manual.

For gedit not really.

With gedit 3.4.2 on mint-lmde only found a one shot workaround.

Edit->Preferences->Editor untick Create a backup copy

This works once, thereafter on a second save it doesn’t, unless you start messing about ticking, saving, unticking, saving and it will work once again. Looks like a bug. With gedit 3.8.3 on fedora the tick untick can be done but the original file disappears and only a backup is left, without any changes.


"Text file busy" means that the kernel refuses to move/rename/delete an executable file that is running as a program. What are you trying to save?

  • No... this is an issue with gedit and virtualbox. Google it - it's something to do with the way gedit saves temporary files and renames it when saving. – Raekye Jan 30 '13 at 2:25

I think the problem is fundamentally with glib and the way it saves to a temporary file, then renames without closing the file. The bug has been recorded as: https://bugzilla.gnome.org/show_bug.cgi?id=656225


I recognize this is an old thread, but as I found it while searching for a solution for exactly this problem, I figured I would post my workaround, perhaps it may help others.

In my case the shared folder was on a NAS in my LAN, and besides the problems with geany the performance was really bad. My solution was to define a bridged network adapter in the Virtualbox Manager/Settings/Network for my VM. Then the VM got access to my LAN in the same way as an ordinary computer. Instead of using the Shared Folders in Virtualbox I could mount the folder as an ordinary network share, defined in /etc/fstab. Thus I did not have any folders defined in Virtualbox Manager/Settings/Shared folders. The geany problems went away, and the performance was greatly improved.

Not the answer you're looking for? Browse other questions tagged or ask your own question.