Bug 788171

Summary: Port shutdown/restart code from ConsoleKit to systemd
Product: [Fedora] Fedora Reporter: Kevin Kofler <kevin>
Component: kde-workspaceAssignee: Kevin Kofler <kevin>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: rawhideCC: alekcejk, jreznik, kevin, ltinkl, marcosfrm, rdieter, rnovacek, than
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: kde-workspace-4.8.1-6.fc17 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-03-21 18:39:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 786157    
Attachments:
Description Flags
First (UNTESTED) attempt at a patch for shutdown, restart and session switch using systemd
none
patch for shutdown (tested working), restart (tested working) and session switch (needs testing/fixing) using systemd none

Description Kevin Kofler 2012-02-07 16:07:56 UTC
The shutdown/restart code for the non-KDM case (in particular, for GDM users) is based on ConsoleKit right now, and should be ported to systemd.

Comment 1 Kevin Kofler 2012-03-01 06:35:58 UTC
Created attachment 566758 [details]
First (UNTESTED) attempt at a patch for shutdown, restart and session switch using systemd

So I have tried (hopefully successfully) to implement support for systemd instead of ConsoleKit in the KDE Plasma workspaces (kde-workspace).

Shutdown and restart were fairly straightforward, I'm fairly confident those work; if not, it must be some trivial mistake. Session switching, on the other hand, is much more complicated, I didn't write the original code for that part, and the API is quite different (using D-Bus properties rather than methods, annoyingly with structure types).

Pass -DKWORKSPACE_USE_SYSTEMD:BOOL=ON to CMake to enable this.

I haven't yet tested whether this compiles, runs, crashes, burns, eats kittens, … ;-)

Comment 2 Rex Dieter 2012-03-12 15:05:55 UTC
I'll try testing this out today

Comment 3 Rex Dieter 2012-03-12 15:28:21 UTC
[  2%] Building CXX object libs/kworkspace/CMakeFiles/kworkspace.dir/kdisplaymanager.o
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp: In function ‘bool getCurrentSeat(QDBusObjectPath*, QDBusObjectPath*)’:
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:342:61: error: no matching function for call to ‘SystemdSession::property(QLatin1String)’
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:342:61: note: candidate is:
/usr/include/QtCore/qobject.h:259:14: note: QVariant QObject::property(const char*) const
/usr/include/QtCore/qobject.h:259:14: note:   no known conversion for argument 1 from ‘QLatin1String’ to ‘const char*’
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp: In function ‘QList<QDBusObjectPath> getSessionsForSeat(const QDBusObjectPath&)’:
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:376:61: error: no matching function for call to ‘SystemdSeat::property(QLatin1String)’
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:376:61: note: candidate is:
/usr/include/QtCore/qobject.h:259:14: note: QVariant QObject::property(const char*) const
/usr/include/QtCore/qobject.h:259:14: note:   no known conversion for argument 1 from ‘QLatin1String’ to ‘const char*’
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:381:33: error: ‘class QList<NamedDBusObjectPath>’ has no member named ‘path’
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:380:208: warning: unused variable ‘namedPath’ [-Wunused-variable]
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp: In function ‘void getSessionLocation(SystemdSession&, SessEnt&)’:
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:406:51: error: no matching function for call to ‘SystemdSession::property(QLatin1String)’
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:406:51: note: candidate is:
/usr/include/QtCore/qobject.h:259:14: note: QVariant QObject::property(const char*) const
/usr/include/QtCore/qobject.h:259:14: note:   no known conversion for argument 1 from ‘QLatin1String’ to ‘const char*’
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:407:74: error: no matching function for call to ‘SystemdSession::property(QLatin1String)’
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:407:74: note: candidate is:
/usr/include/QtCore/qobject.h:259:14: note: QVariant QObject::property(const char*) const
/usr/include/QtCore/qobject.h:259:14: note:   no known conversion for argument 1 from ‘QLatin1String’ to ‘const char*’
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:408:49: error: no matching function for call to ‘SystemdSession::property(QLatin1String)’
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:408:49: note: candidate is:
/usr/include/QtCore/qobject.h:259:14: note: QVariant QObject::property(const char*) const
/usr/include/QtCore/qobject.h:259:14: note:   no known conversion for argument 1 from ‘QLatin1String’ to ‘const char*’
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp: In member function ‘bool KDisplayManager::isSwitchable()’:
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:556:70: error: no matching function for call to ‘SystemdSeat::property(QLatin1String)’
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:556:70: note: candidate is:
/usr/include/QtCore/qobject.h:259:14: note: QVariant QObject::property(const char*) const
/usr/include/QtCore/qobject.h:259:14: note:   no known conversion for argument 1 from ‘QLatin1String’ to ‘const char*’
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp: In member function ‘bool KDisplayManager::localSessions(SessList&)’:
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:627:62: error: no matching function for call to ‘SystemdSession::property(QLatin1String)’
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:627:62: note: candidate is:
/usr/include/QtCore/qobject.h:259:14: note: QVariant QObject::property(const char*) const
/usr/include/QtCore/qobject.h:259:14: note:   no known conversion for argument 1 from ‘QLatin1String’ to ‘const char*’
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:628:74: error: no matching function for call to ‘SystemdSession::property(QLatin1String)’
/home/rdieter1/pkgs.fedoraproject.org/kde-workspace/kde-workspace-4.8.1/libs/kworkspace/kdisplaymanager.cpp:628:74: note: candidate is:
/usr/include/QtCore/qobject.h:259:14: note: QVariant QObject::property(const char*) const
/usr/include/QtCore/qobject.h:259:14: note:   no known conversion for argument 1 from ‘QLatin1String’ to ‘const char*’
make[2]: *** [libs/kworkspace/CMakeFiles/kworkspace.dir/kdisplaymanager.o] Error 1
make[1]: *** [libs/kworkspace/CMakeFiles/kworkspace.dir/all] Error 2

Comment 4 Rex Dieter 2012-03-13 20:57:16 UTC
update, kde-workspace-4.8.1-4 builds, and does show shutdown/restart kickoff->leave menu items.  unfortunately selecting either only takes you back to kdm login screen.  switch user seems to only lock the screen atm too.

Comment 5 Fedora Update System 2012-03-14 14:46:45 UTC
kde-workspace-4.8.1-5.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/kde-workspace-4.8.1-5.fc17

Comment 6 Kevin Kofler 2012-03-14 23:02:59 UTC
Created attachment 570119 [details]
patch for shutdown (tested working), restart (tested working) and session switch (needs testing/fixing) using systemd

For reference, I'm attaching the version of the patch we're now using.

User switching still needs testing and probably fixing.

Comment 7 Fedora Update System 2012-03-16 02:40:47 UTC
Package kde-workspace-4.8.1-5.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing kde-workspace-4.8.1-5.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-3800/kde-workspace-4.8.1-5.fc17
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2012-03-16 19:03:54 UTC
Package kde-workspace-4.8.1-6.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing kde-workspace-4.8.1-6.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-3800/kde-workspace-4.8.1-6.fc17
then log in and leave karma (feedback).

Comment 9 Fedora Update System 2012-03-21 18:39:50 UTC
kde-workspace-4.8.1-6.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.