Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 571974 - sys-auth/consolekit-1.0.1 cannot shut down from Plasma 5
Summary: sys-auth/consolekit-1.0.1 cannot shut down from Plasma 5
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] KDE (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo KDE team
URL: https://github.com/ConsoleKit2/Consol...
Whiteboard:
Keywords:
: 573138 (view as bug list)
Depends on:
Blocks: plasma-5.5.5-stable
  Show dependency tree
 
Reported: 2016-01-15 08:28 UTC by Märt Bakhoff
Modified: 2016-03-28 14:04 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge-info.log,4.75 KB, text/plain)
2016-01-15 08:29 UTC, Märt Bakhoff
Details
ck-list-sessions + console-kit-daemon debug log (sessions-and-syslog.txt,37.92 KB, text/plain)
2016-01-18 21:58 UTC, Märt Bakhoff
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Märt Bakhoff 2016-01-15 08:28:55 UTC
I can no longer shut down my laptop from the KDE menu after upgrading to sys-auth/consolekit-1.0.1 - the shutdown button is not displayed. Downgrading to sys-auth/consolekit-1.0.0-r1 fixes the issue. 

Using KDE 5.5.2

Reproducible: Always
Comment 1 Märt Bakhoff 2016-01-15 08:29:18 UTC
Created attachment 422966 [details]
emerge --info
Comment 2 Märt Bakhoff 2016-01-15 21:29:18 UTC
Bisected. Looks like it's caused by that commit: 
https://github.com/ConsoleKit2/ConsoleKit2/commit/ac39c4ea6bc0b5649c2389548fb27bc32668199b

Can anyone else reproduce? Should I take it upstream?
Comment 3 Michael Palimaka (kensington) gentoo-dev 2016-01-16 18:19:47 UTC
I haven't heard about this bug yet so far, but upstream is very responsive and will surely appreciate your bisection.
Comment 4 Thomas Masper 2016-01-16 18:58:50 UTC
I can confirm this on my laptop too, no shutdown and reboot buttons is displayed.
Using plasma-5.5.3, upower-0.99.2-r1, no systemd.
Downgrading to consolekit-1.0.0-r1 fixes the issue.
Comment 5 Märt Bakhoff 2016-01-16 23:52:21 UTC
Thanks guys! I reported it upstream, let's see if they have any ideas.. 
https://github.com/ConsoleKit2/ConsoleKit2/issues/58
Comment 6 Jason Zaman gentoo-dev 2016-01-18 15:17:10 UTC
you're using sddm as the login manager? is the env var that the bisected commit checks wrong on your machine somehow? (once you're logged in, run "env | grep XDG_")

Also, there was another change introduced in 1.0.1, can you remove /usr/lib/ConsoleKit/run-session.d/pam-foreground-compat.ck and see if that makes any difference? that file does not exist in the 1.0.0 ebuild.
Comment 7 Märt Bakhoff 2016-01-18 17:53:27 UTC
Yes, I'm using sddm-0.13.0-r1. 

XDG_VTNR seems to be set and correct (ctrl-alt-f7 shows the desktop):
$ env | grep XDG_VTNR
XDG_VTNR=7

Removing pam-foreground-compat.ck does not have any effect. 

I would try to debug it more myself, but I'm not sure where to start.. any hints about which processes/methods are relevant are appreciated :)
Comment 8 Märt Bakhoff 2016-01-18 21:58:45 UTC
Created attachment 423306 [details]
ck-list-sessions + console-kit-daemon debug log

Ok, I debugged plasmashell, console-kit-daemon and polkitd a bit: 
* plasmashell asks console-kit-daemon "CanStop" which returns false. 
* console-kit-daemon decides that by asking polkitd
* polkitd decides by asking console-kit-daemon about the session
* console-kit-daemon says the session is local, but not active

Running ck-list-sessions shows that there are two sessions for my user (why?) and only one of them is active. After enabling debug logging, syslog shows that plasmashell is checking CanStop for the inactive session. Logs attached.
Comment 9 Märt Bakhoff 2016-01-20 21:39:17 UTC
I had built sddm with USE="consolekit". Building with USE="-consolekit" fixes the issue for me: I no longer have two sessions and the one I have is active. 

As far as I understand, consolekit's pam integration opens a session automatically on login and before I had sddm open one, too. Maybe add a warning to sddm ebuild about the use flag and potential breakage? 

I think this bug can be closed or transformed into a sddm ebuild issue.
Comment 10 Andreas Sturmlechner gentoo-dev 2016-01-30 10:53:42 UTC
Please check:

grep pam_ck_connector /etc/pam.d/system-login
Comment 11 Märt Bakhoff 2016-01-30 11:09:49 UTC
pam_ck_connector seems to be working fine for me. the problem was duplicate sessions opened by sddm? 

$ grep pam_ck_connector /etc/pam.d/system-login
session         optional        pam_ck_connector.so
Comment 12 Andreas Sturmlechner gentoo-dev 2016-01-30 11:20:24 UTC
It seems you have removed the trailing 'nox11' from that line at some point in the past, as described by the sddm wiki in case of trouble - not a good advice these days anymore, imo. Could you try again with that file fixed, and sddm[consolekit]?
Comment 13 Märt Bakhoff 2016-01-30 12:12:19 UTC
tested: nox11 + sddm[consolekit] works ok, only one session and it is active.
Comment 15 Märt Bakhoff 2016-01-30 17:03:07 UTC
thanks! that could help the next guy stepping on the same issue :)

on the same topic: it seems rather easy to forget the sddm[+consolekit] flag and wonder why the session is broken. it isn't enabled by default or pulled in by anything i have installed. but this bug might not be the best place to bring it up..
Comment 16 Andreas Sturmlechner gentoo-dev 2016-01-30 18:24:17 UTC
That really only is a problem for non-plasma-profile users - it's expected you're a bit more on your own there. Not sure what more could be done than that, I just checked and it is already part of the consolekit guide: https://wiki.gentoo.org/wiki/ConsoleKit#USE_flags
Comment 17 Märt Bakhoff 2016-01-30 18:38:13 UTC
didn't know about the desktop profiles. if most people use these then i suppose it's fine. thanks for the info!
Comment 18 Michael Palimaka (kensington) gentoo-dev 2016-01-31 14:14:26 UTC
How about introducing a systemd USE flag to plasma-meta to enforce a dependency on sddm[consolekit] when unset?
Comment 19 Sven Eden 2016-02-01 10:04:57 UTC
*** Bug 573138 has been marked as a duplicate of this bug. ***
Comment 20 Sven Eden 2016-02-02 09:05:32 UTC
Sorry to comment on a closed bug, but I *think* this is related.

I came here from my own bug 573138, that happened to be a duplicate.
After re-adding the "nox11" option to the pam_ck_connector, and removing/re-adding the K-Menu, I got the shutdown and reboot buttons and options back.

So that fix worked.

*BUT* : I no longer can suspend my laptop. I no longer have the option, powerdevil does no longer offer me to suspend the laptop on lid close, and my laptops hotkey (Fn+F1) only blanks the screen for a few seconds before showing the desktop again.

This is very bad. Suspension works if I use "sudo hibernate-ram" from a console, and it worked before the "fix".

Any ideas on how to debug this?
Comment 21 Sven Eden 2016-02-02 10:13:20 UTC
Found it.

After the removal of sys-power/upower-pm-utils nothing needed pm-utils any more and the next --depclean removed it.

