You are not logged in.


Hi all,
I can not open files with gvim or vim if it is on a smb share in thunar, no problems with any other location or application.
I'm not completely sure if this is the right group to ask. If not, please accept my apologies.
The actual problem may be a bit more complicated that what is on the first line.
Let me first describe the situation.
- Two Synology NAS systems (different types), both with smb shares.
- Debian trixie + Xfce + Thunar + gvim.
In thunar I can look at the Network location and see both NAS systems.
In thunar, network location I can double click on a NAS system and see the individual shares.
In thunar I can click on a share which will open it in 'smb://<NAS>/<share>/' and I can see the content.
In thunar I can click on a (text) file and select gvim to open it.
Gvim opens but does not read the content of the file and does not show the file name in the top window bar.
(And I get the same behaviour for vim).
If the location is not a smb share but on the local file system gvim will open and load the file without problems.
If I try to open the text file on the smb share with 'Mousepad' is opens the file and reads the content.
Gvim is very dear to me, after more that 35 years of use of vi and variants. Use another editor? Which 'editor'...??
I am sure that in the past I have opened files in gvim this way without problems. (But my memory may play tricks on me.)
The circumstances under whit it is/was working are not known to me. Working with apt at the same time feels like 'related' somehow. Just vague memory shards.
Looking around and found some remarks about gvfs-smb but can't do much with it.
I checked the NAS drives and they are configured for SMB2 and SMB3. Normally my NAS drives are just working and I', not in the habbit of playing with the configurations.
Next hunch is: if 'Mousepad' can but 'gvim' cant what is in their .desktop files?
/usr/share/applications/gvim.desktop: 'Exec=gvim -f %F'
/usr/share/applications/org.xfce.mousepad.desktop: 'Exec=mousepad %U'
OK, changed gvim.desktop 'Exec=gvim -f %U'.
Open a file from a smb share with gvim. It still does not load the file but shows the correct file name in the top bar. Editing is possible but writing to file is not.
While editing and writing the same file with 'Mousepad' is not a problem.
What exactly is happening here?
If feels to me as a problem with the interaction between thunar and (g)vim but I can not pin-point what it is.
Any advise is welcome.
Last edited by papaathome (2026-05-24 20:36:33)
---
Kind regards, Andre.
Offline


This works for me on Arch Linux: Thunar 4.20.8, gvfs 1.60, gvim 9.2.
Do you have any content in your .vimrc file? Any error messages in your log files?
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline


Still puzzling.
Looked up details for .desktop files. See: this
Looked up details for gvim command line. See: this
gvim can open files on smb shares with the following command syntax:
`gvim smb://[username]@[host_ip]/[share_name]/[file_name]`
Changed in gvim.desktop:
Exec=gvim -V10/home/andre/verbose_vim.txt -f %U
-V... will create a verbose file with processing details.
-f will keep gvim on the foreground.
%U will expand to a list of URL's for opening.
prepared a file on `smb://ds923.local/lib/test.txt` containing one line of text "testing."
In thunar: open the file with gvim.
Gvim opens a window with in the title bar the filename `test.txt(smb://ds923.local/lib)`
There is no content in gvim (the one line of text is missing).
added one line of text `123451`
tried to safe the file without success.
snippet from `verbose_vim.txt`
...
Reading viminfo file "/home/andre/.viminfo" info oldfiles
"smb://ds923.local/lib/test.txt" [New DIRECTORY]
...
"smb://ds923.local/lib/test.txt"
"smb://ds923.local/lib/test.txt" E212: Can't open file for writingLooks to me more a gvim problem than a thunar problem. 
---
Kind regards, Andre.
Offline


Hi papaathome,
Perhaps this is an issue with the temporary files that vim uses and smb permissions?
This is the big difference between mousepad and vims I believe to remember.
What happens if:
- you open the file from the mount point in your filesystem (from the command prompt)?
- what happens if you change the desktop file to call vim with the "-R" (read only parameter), this way no tempfiles should be created.
- not sure if you can configure vi to change the directories it creates these files in, from the internet there seems to be..
From the internet I read that:
Vim creates several types of temporary files when opening a file, including swap files (with a .swp extension), backup files (with a ~ at the end), and undo files (with a .un~ extension). These files help manage changes and recover data in case of unexpected issues.
Offline


