I use Fedora Silverblue with GNOME, and I have LibreOffice installed as a Flatpak.
Recently, I hit a strange problem: when searching for an office document from the GNOME Dash — for example, an .odt or .ods file in my Dropbox folder — and selecting it, LibreOffice appeared to start, but then failed with an error saying that a file like this did not exist:
|
1 |
/run/user/1000/doc/<some-id>/<name-of-the-file>.odt |
The confusing part was that the file did exist at that path.
Even more confusing: if I removed the file from /run/user/1000/doc/..., the original file was removed too.
So what was going on?
The short version
The fix was:
|
1 2 |
flatpak override --user --filesystem=xdg-run/doc org.libreoffice.LibreOffice |
This creates the following user override:
|
1 2 3 |
[Context] filesystems=xdg-run/doc |
stored in:
|
1 2 |
~/.local/share/flatpak/overrides/org.libreoffice.LibreOffice |
After that, opening LibreOffice documents from the GNOME Dash worked again.
The setup
The system is Fedora Silverblue, so applications are mostly Flatpaks. LibreOffice is installed as:
|
1 2 |
org.libreoffice.LibreOffice |
The problematic documents live under Dropbox, for example:
|
1 2 |
/var/home/bettini/Dropbox/sync/... |
Opening the same files with xdg-open worked fine:
|
1 2 |
xdg-open "/var/home/bettini/Dropbox/sync/path/to/file.odt" |
Opening them directly with Flatpak also worked:
|
1 2 |
flatpak run org.libreoffice.LibreOffice "/var/home/bettini/Dropbox/sync/path/to/file.odt" |
So LibreOffice itself was not broken.
The problem only happened when opening documents from the GNOME Dash search results.
The mysterious /run/user/1000/doc path
When GNOME opened the file from the Dash, LibreOffice complained about a path like this:
|
1 2 |
/run/user/1000/doc/149071dc/myfile.odt |
This is not a normal temporary directory.
It is part of the Flatpak / XDG document portal mechanism. The document portal exposes selected host files to sandboxed applications through a FUSE mount under:
|
1 2 |
/run/user/$UID/doc |
The directory name that looks like a hash is a document portal ID.
In my case:
|
1 2 |
149071dc |
was the document ID.
The file under /run/user/1000/doc/... was not a copy. It was a portal-backed view of the original file. That explains why deleting it also deleted the original document.
Do not manually clean this directory with rm.
Inspecting the document portal entry
The useful command was:
|
1 2 |
flatpak document-info "/run/user/1000/doc/149071dc/myfile.odt" |
It printed:
|
1 2 3 4 5 6 |
id: 149071dc path: /run/user/1000/doc/149071dc/myfile.odt origin: /var/home/bettini/Dropbox/myfile.odt permissions: org.libreoffice.LibreOffice.writer read, grant-permissions |
This confirmed several things:
- The
/run/user/1000/doc/...path was a document portal path. - The original file was the Dropbox file.
- GNOME was not launching the generic LibreOffice app ID.
- It was using the Writer-specific ID:
|
1 2 |
org.libreoffice.LibreOffice.writer |
The important part is that GNOME Dash was creating a fresh portal export every time I tried to open a document.
So this was not stale recent-file history, nor was it a broken search index.
Things that did not fix it
I first tried granting LibreOffice access to my whole home directory:
|
1 2 |
flatpak override --user --filesystem=home org.libreoffice.LibreOffice |
That did not solve the GNOME Dash problem.
This makes sense in hindsight. The issue was not that LibreOffice could not access my Dropbox file directly. Direct opening already worked.
The issue was that GNOME Dash was giving LibreOffice this path:
|
1 |
/run/user/1000/doc/<doc-id>/<filename> |
not this one:
|
1 2 |
/var/home/bettini/Dropbox/sync/... |
Granting access to home does not automatically make /run/user/1000/doc visible inside the Flatpak sandbox.
I also tried clearing recent files, resetting the GNOME file index, restarting portal services, and logging out and back in.
Still, every time I opened a new LibreOffice document from the Dash, a new directory appeared under:
|
1 2 |
/run/user/1000/doc |
That was the clue: GNOME was actively creating new document portal exports.
The actual fix
The working fix was to allow the LibreOffice Flatpak to see the document portal runtime directory:
|
1 2 |
flatpak override --user --filesystem=xdg-run/doc org.libreoffice.LibreOffice |
Then kill any running LibreOffice instance:
|
1 |
flatpak kill org.libreoffice.LibreOffice 2>/dev/null |
After that, opening documents from the GNOME Dash worked.
The resulting override file is:
|
1 2 3 |
[Context] filesystems=xdg-run/doc |
stored at:
|
1 2 |
~/.local/share/flatpak/overrides/org.libreoffice.LibreOffice |
This is much better than granting access to the whole home directory.
Why this works
GNOME Dash opens the document through the portal and passes LibreOffice a path like:
|
1 |
/run/user/<userid>/doc/<...>/ |
But the LibreOffice Flatpak sandbox did not have that runtime directory visible.
By granting:
|
1 2 |
xdg-run/doc |
we expose just the document portal mount inside the sandbox.
That is enough for LibreOffice to resolve the path that GNOME provides.
Keeping the fix in chezmoi
Since I manage my dotfiles with chezmoi, I added this file:
|
1 2 |
~/.local/share/flatpak/overrides/org.libreoffice.LibreOffice |
In chezmoi form, that is:
|
1 2 |
dot_local/share/flatpak/overrides/org.libreoffice.LibreOffice |
with this content:
|
1 2 3 |
[Context] filesystems=xdg-run/doc |
That is all I need.
Useful commands
Show current LibreOffice Flatpak overrides:
|
1 2 |
flatpak override --user --show org.libreoffice.LibreOffice |
Inspect a document portal entry:
|
1 2 |
flatpak document-info "/run/user/1000/doc/..." |
Grant access to the document portal mount:
|
1 2 |
flatpak override --user --filesystem=xdg-run/doc org.libreoffice.LibreOffice |
Remove the override again:
|
1 2 |
flatpak override --user --nofilesystem=xdg-run/doc org.libreoffice.LibreOffice |
Kill LibreOffice after changing overrides:
|
1 |
flatpak kill org.libreoffice.LibreOffice 2>/dev/null |
Final result
The minimal override is:
|
1 2 3 |
[Context] filesystems=xdg-run/doc |
This fixes opening LibreOffice documents from the GNOME Dash without granting LibreOffice access to the whole home directory.
The root cause appears to be this interaction:
|
1 2 3 4 5 6 7 |
GNOME Dash search result ↓ document portal export ↓ /run/user/1000/doc/<doc-id>/<filename> ↓ LibreOffice Flatpak |
LibreOffice was provided with a valid host-side portal path, but the sandbox could not find the corresponding runtime directory.
Granting xdg-run/doc bridges exactly that gap.