Can't open LibreOffice documents on a SMB shared folder (GVFS-related?)

Hi,

I was on Lubuntu 22.10 and upgraded to 23.10 only to find out i can no longer double-click on a libreoffice file from a shared folder to open it.

(i have followed a few instructions such as installing gvfs-fuse, gvfs-backend and libreoffice-gnome packages with no success)

Can anyone help me with this?
Is there some magic-package i should install to get this fixed?

thank you

Looks like a libreoffice problem with gvfs.

Try;
A) Remote Files > Manage Services > Windows Share.

OR
B) If you already have libreoffice-gnome installed,
Preferences > Settings > Session Settings > Environment
SAL_USE_VCLPLUGIN=gtk3 instead of qt5 (logout/login).
Then use the gtk picker; Open_File > (Left Column:drives)

OR
C) Don’t use gvfs, and mount your drives manually.

Hi

A) where can i find this? (is it on libreoffice?)

B) if i use the file picker from within libreoffice startcenter there is no problem in opening the files with RW (if i use the “old” files that start with smb://), however if i try to double click them on pcmanfm-qt it won’t work (even with the VCLPLUGIN=gtk3)

C) well… it used to work well in Lubuntu 22.10. I just browsed the remote drives with no problem. I really don’t see anything good from gvfs. For now i only got bad results… :slight_smile:

A) yes, it’s the 2nd item on the left after you open libreoffice. You have to enter your drive’s share details to add a service. Then it will remember the next time.

B) That’s right It doesn’t work from pcmanfm-qt. It’s not a qt thing, cos it doesn’t work from my other file manger which uses gtk either.

A) Ok, this is what i’ve done before then. It does work as an alternative (like opening the files that has the old smb:// url from the start center), but it is far from ideal in our case!

Is there any other way to restore the old behavior of Double-Click to open a remote libreoffice file?

Because opening the files from startcenter causes lots of problems in our workflow.

The symptoms I see look remarkably like this bug.
If you follow it all the way through, it leads to this being filed.
A very interesting read. Especially the very last post on the 2nd link above.
I don’t know what happened after that. Maybe someone fixed it and it’s regressed(?)

The gist is that pcmanfm-qt is not sending the gio (smb://) type paths to libreoffice. Instead it’s sending the /run/user/1000/… paths which libreoffice is not handling well.

I have not tried the workaround script given in that last post but it’s probably ok, because I tried
libreoffice smb://… in a terminal and it worked.

nop… the workaround ain’t working!!!

Ate least for me it isn’t!!! I’ve tried it exactly as it is there and also with a few adaptations to try to make it work but no luck!!!

Funny thing is that in fedora lxqt this works out of the box!!!

I would prefer to stay in Lubuntu, but this really is a deal breaker… If i can’t find a solution i’ll have to migrate a bunch of machines :frowning:

help…

Change these two lines;

if($url=~m#^(/|file:).*run/user/[0-9]+/gvfs/([^:]+):host=([^,/]+),user=([^,/]+)/#) {
	$url="$2://$4\@$3/".$';

to these;

if($url=~m#^(/|file:).*run/user/[0-9]+/gvfs/([^:]+):server=([^,/]+),share=([^,/]+)/#) {
	$url="smb://$3/$4/".$';

I haven’t used perl before, but it seems to work.
Basically I replaced ‘host’&‘user’ to ‘server’&‘share’,
and then re-arranged the $url.

before: smb-share://<user>@<host>/mydir/myfile.odt
(not working)
after: smb://<server>/<share>/mydir/myfile.odt
(working)
1 Like

OK…

I’m surely doing something wrong because it still ain’t working!!!

here’s what i’ve done:

  1. I went to Comment #23 : Bug #1875717 : Bugs : libreoffice package : Ubuntu and downloaded the attached file.
  2. I edited it and changed the lines according to what you said.
  3. i then copy-pasted the file into ~/.local/share/applications/
    3.1 - i pasted it in pcmanfm-qt both as root and as a regular user… just in case
    3.2 - also just in case i pasted it with the name pcmanfm_open_libreoffice.desktop and pcmanfm_open_libreoffice
  4. i then went into the windows share, right-clicked the file and choose “Open with” and pasted pcmanfm_open_libreoffice %u as a “Custom command” and pressed OK
  5. i double clicked the file and still got the error

(Note: after the errors, i also tried to change the existing opener in /usr/share/applications/libreoffice*.desktop by right-clicking the libreoffice-calc.desktop file and choose “Open with” and pasted pcmanfm_open_libreoffice %u as a “Custom command”… and i also tried a few other “invented-in-the-moment” steps)

what am i doing wrong???

There are two files
A) a desktop file - which is really just a launcher
and
B) a script which (A) will call.

This is where you put A (it starts from your home dir)
~/.local/share/applications/pcmanfm_open_libreoffice.desktop

This is what is inside A

[Desktop Entry]
Name=pcmanfm_open_libreoffice
GenericName=pcmanfm_open_libreoffice
Exec=/usr/local/bin/pcmanfm_open_libreoffice %u
Icon=libreoffice-document-new
Type=Application
Terminal=false
Categories=Office;
Keywords=documents;

(don’t put anything else inside A)

This is where you put B (it starts from root)
/usr/local/bin/pcmanfm_open_libreoffice
and must be executable.

This is what is inside B

#!/usr/bin/perl

my $url=$ARGV[0];
if($url=~m#^(/|file:).*run/user/[0-9]+/gvfs/([^:]+):server=([^,/]+),share=([^,/]+)/#) {
	$url="smb://$3/$4/".$';
}
exec('libreoffice',$url);

(don’t put anything else inside B)

myfile.odt > Right-Click > Open With > Other Applications
 > Office > pcmanfm_open_libreoffice

(that last bit should automatically show up because A exists)

>Set selected application as default action of this file type
>OK

The next time you use myfile.odt > Right-Click > Open With >
pcmanfm_open_libreoffice
should show up.

-End
( The only time you need a Custom Command is when you only have B (can’t be bothered to install A).

3 Likes

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.