More...
The generic command for gvim and a smb share is:
gvim smb://[username]@[host_ip]/[share_name]/[file_name]
Also, thunar does not include a user name and is using the DNS name.
Worth a try in a console: (unfortunately all following tries do fail.)
$ gvim smb://andre@ds923.local/lib/test.txt
$ gvim smb://andre@ds923/lib/test.txt
$ gvim smb://andre@192.168.2.78/lib/test.txtI'm running out of options and idea's... 
---
Kind regards, Andre.
Offline


"smb://ds923.local/lib/test.txt" E212: Can't open file for writing
Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline


Hi papaathome,
Perhaps this is an issue with the temporary files that vim uses and smb permissions?
This is the big difference between mousepad and vims I believe to remember.What happens if:
- you open the file from the mount point in your filesystem (from the command prompt)?
- what happens if you change the desktop file to call vim with the "-R" (read only parameter), this way no tempfiles should be created.
- not sure if you can configure vi to change the directories it creates these files in, from the internet there seems to be..From the internet I read that:
Vim creates several types of temporary files when opening a file, including swap files (with a .swp extension), backup files (with a ~ at the end), and undo files (with a .un~ extension). These files help manage changes and recover data in case of unexpected issues.
Good idea!
Tried it on de command line.
$ gvim -R smb://andre@192.168.2.78/lib/test.txtOpens the file RO but... without content.
Most or the temporary files can be disabled or created in another location but I have to check the man pages for all the details because I don't use it so much.
Oh, and one more point (added later.)
In thunar I can open the smb share and I believe it jums to the local mount point, `smb://ds923.local/lib/` in this case.
(Please correct me if I'm wrong).
Normally I right-click in thunar to open a console there. But there is no option to open one. ???
That is not the way I remember!
Added later 1 h 10 min 34 s:
papaathome wrote:"smb://ds923.local/lib/test.txt" E212: Can't open file for writing
That url/issue is indicating problems when the permissions are not matching stating that (g)vim needs at least group permission.
I checked what the permissions are in my case with an ssh connection to ds923.
andre@DS923:/volume1$ ls -la
drwxrwxrwx+ 1 root root 28 May 24 17:09 lib
...
andre@DS923:/volume1$ ls -la lib
total 4
drwxrwxrwx+ 1 root root 28 May 24 17:09 .
drwxr-xr-x 1 root root 448 May 23 19:36 ..
-rwxrwxrwx+ 1 andre users 9 May 24 17:09 test.txt
...looks fine to me.
Added later 1 h 28 min 08 s:
papaathome wrote:"smb://ds923.local/lib/test.txt" E212: Can't open file for writing
That url/issue is indicating problems when the permissions are not matching stating that (g)vim needs at least group permission.
I checked what the permissions are in my case with an ssh connection to ds923.
andre@DS923:/volume1$ ls -la
drwxrwxrwx+ 1 root root 28 May 24 17:09 lib
...
andre@DS923:/volume1$ ls -la lib
total 4
drwxrwxrwx+ 1 root root 28 May 24 17:09 .
drwxr-xr-x 1 root root 448 May 23 19:36 ..
-rwxrwxrwx+ 1 andre users 9 May 24 17:09 test.txt
...looks fine to me.
This works for me on Arch Linux: Thunar 4.20.8, gvfs 1.60, gvim 9.2.
Do you have any content in your .vimrc file? Any error messages in your log files?
My ~/.vim/vimrc file is 175 lines long with a lot of little tweeks and modifications.
None related to saving, about 30% is related to `if has('win32')` and has grown over the years. ;-)
Most of the code has to do with screen layout, file encoding, file type recognition and syntax.
There are no vim error messages (except for the few I specially made with the verbose option).
To remove any doubt I will do some tests without loading my vimrc.
Does not take much of an effort.
Closed all gvim instances. Done the tests in two forms.
First: I don't use a vimrc with sudo, on purpose. Tested with my 'normal' vimrc active and using sudo.
andre@lucifer:~/Desktop$ sudo gvim smb://ds923.local/lib/test.txtfails, does not load content, can not write.
Second: renamed vimrc and checked that is was no longer loaded. OK.
andre@lucifer:~/Desktop$ gvim smb://ds923.local/lib/test.txtfails, does not load content, can not write.
This shows to me that vimrc is not the cause of the behaviour.
Oh, my gvim version, standard trixie version:
ndre@lucifer:~/Desktop$ gvim --version
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled May 23 2025 00:48:59)
Included patches: 1-948, 950-1230, 1242, 1244
Modified by team+vim@tracker.debian.org
Compiled by team+vim@tracker.debian.org
Huge version with GTK3 GUI.There is one more test that I did.
This weekend I created a new VM where up to now no contact was made with ds923, except for some git cloning.
This VM is standard trixie, same as the host (where I have all the problems with gvim).
Except for VisualBox extention tools, minimal develop support, gvim and thunderbird nothing is done with it yet.
From this VM I can:
- ping ds923 and get the expected IP number.
- run from a console: `andre@kantoor:~/Desktop$ gvim smb://192.168.2.78/lib/test.txt` which fails in the same way as on the host.
What else? It could be network configuration. That is not my strong point and find it hard to check.
Last edited by papaathome (2026-05-24 18:38:21)
---
Kind regards, Andre.
Offline


