Bug 796969 - f17 kde reboot does not work, leads back to kdm
Summary: f17 kde reboot does not work, leads back to kdm
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: kde-workspace
Version: 17
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Than Ngo
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 797168 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-23 23:32 UTC by Reartes Guillermo
Modified: 2012-04-19 01:59 UTC (History)
20 users (show)

Fixed In Version: kde-workspace-4.8.0-12.fc17
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-03-06 20:31:46 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
KDE Software Compilation 293978 0 None None None Never

Description Reartes Guillermo 2012-02-23 23:32:56 UTC
Description of problem:

When in KDE one selects exit > reboot, 
the system does not reboot.

Note: rebooting from KDM itself works.

Version-Release number of selected component (if applicable):

kde-workspace.x86_64                4.8.0-10.fc17           @updates-testing
kde-workspace-libs.x86_64           4.8.0-10.fc17           @updates-testing
libkworkspace.x86_64                4.8.0-10.fc17           @updates-testing

kde-settings-kdm.noarch      4.8-5.fc17         @koji-override-1/$releasever
kdm.x86_64                   4.8.0-10.fc17      @updates-testing  

How reproducible:
allways

Steps to Reproduce:
1. log in
2. exit... > reboot
3. xorg closes, a new kdm appears. 
  
Actual results:
non-tecnical people might find it difficult to reboot the system.
i issue an init 6 from a konsole session, that is not optimal

Expected results:
the system should reboot

Additional info:

Comment 1 Michal Schmidt 2012-02-24 00:43:35 UTC
I can reproduce the problem, but I am seeing no indication of systemd receiving a request to reboot. I can reboot successfully using both logind's and ConsoleKit's D-Bus interfaces. I conclude that the bug is somewhere else than systemd. Reassigning to kde-workspace.

Comment 2 Kevin Kofler 2012-02-24 01:15:46 UTC
KDM uses this code (in the KDM backend, which always runs as root) to shut down or reboot:
https://projects.kde.org/projects/kde/kde-workspace/repository/entry/kdm/backend/dm.c?rev=KDE%2F4.8#L316
where the commands default to the following:
https://projects.kde.org/projects/kde/kde-workspace/repository/revisions/master/entry/kdm/config.def#L41
and we override HaltCmd in kde-settings:
https://fedorahosted.org/kde-settings/browser/trunk/etc/kde/kdm/kdmrc#L140
(because in the past, KDM defaulted to halting rather than powering off; this has changed recently, so I guess we could just use the default).

The /sbin/shutdown and /sbin/poweroff binaries are part of systemd. They always worked in previous releases and KDM did not change.

Comment 3 Kevin Kofler 2012-02-24 01:22:09 UTC
(The default commands used last changed in kde-workspace 4.7's KDM, which just works in Fedora 16. The few lines of code in dm.c haven't changed for ages.)

