Shared folders incompatible with gedit

When mounting a shared folder in a Linux guest (Windows or Linux host), GEdit cannot save changes to any file. This happens regardless of the mount permissions; even files that can be saved with vim/kwrite/etc can't be saved with gedit. Files can be opened and read, but attempting to save results in the generic message "Could not save the file <filename>."

This problem is not new to the 2.X series; I remember bumping into it last year and thought it would be fixed. There are also a number of forum threads referring to this problem (e.g. http://forums.virtualbox.org/viewtopic.php?t=4437) with no resolution.

This makes using any Ubuntu guest a frustrating experience, as gedit is the default text editor.

Change History

I cannot reproduce this problem. How did you mount the shared folder to the guest, that is, which option? Note: mount.vboxsf will only allow root (the guest root of course) to mount a shared folder. But if root mounts a shared folder, it will be write-protected for other (guest) users. Use

although the problem persists regardless of what dmode/fmode combinations I try. In practice the mounted folder is readable/writable by my normal user account (id 1000), and everything works fine except Gedit can't save files. Again, kwrite/vim and other editors save files just fine; there seems to be some odd interaction with gedit.

I have the exact same problem. Using VirtualBox 2.10, Windows Vista SP1 host and Ubuntu 8.10 as guest. I can create new file using gedit on shared folder, but i can't rewrite the file. I can only write it to new file.. weird..

However, using other software I can rewrite files (vim, gvim, scribes) with no problem.

I just reproduced this trivially with VirtualBox 2.2.4, Windows XP SP3 host, Ubuntu 9.04 guest. The actual triggering error revealed by strace is that when gedit tries to rename the old file to the backup name it gets ETXTBSY:

I'm not actually sure this is a VirtualBox bug, since what's happening is the normal annoying Windows rule that one can't rename an open file is being applied.

This did suggest a workaround: in gedit's Edit/Preferences>Editor pane, uncheck the "create a backup copy of files before saving" option; however gedit implements this option by doing the rename anyway and then unlinking the backup copy, so it still fails the same way.

This is not a bug specific to virualbox shared folders. It happens when you use samba/nfs (and likely in other situations as well) to mount folders in linux. it just stems from the fact that not all underlying file systems implement identical interfaces.

I use this script which I call fedit to get around the issue. It creates a simlink under /tmp/ pointing to the file that i pass as an argument. This way the backup file is saved under tmp instead of under the mounted folder structure. It also prevents name collisions under the tmp folder by placing symlinks in a folder structure that mirrors the path of the file they point to.

ps I'm sure the script could stand to be refined, but you get the idea behind how it works.

I have the same problem here. I use win7 host, a NTFS file system shared with the guests, and several guests. In Linux my only problem is with gedit. So I can live with it. But in OpenSolaris the "ar" tool can not generate a library for the same problem. This cause me a lot of workaround.

I know that this is not a VirtualBox bug. But that's a problem that involves VirtualBox. Can you just close a file that it is opened before renaming it when the shared folder is windows based?

BTW I'm using VB 3.2.12 and OpenSolaris 2010.03, but this problem has been there for years and several other versions.