Bug 427779 - Missing shutdown options after update to Plasma 5.20
Summary: Missing shutdown options after update to Plasma 5.20
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Application Menu (Kicker) (show other bugs)
Version: 5.20.0
Platform: Arch Linux Linux
: VHI normal
Target Milestone: 1.0
Assignee: Eike Hein
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2020-10-15 21:03 UTC by Vasyl Demin
Modified: 2020-11-02 15:34 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.20.3
Sentry Crash Report:


Attachments
Missed shutdown options (83.35 KB, image/png)
2020-10-29 13:04 UTC, Vasyl Demin
Details
Shutdown options are still searchable (65.35 KB, image/png)
2020-10-29 13:05 UTC, Vasyl Demin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vasyl Demin 2020-10-15 21:03:41 UTC
SUMMARY
Restart/shutdown/sleep/hibernate options are missed after update to Plasma 5.20

STEPS TO REPRODUCE
1. Add "Application Launcher" widget to the dock
2. Shutdown options are in place
3. Re-login

OBSERVED RESULT
Shutdown options are missed

EXPECTED RESULT
Shutdown options are in place

SOFTWARE/OS VERSIONS
Arch Linux
KDE Plasma Version: 5.20
KDE Frameworks Version: 5.75
Qt Version: 5.15.1
Comment 1 Michał Dybczak 2020-10-17 11:15:22 UTC
I can confirm the same in Manjaro testing. Other users also reported this issue, see:

https://forum.manjaro.org/t/testing-update-2020-10-14-plasma-kde-apps-browsers-gnome-3-38-libreoffice-mesa/31935/70

There are no shutdown and restart options, although the setting "show advanced power options" is still enabled.

I also noticed from some time (2-3 weeks) that those options were constantly missing from favorites, so I had to add theme after every session reboot, but they were gone next time again. Now those options are not even there and there is nothing to add.

The only way to reboot or shut down now is to use: physical power button (if that was configured to shut down), configured widget with power options that was configured before the bug showed up and through CLI.

I think this is a major regression, since those are BASIC and EXTREMELY IMPORTANT PARTS OF DESKTOP ENVIRONMENT. Imagine a newbie that starts Plasma for the first time and not being able to shut it down...


Additionally, there was a session that those buttons showed up spontaneously, and they were even in favorites, so I thought the issue fixed itself, but in another session, those buttons were gone again. This is bizarre and erratic. This could also mean that the issue won't be present in all conditions, so only some users will experience it, but I have no idea what is triggering it.
Comment 2 Michał Dybczak 2020-10-17 11:20:11 UTC
New info from the Manjaro forum:

[quote="Twifty, post:71, topic:31935"]
Is it possible you removed then re-added the applet? I’ve noticed that when doing this the options re-appear, but soon disappear after the next reboot (not sure about suspend/hibernate). It looks to me like the applet is checking for the permissions before a relevant library is loaded.
[/quote]

No, I didn’t do this. But I plugged another monitor that day and the start menu moved to the second one, although the main monitor was still marked as the main one… So I had to change the default one to the second and back to the first to move start menu to laptop monitor. And that was probably the action that temporarily fixed it.
Comment 3 Vasyl Demin 2020-10-17 11:33:49 UTC
> The only way to reboot or shut down now is to use: physical power button (if that was configured to shut down), configured widget with power options that was configured before the bug showed up and through CLI.

I use krunner for now, just typing Reboot or Shutdown ("Desktop Sessions" must be enabled in krunner settings).
Comment 4 Vasyl Demin 2020-10-17 11:44:19 UTC
Just noticed! "Reboot" or "Shutdown" are still searchable in "Application Launcher" widget, but you should type them in full.
Comment 5 Fonic 2020-10-18 07:53:22 UTC
This is not an issue specific to KDE Plasma 5.20 or the 'Application Launcher'. I'm experiencing this after upgrading to 5.19.5 and using the 'Application Menu'. There seem to be slight differences, though:

SUMMARY
'Power / Session' favorites in 'Application Menu' get reset to Sleep + Hibernate + Logout  on reboot. Other items previously added using right click + 'Add to favorites' get removed.

I remember that this very same issue popped up about a year ago after a KDE Plasma upgrade, but back then it could be fixed by removing database* from ~/.local/share/kactivitymanagerd/resources. Tried that again, won't work this time.

Also, I verified that added favorites are actually recorded in the config file ~/.config/plasma-org.kde.plasma.desktop-appletsrc, which is the case:

Before reboot:
[Containments][2][Applets][47][Configuration][General]
favoriteSystemActions=suspend,hibernate,logout,shutdown,reboot
favoritesPortedToKAstats=true

After reboot:
[Containments][2][Applets][47][Configuration][General]
favoriteSystemActions=suspend,hibernate,logout
favoritesPortedToKAstats=true


STEPS TO REPRODUCE
1. Add 'Application Menu' widget to the dock
2. Add all available 'Power / Session' items to favorites
3. Reboot
4. Check 'Application Menu', favorites should now have been reset to Sleep + Hibernate + Logout