hhmm, no additional idea for me. Here just some additional thoughts:
If this is urgent for you and you can ssh into the server you can try to go with sshfs instead and see if that works.
This is a good website/tutorial for it, even howto add it to systemd.. :
https://www.digitalocean.com/community/ … s-over-ssh
====
if it is/where permissions you can still doublecheck how it has been mounted in the system with "mount" and you should see it there. Perhaps the command "getfacl test.txt" for your testfile will give you the effective permission you have on that file. But honestly I don't see why that would be an issue, as it is the same for every program, so vim should have the same permissions as everyone else.
===
The behaviour to "open" the file without content as you are describing has the same symptoms as having "r" read permission on the folder (to list the files) but not the "x" folder permission to enter the directory and use it (this is on the folder containting the file, not the file itself) . In this case x is needed to open the content. Again, not sure if this is relevant having seen your permissions from ssh.
===
Honestly the bug description just goes over my head
the only thing I got from it that restarting the gvfs deamon reastart may??? solve this? (but perhaps I mistunderstood). The command for that should be:
systemctl --user restart gvfs-daemon.service
But I didn't understand why this would help. 
Offline


OK, turns out to be a network problem after all.
Spend some time brouwsing and reading too many old stories but it did pay off.
One package was mentioned and I had it not installed, it is 'gvfs-fuse'.
After installing and a reboot I can open an smb share and then in thunar open a text file with gvim and it loads correctly.
I can also edit and write the file.
It is a complete mistry to me why Mousepad can do it without 'gvfs-fuse' and gvim *must* have it.
Problem solved! That is what counts. 
Added later 12 min:
hhmm, no additional idea for me. Here just some additional thoughts:
If this is urgent for you and you can ssh into the server you can try to go with sshfs instead and see if that works.
This is a good website/tutorial for it, even howto add it to systemd.. :
https://www.digitalocean.com/community/ … s-over-ssh
====
if it is/where permissions you can still doublecheck how it has been mounted in the system with "mount" and you should see it there. Perhaps the command "getfacl test.txt" for your testfile will give you the effective permission you have on that file. But honestly I don't see why that would be an issue, as it is the same for every program, so vim should have the same permissions as everyone else.
===
The behaviour to "open" the file without content as you are describing has the same symptoms as having "r" read permission on the folder (to list the files) but not the "x" folder permission to enter the directory and use it (this is on the folder containting the file, not the file itself) . In this case x is needed to open the content. Again, not sure if this is relevant having seen your permissions from ssh.
===
Honestly the bug description just goes over my headthe only thing I got from it that restarting the gvfs deamon reastart may??? solve this? (but perhaps I mistunderstood). The command for that should be:
systemctl --user restart gvfs-daemon.service
But I didn't understand why this would help.
The urgency is gone now but it still is a good idea to do.
And there is also the option to open shares using NFS, I have not touched that yet.
The NAS was up to 6 months ago acceded mainly by MS-window machines and all of then that needed access are by now replaced by debian trixie instances.
I still have two MS-window machines around, my host is dual boot and the only reason to keep that is my logitech keyboard and mouse. Logitech flat out refuses to give decent support for *nix and I like the hardware just too much to let it go.
The second MS-windows machine is for build and validate only. It does not need access to the NAS other than git pull actions.
---
Kind regards, Andre.
Offline


