LibreOffice Documents Fail to Launch from GNOME Search

Opening LibreOffice files from GNOME search fail with this error: /run/user/1000/doc/<random str>/<filename.ods> does not exist. LibreOffice is installed as a Flatpak from the Flathub repo on the latest Bluefin (Fedora Silverblue).

Launching LibreOffice directly either by double-clicking an office file, or via the flatpak command (flatpak run org.libreoffice.LibreOffice <filename.ods>) works as expected, although, when launched via the flatpak command, LibreOffice emits an error/warning message as well: Failed to open display.

Here’s a snippet of relevant logs:

systemd[2725]: Started dbus-:1.2-org.gnome.Nautilus@5.service.
org.gnome.Nautilus[212124]: Connecting to org.freedesktop.Tracker3.Miner.Files
systemd[2725]: Started dbus-:1.2-org.gnome.NautilusPreviewer@7.service.
xdg-document-portal[212143]: error: org.libreoffice.LibreOffice.calc/*unspecified*/*unspecified* not installed
systemd[2725]: Started app-flatpak-org.gnome.NautilusPreviewer-585090358.scope.
systemd[2725]: Started app-flatpak-org.libreoffice.LibreOffice-1127256259.scope.
org.libreoffice.LibreOffice.calc.desktop[212182]: Failed to open display

This is how Flatpak permissions look like for LibreOffice (unmodified from defaults):

❯ flatpak info --show-permissions org.libreoffice.LibreOffice
[Context]
shared=ipc;network;
sockets=cups;fallback-x11;pulseaudio;wayland;x11;
devices=dri;
filesystems=xdg-config/gtk-3.0;xdg-run/gvfsd;xdg-config/fontconfig:ro;host;

[Session Bus Policy]
org.gtk.vfs.*=talk
org.libreoffice.LibreOfficeIpc0=own

[Environment]
GIO_EXTRA_MODULES=/app/lib/gio/modules
JAVA_HOME=/app/jre
LIBO_FLATPAK=1

Any ideas? The robots weren’t able to help.

I ran into the same issue. seaching online did not yeild many results - I think this might be a problem limited to folks using fedora silverblue and its derivatives.

at any rate, I tried clearing search history in the gnome settings, and removing and reinstalling the libreoffice flatpak, with and without saving user data. none of that fixed the problem.

then I tried searching again and found this post. The fix described there worked great for me.

Just in case the link breaks, the fix is to add an override that allows the libreoffice flatpak to access the the document portal runtime directory (xdg-run/doc).

The CLI command looks like this (the --user flag might not be completely necessary):
flatpak override --user --filesystem=xdg-run/doc org.libreoffice.LibreOffice

You can also add the override via flatseal, which is what I did:

  1. open up flatseal
  2. select libreoffice from the list of flatpaks
  3. scroll down to the filesystem section
  4. click the + in a folder icon (next to Other files) to add an override
  5. enter xdg-run/doc into the text box

after adding the override, close all instances of libreoffice. now you should be able to open up files via gnome search as expected.

the post in the link above explains why this fixes the problem in much greater detail.

grazie mille Lorenzo Bettini!

2 Likes

This works perfectly, thank you! Would you be willing to send this as a patch upstream?

willing, sure. but I don’t really know how to submit a patch upstream.

You’d want to do the following:

  • Clone this repo,
  • Add "--filesystem=xdg-run/doc", right above this line,
  • Commit the change with a helpful message, and finally
  • Submit a Merge Request.

If this seems like too much, I’m happy to tackle this.

Since I was also experiencing this issue, and the workaround from the blog post linked above worked for me as well, I went ahead yesterday, and sent a PR to the flathub manifest repo: https://github.com/flathub/org.libreoffice.LibreOffice/pull/387

The response from the maintainer was that this is not a good solution, but the issue needs further investigation. I, personally, have no idea, and no time to investigate further, why GNOME’s overview apparently ignores the

private, per-app directory under xdg-run/doc for document portal communication

mentioned by the maintainer.

Today the suggested workaround didn’t work anymore. All I got was:

$ flatpak run org.libreoffice.LibreOffice
bwrap: Can't mount on symlink destination /run/user/1000/doc

i.e. LO would not start at all (not via search from the overview, not directly like above), I had to flatpak override --reset org.libreoffice.LibreOffice to be able to even start it again.