I have a text file that I can change using other applications (for example openoffice). But when I try to change and save it using gedit, I am getting error from gedit:

Could not save the file /media/sf_Ubuntu/BuildNotes.txt.
Unexpected error: Error renaming temporary file: Text file busy

the permission of BuildNotes.txt is as follow:

-rwxrwx--- 1 root vboxsf  839 2012-10-26 12:08 BuildNotes.txt

and user id is:

m@m-Linux:/media/sf_Ubuntu$ id
uid=1000(m) gid=1000(m) groups=4(adm),20(dialout),24(cdrom),46(plugdev),105(lpadmin),119(admin),122(sambashare),1000(m),1001(vboxsf)

What is the problem and how I can fix it?

  • and vim works fine...
    – Leon
    Commented Sep 27, 2019 at 3:15
  • nano is also working fine for me. Commented Mar 30, 2021 at 13:09
  • 1
    In 2021 this error still occurs, even with Geany. No problem with joe. It only happens with Win10 host. With a Debian host everything works fine.
    – ngong
    Commented Aug 18, 2021 at 11:14
  • True 2023, Oct. Commented Oct 24, 2023 at 8:25

6 Answers 6


This problem has been reported since 2009 (example [archived]). It is awful that there's no fix for it yet. Neither VirtualBox nor Gedit developers are willing to take responsibility for it, and instead are content to point fingers at one another for over three years.

You can set your editor preferences to 'Create a backup' then save twice. Incredibly painful, but it works.

Some other editors won't report the problem. However, when I tested Kate and nano, for example, those just silently deleted the file on every other save. That's even worse than the gedit situation...


“Text file busy” can be confusing here: it isn't actually about text files, but about executables. Executables are called text files because… hum, actually, I don't know why.

What the message really means is “this file is locked by another program that is using it and can't let it be modified under its nose, so you can't write to it.” It is quite unusual to see this message for a text file: unix systems generally frown on mandatory locks on files, and there is no facility for applications to lock out others from modifying a file. (Unix has advisory locks: they can be used to synchronize concurrent accesses to a file by cooperating programs.) The most common circumstance when you'll see “text file busy” (ETXTBUSY) is if you try to modify an executable that's running: the kernel locks it. Another possibility is a disk image that is mounted, again locked by the kernel.

In your case, given the location of the file /media/sf_Ubuntu and the ownership to the group vboxsf, my guess is that the file, which is on a VirtualBox file sharing filesystem, is locked in the host operating system. Presumably the host is a Windows machine and you also have the file open in an editor there. You'll need to close the file on the host before you can save in the editor in the VM.

  • 7
    thanks. I am %100 sure that the file is not oprn in windows and also no other application is using it. I can open it using OpenOffice and hence I am sure that it is not opened by other applications. It is only gedit that can not save it.
    – user654019
    Commented Oct 28, 2012 at 13:59
  • 2
    I am having the same issue. every program in guest os works great but gedit, something is up.
    – GlassGhost
    Commented Apr 22, 2013 at 23:44
  • Fails in mousepad (2023) too. Not gedit specific. Commented Oct 24, 2023 at 8:30

The problem is fundamentally with glib and the way it saves to a temporary file, then renames. The bug has been recorded as: https://gitlab.gnome.org/GNOME/glib/-/issues/438


What fixed it for me (still a bit annoying but works), and is applicable to gedit, is to:

edit - preferences - editor Put a check on "Create backup copy"

When saving from now on, save the file once, ignore the error, save again. works every time.

  • 1
    In 2019, this error still occurs. This workaround works.
    – David
    Commented Apr 11, 2019 at 13:28

Check with lsof if the file is open by another application

lsof /media/sf_Ubuntu/BuildNotes.txt

Or use fuser:

fuser -km /media/sf_Ubuntu/BuildNotes.txt
  • No. I've seen it myself. Open a new file, save it to the shared folder, works. Make a minor change, save again - Error. Commented Oct 24, 2023 at 8:29

using linux terminal, try editing the file using vi file_name and save it. p.s I could not find another solution for this issue. vi worked

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .