Add script to unlock a broken session via ConsoleKit.

Authored by tcberner on Jan 7 2018, 5:56 PM.

Diff Detail

R133 KScreenLocker
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
tcberner created this revision.Jan 7 2018, 5:56 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJan 7 2018, 5:56 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
tcberner requested review of this revision.Jan 7 2018, 5:56 PM
graesslin requested changes to this revision.Jan 9 2018, 5:26 AM
graesslin added a subscriber: graesslin.
graesslin added inline comments.

I think this needs to be runtime detected.

This revision now requires changes to proceed.Jan 9 2018, 5:26 AM
tcberner added inline comments.Jan 9 2018, 6:07 AM

So something ala

  • if logingd-runing then logindmessage
  • if consolekit-running then consolekitmessage
  • else falback message
graesslin added inline comments.Jan 9 2018, 6:57 PM

That would be the ultimate solution ;-)

tcberner updated this revision to Diff 26031.Jan 27 2018, 10:16 AM

Use QDbus to query whether ConsoleKit or LoginD is presnet (note, I have not tested LoginD :) )

tcberner added a reviewer: Plasma.
graesslin accepted this revision.Jan 27 2018, 2:19 PM

I like it! Thanks a lot for adding the runtime checking.

This revision is now accepted and ready to land.Jan 27 2018, 2:19 PM
pprkut added a subscriber: pprkut.Jan 27 2018, 2:29 PM
pprkut added inline comments.

Nitpick, but this should probably mention ConsoleKit/ConsoleKit2, not loginctl

adridg added a subscriber: adridg.Jan 27 2018, 5:18 PM
adridg added inline comments.

Drop ".Session", since the service is registered (Manjaro, KDE Neon) as "org.freedesktop.login1".

tcberner updated this revision to Diff 27898.Feb 24 2018, 8:05 AM
  • Fix logind1 dbus path
  • Improve CMakeLists.txt to only display the feature once

On FreeBSD the configure now looks like:

-- Could NOT find loginctl (missing: loginctl_EXECUTABLE) 
-- Found ConsoleKit: /usr/local/bin/ck-list-sessions  
 * prctl/procctl tracing control, Required for disallowing ptrace on greeter and kcheckpass process
 * sys/event.h, Use the kevent() and sigwaitinfo() api for signalhandling
 * XInput, Required for grabbing XInput2 devices in the screen locker
 * Unlock broken screenlocker, Needed for emergency unlock in case that the greeter is broken. In case your distribution does not provide loginctl or consolekit please contact to discuss alternatives.

-- The following OPTIONAL packages have been found:

 * WaylandScanner, Executable that converts XML protocol files to C code, <>
 * PkgConfig

-- The following RECOMMENDED packages have been found:

 * ConsoleKit, Framework for defining and tracking users, <>

Framework for […] tracking users

is a bit of an unfortunate term

pprkut added inline comments.Feb 24 2018, 8:28 AM

It's probably better to refer to here. The freedesktop site doesn't mention ConsoleKit2 anywhere (afaics) and classic freedesktop ConsoleKit is old and doesn't provide the necessary dbus interfaces needed for plasma.

tcberner updated this revision to Diff 27901.Feb 24 2018, 9:05 AM
  • Switch the url to
  • coble together something less "unfortunate" from the official description: ConsoleKit2 is a framework for defining and tracking users, login sessions, and seats.
graesslin accepted this revision.Feb 24 2018, 6:52 PM
This revision was automatically updated to reflect the committed changes.
tcberner marked an inline comment as done.
arfrever added inline comments.

I would suggest that this build-time detection of ConsoleKit occur always, and as a result, that ck-unlock-session be always installed if ConsoleKit is installed.
For example, I have both loginctl and ConsoleKit installed, but loginctl is not running and ConsoleKit is running.
(loginctl is part of systemd whose library functionality can be used by other packages even when systemd is not used as init system.)

graesslin added inline comments.Feb 25 2018, 8:20 PM

You can disable the detection of loginctl through cmake functionality.

We could certainly do that by removing the wrapping if ( NOT HAVE_LOGINCTL ).
Additionally, also the order of the if-branches in abstractlocker.cpp would probably need to be reordered as to prefere login1.