Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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)

bin=""
while read LINE; do
    echo ${LINE}    # do something with it here
    bin="${bin}${LINE}\n"
done

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

share|improve this question
    
You need more quotes. –  jordanm Jan 28 '13 at 4:18
    
How so? Where do I add them? –  Raekye Jan 28 '13 at 6:03

3 Answers 3

"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?

share|improve this answer
    
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'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.

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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