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.