qubes-issues icon indicating copy to clipboard operation
qubes-issues copied to clipboard

Dolphin and other KDE apps' file associations broken

Open Rudd-O opened this issue 3 years ago • 14 comments

How to file a helpful issue

Qubes OS release

4.1

Brief summary

Template includes qubes-menus package, which does not include file /etc/xdg/menus/applications.menu. This causes Dolphin not to know about installed applications, therefore cannot open any file.

The fix is to create a symlink named applications.menu pointing to kf5-applications-qubes.menu in the aforementioned folder.

Normal Fedora ships redhat-menus RPM which has its own applications.menu which works fine.

Rudd-O avatar May 04 '22 13:05 Rudd-O

Does this affect only Fedora templates?

andrewdavidwong avatar May 04 '22 18:05 andrewdavidwong

I wouldn't know, I didn't check other templates.

Rudd-O avatar May 13 '22 15:05 Rudd-O

Doesnt seem to be an issue in debian

unman avatar May 13 '22 15:05 unman

Faced the same issue of Dolphin not recognizing any installed applications. Can confirm that the fix suggested by @Rudd-O solves the issue on Fedora Templates. The file I had to symlink was called kf5-qubes-applications.menu rather than kf5-applications-qubes.menu.

Tellervo89 avatar Jun 29 '22 11:06 Tellervo89

I have this too, fedora-36-minimal template is defective. This packaging problem does not exist on fedora 35 templates, nor upstream fedora 36 . And could not find this exact issue mentioned anywhere else. So, it's a Qubes OS bug.

Currently for average Qubes OS user it's almost not possible to use KDE environment and suite-applications in main fedora templates because nothing gets open from file-manager (Dolphin).

I propose this issue's priority to be increased, because fedora-35 got EOL recently and in case of fedora-36 template - basic stuff like opening files does not work.

jamke avatar Dec 13 '22 09:12 jamke

@Rudd-O thank you a lot for a workaround by the way! In my case is also was kf5-qubes-applications.menu:

For others - command to temporary solve this issue on fedora-36-minimal: sudo ln --symbolic /etc/xdg/menus/kf5-qubes-applications.menu /etc/xdg/menus/applications.menu

jamke avatar Dec 13 '22 09:12 jamke

The same issue on Fedora-37, Fedora-38. For unprepared user it is still a MAJOR bug. Nothing is opening from file-manager: not text files, nor images and etc.

P.S. and workaround by @Rudd-O still works.

jamke avatar Aug 05 '23 14:08 jamke

This better be fixed, it's a fatal user experience otherwise.

Rudd-O avatar Aug 07 '23 20:08 Rudd-O

I also ran into this problem a while back, and I figured out the issue after a lot of debugging. Note that it's been a while (I should have posted this months ago!) and I'm summarizing off memory, so the details might be slightly incorrect.

Root cause

The reason that Dolphin (or actually kbuildsycoca5, as I recall it) complains about not finding /etc/xdg/menus/applications.menu is that it is actually looking for /etc/xdg/menus/${XDG_MENU_PREFIX}applications.menu as per the Freedesktop Menu specification. Typically, when using a DE, this is set by the session to a suitable value so that the DE can choose its own specific menu structure, e.g. it sets the variable XDG_MENU_PREFIX=gnome- (note the hyphen).

The (non-minimal) Fedora template ships with packages that provide a number of different *-applications.menu files, such as gnome-applications.menu (provided by the package gnome-menus), xfce-applications.menu (provided by garcon), qubes-applications.menu (provided by qubes-menus) and, as noted, kf5-applications.menu (provided by kf5-service, likely pulled in as a dependency on your systems when installing dolphin).

However, when not using a DE, such as when running a WM like i3, this environment variable is not set to anything! I can't recall the exact manner the programs call each other, but I believe when you start Dolphin, it forks off a process running kbuildsycoca5 in order to populate the MIME database. However, this process begins by trying to load in the Menu file - resolving to /etc/xdg/menus/applications.menu in this case, since the prefix is empty!

So the issue is not that applications.menu is missing (it should not be there!) but that the environment hasn't specified which of the multitude of specific menu files to use.

Because the file can't be found, the program then errors out before being able to enumerate the .desktop files it uses for creating the MIME database. The result is that KDE applications will not have access to any MIME database (or, if one had previously been created, say by starting up Dolphin in a DE in the past, the database will be out of date, never noticing if you install new programs or override file associations manually).

