After an upgrade (from Fedora Kinoite 43 to 44, LibreOffice flatpak launch failed. Some thrashing about revealed that the command line needed adjustment.
Failed to open display
/app/libreoffice/program/soffice.bin X11 error: Can’t open display:
Set DISPLAY environment variable, use -display option
or check permissions of your X-Server
(See “man X” resp. “man xhost” for details)
Successful command line:
flatpak run --branch=stable --arch=x86_64 --command=libreoffice --file-forwarding org.libreoffice.LibreOffice --calc --display
Additional comment: I see no purpose in including --file-forwarding in a GUI launcher’s command line.
Note: after a while, my “fix” stopped working in a new way: the app froze at the splash screen. Reboot seems to have cleared that, but I’m feeling gun-shy now, and resorting to using a snap install instead. I’m sure hoping someone knowledgeable can shed some light on this, as I know nothing about creating flatpaks (or snaps).
I don’t think your issue is related to the command line. --file-forwarding allows file/URI arguments to be forwarded to the app via the document portal. With the LibreOffice flatpak’s broad file access (--filesystem=host), it isn’t needed, but this is a builtin feature that can’t be turned off, and it doesn’t do any harm anyway.
As per the Desktop Entry spec, the %U specifier must be removed by the launcher if the app is launched without any URIs, so the actual resulting command line would look like this:
flatpak run --branch=stable --arch=x86_64 --command=libreoffice --file-forwarding org.libreoffice.LibreOffice --calc @@u @@
With --file-forwarding, flatpak consumes the @@u and @@, and forwards any URIs between them (none in this case). Inside the sandbox, the LibreOffice binary would only receive --calc.
As a result, flatpak run org.libreoffice.LibreOffice --calc would be practically equivalent to launching LibreOffice Calc from your desktop shell.
Are you using a Wayland or X11 session? It shouldn’t be trying to use X11 if you’re on Wayland, and by default would be unable to do so.
I’m running Wayland, KDE Plasma 6.6.4, Kernel 7.0.4-200.fc44x86_64.
The only way I found to launch LibreOffice (from Plasma or bash in konsole) was to modify the command line that was furnished by the flatpak installation, adding --display :0 and removing %U. Even with those “fixes” it is still hit or miss, which at first seemed sufficient. The issue is still a complete mystery to me.
I will post something about this in the flatpak LibreOffice bugtracker area as @Erick555 seems to suggest. I’ve also mentioned it in a Fedora forum.
Yes, I’m quite ignorant. I rarely save files to the desktop, but it’s a common practice, certainement.
Thank you for your implied suggestion of additional testing. The launch command line arguments in the Plasma application launcher are used when the user double-clicks a desktop file, or launches the application from Dolphin. That explains why --file-forwarding is important.
All this does nothing (at least for me) toward explaining why the adding –display :0usually allows launching from the application launcher, but still sometimes hangs at the splash screen with an X11 icon on the command line.
My remark about --file-forwarding came from my ignorance, which is now reduced. But I also still “have no idea” about the main subject of my posting. Maybe the flatpak command line arguments are not the true source of the problem, but adding --display :0 seems to make a difference.