OBSERVED RESULT
'Power / Session' favorites are reset to Sleep + Hibernate + Logout after reboot.

EXPECTED RESULT
'Power / Session' favorites should remain as defined by the user after reboot.

SOFTWARE/OS VERSIONS
Operating System: Gentoo Linux (amd64, stable)
KDE Plasma Version: 5.19.5
KDE Frameworks Version: 5.74.0
Qt Version: 5.15.1
Kernel Version: 5.4.66-gentoo
OS Type: 64-bit
Comment 6 Michail Vourlakos 2020-10-28 08:49:44 UTC
1. Application menu, I dont see any favorite system actions any more in Plasma 5.20
2. I tried Lock/Logout widget and that worked for me all the times
Comment 7 Michail Vourlakos 2020-10-28 08:50:56 UTC
my best guess is that you need to report this upstream in order to check the applet code and make compatible both for Plasma and Latte, and of course make sure that you are trying Latte git version. Latte v0.9.x is not maintained any more.
Comment 8 Fonic 2020-10-28 08:56:06 UTC
(In reply to Michail Vourlakos from comment #7)
> my best guess is that you need to report this upstream in order to check the
> applet code and make compatible both for Plasma and Latte, and of course
> make sure that you are trying Latte git version. Latte v0.9.x is not
> maintained any more.

What are you talking about? What does this have to do with Latte in the first place?

And who shall be 'upstream' in this case? This is a KDE issue and this is the KDE bug tracker, isn't it?
Comment 9 Michail Vourlakos 2020-10-28 09:16:38 UTC
(In reply to Fonic from comment #8)
> (In reply to Michail Vourlakos from comment #7)
> > my best guess is that you need to report this upstream in order to check the
> > applet code and make compatible both for Plasma and Latte, and of course
> > make sure that you are trying Latte git version. Latte v0.9.x is not
> > maintained any more.
> 
> What are you talking about? What does this have to do with Latte in the
> first place?
> 
> And who shall be 'upstream' in this case? This is a KDE issue and this is
> the KDE bug tracker, isn't it?

I suppose, product: plasmashell, Component: Application Launcher
Comment 10 Fonic 2020-10-28 09:20:20 UTC
(In reply to Michail Vourlakos from comment #9)
> I suppose, product: plasmashell, Component: Application Launcher

Now I see what you mean, I didn't notice that.

Well, at least for me (comment #5) this related to plasmashell / Application Menu, but I don't know about the others.
Comment 11 Michał Dybczak 2020-10-28 20:30:36 UTC
I tested it on a default TEST user with default panel - the issue doesn't exist there. So my guess is, this is latte-dock issue after all. Another argument for it is that restarting latte causes those missing options to show up.

Let's take a poll:

1. Who uses latte and has the issue?
2. Restart latte - are the missing icons back (for this session)?
3. If you can check a default user or a Plasma panel, does this issue also exist?
4. In which launcher do you have this problem?

My answers:
1. I use latte and have this issue.
2. Yes, restarting latte restores temporarily missing power options.
3. I checked it and the issue doesn't exist on default system Panel with default settings.
4. Dashboard.
Comment 12 Michail Vourlakos 2020-10-28 21:12:27 UTC
Latte is not doing anything relevant with power options. Something has changed in application launchers code path that creates the issue. So another question could be do plasma applets should take into account the Latte case?

Applets issues are applets issues. If an applet does not work correctly with Latte, then in the future a Latte specific applet will appear.
Comment 13 Michał Dybczak 2020-10-28 22:08:19 UTC
From what I see, we simply don't know the cause of this issue yet. It could be something in latte that needs update (if something changed upstream) or maybe it's an upstream bug that doesn't allow for smooth cooperation with third party's panels, like latte's?

Either way, debugging is our best course of action right now.

The fact that the issue is gone after latte's restart, suggests that the changed paths are rather not the issue. Something is blocked during startup. It somehow reminds me the problem with startup sound, where it was discovered that not only sound but also logs and other events aren't properly registered. Probably this is a long shot, but could you look at this to check if this could have something to do with our issue?

https://bugs.kde.org/show_bug.cgi?id=422948

If not, any idea what we could test?
Comment 14 David Edmundson 2020-10-28 22:26:32 UTC
>If not, any idea what we could test?

If possible, there's a test tool in libkworkspace. It prints out what actions are available/permitted. It's not installed though.

@Michail

What does Latte use as a source for power actions? kicker's model?
Comment 15 Michail Vourlakos 2020-10-29 06:27:25 UTC
(In reply to David Edmundson from comment #14)
> >If not, any idea what we could test?
> 
> If possible, there's a test tool in libkworkspace. It prints out what
> actions are available/permitted. It's not installed though.
> 
> @Michail
> 
> What does Latte use as a source for power actions? kicker's model?

Latte on its own does not use any source for power actions. Only applets take responsibility to present and function power actions. My best guess is that Latte is starting very early in the chain and when the mentioned applets do not find the relevant power actions available they hide them. I dont remember such issue to appear for these applets before Plasma 5.20 or 5.19
Comment 16 Vasyl Demin 2020-10-29 10:07:16 UTC
In my case, restarting Latte doesn't help. I see shutdown options only if I re-add "Application Launcher" widget to the dock. And they disappear after restarting Latte or re-login.

The issue doesn't exist on default system Panel.
Comment 17 Michail Vourlakos 2020-10-29 11:47:54 UTC
show me a screenshot please to make sure we talk about the same applet
Comment 18 Vasyl Demin 2020-10-29 13:04:06 UTC
Created attachment 132862 [details]
Missed shutdown options

"Application Launcher" widget with missed shutdown options
Comment 19 Vasyl Demin 2020-10-29 13:05:59 UTC
Created attachment 132863 [details]
Shutdown options are still searchable

However, the shutdown options are still searchable in the widget
Comment 20 Vasyl Demin 2020-10-29 13:06:47 UTC
I am ready to provide more information to help diagnose the issue
Comment 21 Michail Vourlakos 2020-10-29 15:54:06 UTC
someone more experienced must continue the tracking.

I have reached at the following point, these power options are now identified through Kicker.SystemEntry at https://github.com/KDE/plasma-workspace/blob/master/applets/kicker/plugin/systementry.cpp

that class is now using #include <sessionmanagement.h> in order to identify which power options are valid or not. 

I have no idea why those power options are NOT valid() for Latte  and when... either way these actions should be valid depending only the system capabilities and not when their validity is checked through plasma or latte.
Comment 22 Michail Vourlakos 2020-10-29 16:01:45 UTC
Ah... I think I know.... The actions are added through Kicker.SystemModel at: https://github.com/KDE/plasma-workspace/blob/master/applets/kicker/plugin/systemmodel.cpp#L115

for some reason, who knows why these actions are NOT valid when the relevant systemmodel lines are used. Maybe a little later the in question lines become valid but the SystemModel is not updated.

Line: https://github.com/KDE/plasma-workspace/blob/master/applets/kicker/plugin/systemmodel.cpp#L110 is the issue, that line should be OUT of the "if (entry->isValid()) {" block. The isValidChanged signal should trigger refresh function always...
Comment 23 David Edmundson 2020-10-29 16:19:07 UTC
Well spotted. Ship it!
Comment 24 Michail Vourlakos 2020-10-29 16:21:42 UTC
commit in question: https://github.com/KDE/plasma-workspace/commit/fcdbbda3965d73900c415071ad882f550994fdc2

that was introduced in Plasma 5.20
Comment 25 David Edmundson 2020-10-29 16:43:59 UTC
Yeah, IIRC I reviewed that (badly clearly!). It was some last minute change.

In any case, are you pushing a patch to move it outside the if? 
Otherwise I can
Comment 26 Michail Vourlakos 2020-10-29 16:48:01 UTC
(In reply to David Edmundson from comment #25)
> Yeah, IIRC I reviewed that (badly clearly!). It was some last minute change.
> 
> In any case, are you pushing a patch to move it outside the if? 
> Otherwise I can

no worries, please David merge it also at Plasma 5.20.x branch. Unfortunately my plasma development environment is not fully operational the last days.
Comment 27 Bug Janitor Service 2020-11-01 16:45:29 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/407
Comment 28 David Edmundson 2020-11-02 09:40:00 UTC
Git commit 7c5f16c40e9bf27d6b1466c220b9eeaf800d4620 by David Edmundson, on behalf of Michail Vourlakos.
Committed on 01/11/2020 at 16:45.
Pushed by davidedmundson into branch 'master'.

Fix SystemEntries not updating correctly

The code is meant to add the entry if it's valid, then watch for
changes. Somehow we end up only monitoring if it was valid initially.
This doesn't make sense.

This means if the menu loads before the backend we don't update
correctly when it does load.
Related: bug 423526

M  +2    -2    applets/kicker/plugin/systemmodel.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/7c5f16c40e9bf27d6b1466c220b9eeaf800d4620
Comment 29 Nate Graham 2020-11-02 15:33:31 UTC
Git commit d3c0c394d4673198574ec6c5ab2f668e4a6621da by Nate Graham, on behalf of Michail Vourlakos.
Committed on 02/11/2020 at 15:33.
Pushed by ngraham into branch 'Plasma/5.20'.

Fix SystemEntries not updating correctly

The code is meant to add the entry if it's valid, then watch for
changes. Somehow we end up only monitoring if it was valid initially.
This doesn't make sense.

This means if the menu loads before the backend we don't update
correctly when it does load.
Related: bug 423526


(cherry picked from commit 7c5f16c40e9bf27d6b1466c220b9eeaf800d4620)

M  +2    -2    applets/kicker/plugin/systemmodel.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/d3c0c394d4673198574ec6c5ab2f668e4a6621da