Just a quick comment for others that may see the same issue in the future:
In hindsight
:
These excellent Red Hat pages show the solution:
https://docs.redhat.com/en/documentatio … s-in-gnome
and
https://docs.redhat.com/en/documentatio … nvironment
The gist of the solution
:
1) Applications built with the GIO library can access GNOME Virtual File System (GVFS) mounts.
2) GVFS provides the File System in Userspace (FUSE) daemon, which exposes active GVFS mounts.
[..through the gvfs-fuse deamon..]:
Any application can access active GVFS mounts by using the standard POSIX APIs as though mounts were regular file systems.
[..] GVFS provides a File System in Userspace (FUSE) daemon, which exposes active mounts through its mount for standard Portable Operating System Interface (POSIX) access. This daemon transparently translates incoming requests to imitate a local file system for applications.
So:
If we mount file systems with the gio mount, something like "gio mount smb://<servername>/<sharename>", (gio is the command line command for gvfs) then "only" applications that are compiled with the gio library will work.
But to make this file system compatible with other or older programs that want to access the file through standard means, gvfs-fuse will, if I understood correctly, map this gvfs file system to a "standard" fuse file system on your disk.
These "other" applications can now access the files without problem.
Thunar does use gio to mount smb (and SFTP?) remote systems. Mousepad is built with native gvfs support.
vim is not and can't handle gvfs without gvfs-fuse. Other programs like lsof can't either... so you need the gvfs-fuse installed and running.
(according to the RH pages gvfs-fuse should be installed with the gvfs package, but perhaps not?)
But it was interesting seeing the symptoms of this. I would have expected vim not to find the file, but it turned out it could not read the content.. 
Offline


Just a quick comment for others that may see the same issue in the future:
In hindsight
:
...(according to the RH pages gvfs-fuse should be installed with the gvfs package, but perhaps not?)
But it was interesting seeing the symptoms of this. I would have expected vim not to find the file, but it turned out it could not read the content..
That is an excellent explanation, thank you.
About installation:
My 'original' installation procedure included `$ sudo apt install gvfs-backends smbclient`
Unfortunately this did *not* include gvfs-fuse. (it does now.)
About symtoms:
There are two locations reported where you can find an gvfs mount.
If both locations are empty then gvfs-fuse is not active.
The locations are:
`/run/user/<user_id>/gvfs/` where '<user_id>' is your account user id. (for me that is 1000).
`~/.gvfs`
About gvim, file name and loading:
When opening a file with gvim in thunar gvim will receive from thunar an url as one of its arguments.
That argument is displayed in the window top bar for file name and location. That will never fail.
The same argument is used to look up the file and load the content.
If gvfs-fuse is not active then gvim can not find the file and thus can not load the content and the load fails.
Last edited by papaathome (2026-05-25 07:52:34)
---
Kind regards, Andre.
Offline
[ Generated in 0.014 seconds, 7 queries executed - Memory usage: 603.59 KiB (Peak: 636.57 KiB) ]