Plasma menu no longer updating? Solution.

Updated: February 23, 2019

Fellow KDE users, the problem you are facing is as follows: For some odd, sudden reason, the Plasma menu is no longer updating to correctly reflect the state of your installed (and removed) applications. It is showing old, invalid entries, and new programs are not being added. It has also stopped responding to its customary keyboard shortcut.

I've encountered this issue in Kubuntu 18.04 on my Lenovo G50 machine. I don't know what triggered the problem, or when, but it was suddenly there. I spent a while debugging this, and the gist of it be this fine tutorial, which should help you regain your menu functionality back without too much hassle. Follow me.

Teaser, menu not updating

Step 1: Rebuild menu index

The first step is to manually try to rebuild the Plasma menu index. The command you need is called kbuildsycoca5. You can run the command from a terminal window, as your own user, and this will also list any issues that may come up, which would prevent you having an up-to-date system menu.

kbuildsycoca5 running...
kf5.kservice.sycoca: Parse error in "/home/roger/.config/menus/applications-merged/" , line 1 , col 1 : "unexpected end of file" The desktop entry file "/usr/share/applications/org.kde.systemmonitor.desktop" has Type= "Application" but no Exec line
kf5.kservice.sycoca: Invalid Service : "/usr/share/applications/org.kde.systemmonitor.desktop" The desktop entry file "/usr/share/applications/org.kde.drkonqi.desktop" has Type= "Application" but no Exec line
kf5.kservice.sycoca: Invalid Service : "/usr/share/applications/org.kde.drkonqi.desktop"
kf5.kservice.sycoca: The menu spec file contains a Layout or DefaultLayout tag without the mandatory Merge tag inside. Please fix your file.

This is the output of my run. It had three problems there, including a malformed file without an EOF character, and two application desktop files with incomplete entries. We've seen these desktop files when we worked on creating custom launchers (for WINE) as well as launchers for multiple versions of the same application.

At this point, you can manually clean up the bad files. Move the offending entries aside and rerun the command. See if this makes a difference. If the kbuildsycoca5 command completes without any output, you should be good to go. But it is possible you will remain with this:

kbuildsycoca5 running...
kf5.kservice.sycoca: The menu spec file contains a Layout or DefaultLayout tag without the mandatory Merge tag inside. Please fix your file.

Step 2: Restore system menu

The second step is to actually reset the Plasma menu to its defaults - you will lose any custom launchers. Right click on the distro logo (the menu icon), and select Edit menu configuration. Then, under Edit, click on Restore to System Menu. You will get a warning. Confirm your choice.

Restore system configuration

This should complete fine. I tried this command on a couple of other test systems, and in one case, all WINE entries were deleted. I had to reinstall a couple of WINE applications to get them to show up again. The alternative is to manually add entries, but it was actually quicker to reinstall them. The Plasma menu was working again!

Menu works again

You can indeed re-confirm this by running the kbuildsycoca5 command once more. It should exit without any output other than the listed two lines below. Now, the bigger question: how and why does the menu configuration get out of sync, or ends up with the odd malformed entries, I have no answer to that.

kbuildsycoca5 running...

Step 3: Menu shortcuts

I also mentioned the default Super (Meta) key not being used anymore. For some reason, the Kubuntu binding was changed to Alt + F1, which is cumbersome and slow. I wanted to change this back to just Super, but KDE would not let me use that as a standalone shortcut. The workaround is to assign something like Meta + M or any other unused combo. But the menu will respond to just meta. This is quite ugly and needs to be fixed properly.

Shortcut trick

Step 4: Restart Plasma shell

If you're still encountering some issues with the menu, or if it's not responding to either mouse clicks or the keyboard shortcut, you may need to restart the Plasma shell. This is a quick, non-destructive operation, and you should not lose your session. I've shown you how to do this in my second Slimbook & Kubuntu report. The command you need is:

killall plasmashell && kstart plasmashell

You will see some output - and the menu should work nicely after that:

trying to show an empty dialog
ktp-common-internals: Current presence changed
ktp-common-internals: Current presence changed
using... PackageKit::Transaction(0x5600ede609a0) "/3757_cabdbacd"
org.kde.plasmaquick: Delayed preload of "Device Notifier" after 1.446 seconds
org.kde.plasmaquick: Applet "Device Notifier" loaded after 12 msec


Here you go. Not one or two tricks. Four tricks. Four stones, four crates! Ugh, you get the idea. Things can sometimes go pear-shaped in KDE, but equally, it is relatively quick and easy to restore them to expected defaults or desired settings. I am quite pleased by the built-in reset function. Now, an even better option would be to be able to backup the user configuration periodically, so that users can easily revert to an older set.

I would still like to know what causes the menu to wonk up, or why it is not more resilient to these kind of errors. At the very least, it could skip "bad" entries so that the majority of applications are still correctly listed and updated. There's a lot that can be done here. Until then, you have all these lovely workarounds to keep you warm at night. Take care.