Comment 4 Michal Schmidt 2012-02-24 02:13:11 UTC
(In reply to comment #2)
> The /sbin/shutdown and /sbin/poweroff binaries are part of systemd. They always
> worked in previous releases and KDM did not change.

The commands work fine.
"/sbin/shutdown -r now" reboots the machine as expected.
Rebooting directly from the KDM screen works fine as well, because it uses the command.
But the command is just not executed when I try to restart from the menu in a KDE session (kickoff button -> Leave -> Restart -> Restart Computer).
I even replaced /sbin/shutdown with a script that logs its execution to verify this.

Comment 5 Kevin Kofler 2012-02-24 02:51:15 UTC
Huh? Shutting down through KDM shouldn't have changed at all between Fedora 16 and 17, why did this work before and not now?

Comment 6 Kevin Kofler 2012-02-24 15:49:26 UTC
*** Bug 797168 has been marked as a duplicate of this bug. ***

Comment 7 Carl G. 2012-02-27 02:14:19 UTC
(In reply to comment #5)
> Huh? Shutting down through KDM shouldn't have changed at all between Fedora 16
> and 17, why did this work before and not now?

Could it be related to SELinux? I do not have a F17 at my disposition to try. Just a guess.

Comment 8 Michal Schmidt 2012-02-27 09:22:13 UTC
No, it's reproducible even with selinux=0.

Comment 9 Michal Schmidt 2012-02-27 09:37:49 UTC
It works with systemd-39, which makes me think that this thread is relevant for kdm:
http://lists.freedesktop.org/archives/systemd-devel/2012-February/004445.html

Comment 10 Martin Krizek 2012-02-27 10:39:34 UTC
I see this issue on my fully updated bare metal F17 machine with kde-workspace 4.8.0-11.fc17 and systemd-43, however on the *same* system in kvm I can't reproduce it.

Comment 11 Martin Kho 2012-02-27 12:57:36 UTC
@Martin,

SELinux-policy version -89 had some sort of 'workaround' (you can also call it a bug) so that rebooting worked as expected. Try running SELinux in permissive mode or disable it and you'll see that you can't directly reboot from within KDE. The reboot option in kdm does work. With version -91 and higher of SELinux direct rebooting is not longer possible.

IMHO I also think that systemd is the culprit and not SELinux.

Martin Kho

Comment 12 Carl G. 2012-02-27 14:28:50 UTC
(In reply to comment #8)
> No, it's reproducible even with selinux=0.

selinux=0 disable selinux, so you might have mislabeled objects now. You should use enforcing=0 (permissive mode) in the future.

Comment 13 Michal Schmidt 2012-02-27 14:32:53 UTC
I am well aware of that, but thanks for your concern.

Comment 14 Michal Schmidt 2012-02-27 14:40:43 UTC
(In reply to comment #11)
> IMHO I also think that systemd is the culprit

We now know that the problem appeared after a change in systemd. What we don't know is whether that change itself is buggy, or whether it merely exposed a latent bug.

This is the change:
http://cgit.freedesktop.org/systemd/systemd/commit/?id=9b221b63e5cc62439b32bb487775856a78c6015a

And I repeat the link to a related discussion on the systemd mailing list:
http://lists.freedesktop.org/archives/systemd-devel/2012-February/004445.html
I admit I don't comprehend that completely.

Comment 15 Martin Krizek 2012-02-27 14:44:14 UTC
(In reply to comment #11)
> ... Try running SELinux in permissive
> mode or disable it and you'll see that you can't directly reboot from within
> KDE...

You're right, I forgot to disable selinux on my VM, sorry about that, please ignore my earlier comment.

Comment 16 Martin Kho 2012-02-27 15:17:14 UTC
Hi,

In a few posts later in the thread that Michal mentioned in comment #14, Lennard says something about the greeter (Lightdm) and it's own PAM session:

"The greeter should have its own PAM session so that systemd-logind know
about it and can rearrange access control to devices such as soundcards
properly, so that screenreaders and event sounds work." [1]

KDM also uses a greeter (kdm_greet), if I'm right. I don't know how kdm_greet is run and if Lennard's remark is relevant for the current issue.

Martin Kho


[1] http://lists.freedesktop.org/archives/systemd-devel/2012-February/004464.html

Comment 17 Kevin Kofler 2012-02-27 17:17:05 UTC
AFAIK, kdm_greet doesn't have its own PAM session, and in fact runs as root by default.

Comment 18 Rex Dieter 2012-02-27 18:11:17 UTC
confirmed the assertion that manually running 'reboot' inside of a kde session, does in fact, not reboot.

Comment 19 Rex Dieter 2012-02-27 18:12:06 UTC
Fwiw, my session ended, but just saw a black screen afterward.

Comment 20 Kevin Kofler 2012-02-27 18:36:54 UTC
Oh, BTW, the reboot in KDM is triggered from the backend, NOT from the greeter.

Comment 21 Michal Schmidt 2012-02-27 19:30:15 UTC
(In reply to comments #18, #19)
> confirmed the assertion that manually running 'reboot' inside of a kde session,
> does in fact, not reboot.
> Fwiw, my session ended, but just saw a black screen afterward.

This may be a different bug. It works for me.

Comment 22 Reartes Guillermo 2012-02-27 20:03:32 UTC
selinux in either enforcing or permissive does not change things, kde still does not reboot.

> confirmed the assertion that manually running 'reboot' inside
> of a kde session,

reboot, executed from konsole does indeed work ok (aka reboot).

Comment 23 Michal Schmidt 2012-02-28 08:47:12 UTC
The process that executes kdm/backend/session.c:manageSession() is the leader process of the logind session.

manageSession() calls:

    blockTerm();
    clientExited();
    unblockTerm();

where clientExited() ends the PAM session.
With the current systemd-logind, ending the PAM session will cause the leader process to be delivered SIGHUP and SIGTERM. The process will die and the remainder of manageSession() will not be executed.

Interestingly, at the end of the function there's a call to sessionExit(), which calls clientExited() again.

Removing the three lines quoted above makes reboot from KDE work again. I haven't noticed any bad effects.

Comment 24 Rex Dieter 2012-02-28 13:13:31 UTC
Thanks Michal!  I'll try patching as suggested (and poke kdm upstream).

Comment 25 Than Ngo 2012-02-28 13:25:25 UTC
Michal, thanks for your good debug analyse,  it's cleary that these code won't work with the change in systemd in comment 16. I don't know which effects could caused with removing above three lines.

But it could be a workaound temporary before we have an correct fix.

Comment 26 Fedora Update System 2012-02-28 14:29:10 UTC
kde-workspace-4.8.0-12.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/kde-workspace-4.8.0-12.fc17

Comment 27 Kevin Kofler 2012-02-28 14:46:58 UTC
Thank you for the analysis and the KDM fix!

However, I think that this is a bug (regression) in systemd, it should not run around killing processes for no reason, the login manager will exit itself! You're still going to unnecessarily kill KDM later on when it calls clientExited(), possibly preventing it from doing cleanups.

Comment 28 Michal Schmidt 2012-02-28 15:04:54 UTC
Lennart,
could you explain the purpose of commit "logind: if we have to stop a session, kill at least its leader"?

Comment 29 Fedora Update System 2012-02-28 20:42:32 UTC
Package kde-workspace-4.8.0-12.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.0-12.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-2639/kde-workspace-4.8.0-12.fc17
then log in and leave karma (feedback).

Comment 30 Harald Hoyer 2012-02-29 18:30:51 UTC
(In reply to comment #27)
> Thank you for the analysis and the KDM fix!
> 
> However, I think that this is a bug (regression) in systemd, it should not run
> around killing processes for no reason, the login manager will exit itself!
> You're still going to unnecessarily kill KDM later on when it calls
> clientExited(), possibly preventing it from doing cleanups.

you can easily catch the SIGTERM and do cleanups afterwards.

Comment 31 Fedora Update System 2012-03-06 20:31:46 UTC
kde-workspace-4.8.0-12.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 32 Michal Schmidt 2012-03-22 17:14:52 UTC
The kdm patch may become unnecessary with this recent change in systemd:

http://cgit.freedesktop.org/systemd/systemd/commit/?id=75c8e3cffd7da8eede614cf61384957af2c82a29

I haven't tested it yet.

Comment 33 Adam Williamson 2012-04-19 01:59:04 UTC
Dropping CommonBugs nomination, as the fix is in Beta.

KDE guys - note in future, bugs of this sort should probably be proposed as Beta blockers, as we have Beta criterion "All release-blocking desktops' offered mechanisms (if any) for shutting down, logging out and rebooting must work".


Note You need to log in before you can comment on or make changes to this bug.