A USE flag should be added to sys-auth/consolekit to pull it in instead of just displaying an information about pm-utils being needed. The powerdevil/consolekit/upower upgrade went through with pm-utils installed, so no warning or information came.
Comment 22 Jason Zaman gentoo-dev 2016-02-02 14:05:45 UTC
(In reply to Sven Eden from comment #21)
> Found it.
> 
> After the removal of sys-power/upower-pm-utils nothing needed pm-utils any
> more and the next --depclean removed it.
> 
> A USE flag should be added to sys-auth/consolekit to pull it in instead of
> just displaying an information about pm-utils being needed. The
> powerdevil/consolekit/upower upgrade went through with pm-utils installed,
> so no warning or information came.

alas USE-flags are not supposed to control optional runtime deps that are not needed at build time. Not everyone wants to suspend and flipping the useflag would mean rebuilding the entire package when literally nothing changed. I dont really like the policy personally but such is life :(.
Comment 23 Andreas Sturmlechner gentoo-dev 2016-02-03 13:30:22 UTC
(In reply to Michael Palimaka (kensington) from comment #18)
> How about introducing a systemd USE flag to plasma-meta to enforce a
> dependency on sddm[consolekit] when unset?

Beware of users that want to have neither systemd nor consolekit. ;)
Comment 24 Sven Eden 2016-02-03 16:58:20 UTC
(In reply to Jason Zaman from comment #22)
> (In reply to Sven Eden from comment #21)
> > Found it.
> > 
> > After the removal of sys-power/upower-pm-utils nothing needed pm-utils any
> > more and the next --depclean removed it.
> > 
> > A USE flag should be added to sys-auth/consolekit to pull it in instead of
> > just displaying an information about pm-utils being needed. The
> > powerdevil/consolekit/upower upgrade went through with pm-utils installed,
> > so no warning or information came.
> 
> alas USE-flags are not supposed to control optional runtime deps that are
> not needed at build time. Not everyone wants to suspend and flipping the
> useflag would mean rebuilding the entire package when literally nothing
> changed. I dont really like the policy personally but such is life :(.

Sorry, that made me rather angry yesterday, so I waited until today.

1) I thought that is what RDEPEND is supposed to be for. If only that changes, a package does not need to be rebuilt. If portage can not handle it, it should be included.

2) There are other USE flags, like "doc" that trigger a full rebuild although it is not necessary. So? Remove that flag from almost every package?

3) I can understand all this, but pm-utils would be a USE flag you either set once, because you have a mobile device, or do not set anyway, because you do not need it.

4) Hiding this in an einfo message broke stuff for me, because emerge --depclean removed pm-utils, that was pulled in by upower-pm-utils. Am I the only one who got their pm-utils package removed, because an einfo message told them, that upower-pm-utils is no longer needed? I hope so.

(The ugly thing about 4 is, that at the time consolekit got updated, it was in the wake of the change to upower. At that time, pm-utils was still there, so consolekit did not issue any message.)
Comment 25 Jason Zaman gentoo-dev 2016-02-05 07:23:26 UTC
(In reply to Sven Eden from comment #24)
> (In reply to Jason Zaman from comment #22)
> > (In reply to Sven Eden from comment #21)
> > > Found it.
> > > 
> > > After the removal of sys-power/upower-pm-utils nothing needed pm-utils any
> > > more and the next --depclean removed it.
> > > 
> > > A USE flag should be added to sys-auth/consolekit to pull it in instead of
> > > just displaying an information about pm-utils being needed. The
> > > powerdevil/consolekit/upower upgrade went through with pm-utils installed,
> > > so no warning or information came.
> > 
> > alas USE-flags are not supposed to control optional runtime deps that are
> > not needed at build time. Not everyone wants to suspend and flipping the
> > useflag would mean rebuilding the entire package when literally nothing
> > changed. I dont really like the policy personally but such is life :(.
> 
> Sorry, that made me rather angry yesterday, so I waited until today.
> 
> 1) I thought that is what RDEPEND is supposed to be for. If only that
> changes, a package does not need to be rebuilt. If portage can not handle
> it, it should be included.
> 
> 2) There are other USE flags, like "doc" that trigger a full rebuild
> although it is not necessary. So? Remove that flag from almost every package?
> 
> 3) I can understand all this, but pm-utils would be a USE flag you either
> set once, because you have a mobile device, or do not set anyway, because
> you do not need it.

bug 557432#c2 has where it originally came up. The official line comes from: 
https://devmanual.gentoo.org/general-concepts/use-flags/
"The usage of a USE flag should not control runtime dependencies when the package does not link to it. Doing so will create extra configuration for the package and re-compilation for no underlying file change on disk. This should be avoided and instead can be conveyed to the user via post install messages if needed."

I am going to add the pm-utils flag back. I think there is sufficient justification to have the flag and CK is a small enough package that rebuilding is not a big deal.
Comment 26 Michael Palimaka (kensington) gentoo-dev 2016-02-09 05:45:00 UTC
Reopening to make sure updating the powerdevil side is not forgotten.
Comment 27 Michael Palimaka (kensington) gentoo-dev 2016-03-28 14:04:45 UTC
(In reply to Michael Palimaka (kensington) from comment #26)
> Reopening to make sure updating the powerdevil side is not forgotten.

Fixed in git.

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d4ccaaa1b5b79672ff112936ed52f07be89b0442
https://gitweb.gentoo.org/proj/kde.git/commit/?id=fcc7b0d15a3f357fd104ae84dabcb9f5490af36f