If I am not entirely misremembering, Nautilus uses a different mechanism for updating its database, with the result stored elsewhere, so Dolphin isn't able to piggyback off that either.

Solution

The fix is easy, however. You just need to tell the environment what prefix to use. It doesn't matter too much which one you choose (whether it's Gnome or kf5, assuming a WM user won't care about whatever DE-specific differences there are in the menus).

My solution was to mimic the X11 configuration scripts already present in qubes-gui-agent-linux and put a script in /etc/X11/xinit/xinitrc.d, which is sourced by Xsession on startup of the VM:

$ cat /etc/X11/xinit/xinitrc.d/55-set-xdg-menu-prefix.sh
export XDG_MENU_PREFIX=kf5-

(again, note the hyphen at the end).

Note: This file will be sourced regardless of what session is started, but I believe that if you were to start a full DE session, it would overwrite this value with the one that is correct in that environment, without a problem.

Note that there is already an xinitrc.d file that does this (and more), namely /etc/X11/Xsession.d/60xfce-desktop (part of the qubes-gui-agent-xfce package). Thus, a fix could be to simply adapt that file and include it in a non-optional package (maybe qubes-gui-agent?), so that it is present even for WM users. Care must be taken to ensure that the prefix chosen corresponds to a *-applications.menu file which is also present on such a system.

Addendum

To clarify, for the sake of confirming the bug and my analysis, this issue should arise on VMs where:

  1. qubes-gui-agent-xfce is not installed (so no 60xfce-desktop file present that sort of sets a default value to the prefix by accident).
  2. Xsession doesn't start up a full-blown DE session that configures the prefix itself.

jmickelin avatar Jan 05 '24 16:01 jmickelin

This issue is being closed because:

If anyone believes that this issue should be reopened, please leave a comment saying so. (For example, if a bug still affects Qubes OS 4.2, then the comment "Affects 4.2" will suffice.)

github-actions[bot] avatar Dec 07 '24 14:12 github-actions[bot]

@DemiMarie you assigned and un-sassigned yourself from this one. Can you (or somebody) please verify that this issue is fixed? @Rudd-O maybe you can?

jamke avatar Dec 25 '24 16:12 jamke

The problem is still in place in R4.2.4 with Fedora-41.-minimal (maybe full too?).

Dolphin being installed with all dependencies and still cannot open any file (e.g. txt file).

Pretty sure this is a major problem for all Qt/KDE users of Qubes OS. Fedora with KDE, obviously does not have this problem.

Affects R4.2 (probably R4.3, as the problem is with templates). Please reopen?

jamke avatar Mar 09 '25 09:03 jamke

Oddly enough, I've been using KDE-based templates perfectly fine for probably > 6 years.

What made it work for me was setting export XDG_CURRENT_DESKTOP=KDE in /etc/profile.d. I see that someone else also mentioned this long ago.

Alas, this works until Debian 12, but not in the R4.3 Debian 13. The above setting gets overridden somehow, and if I force it there is no effect. This is my biggest speed bump thus far in moving to Qubes R4.3, and the only workaround I have is to restore my Debian 12 KDE template into the R4.3 system and update it with appropriately modified apt sources. I've been using Debian 12 VMs for the time being, but will try the menu linking and setting XDG_MENU_PREFIX as suggested above to see if they work.


Update: ~~It didn't work on a fresh Debian 13 template.~~ However, an upgraded 12 -> 13 template does work with the above measures. I noticed there are some extra files in /etc on the upgraded template which dpkg says are from 'residual-config' packages. A diff between the contents of the two templates should reveal what is missing in the new template.

tasket avatar Nov 11 '25 01:11 tasket

I was able to get KDE working in a fresh debian-13 template and have posted a guide here:

https://forum.qubes-os.org/t/installing-kde-in-a-debian-13-template/37324/1

Update:

I've added an extra step to address the missing file copy, move, pdf convert, etc. actions in Dolphin. The transition to KDE 6 makes it necessary to update the .desktop files content and location. You can find an updated guide for KDE service menus here:

https://develop.kde.org/docs/apps/dolphin/service-menus/

tasket avatar Nov 12 '25 19:11 tasket