FS#32544 - [systemd] reboot/poweroff does not work correctly

Attached to Project: Arch Linux
Opened by Bernhard Koenig (Antunes) - Thursday, 08 November 2012, 12:57 GMT
Last edited by Dave Reisner (falconindy) - Friday, 09 November 2012, 17:57 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Dave Reisner (falconindy)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description: systemd will often think that other users are logged in when they are not. This happens when some other user has been logged in before. I get this message:

systemctl reboot
==== AUTHENTICATING FOR org.freedesktop.login1.reboot-multiple-sessions ===
Authentication is required for rebooting the system while other users are logged in.



Additional info:
* package version(s)
* config and/or log files etc.


Steps to reproduce:
1) Login as user #1
2) Logout as user #1
3) Login as user #2
4) try "systemctl reboot"
It will say that user #1 is still logged in.
This task depends upon

Closed by  Dave Reisner (falconindy)
Friday, 09 November 2012, 17:57 GMT
Reason for closing:  Won't fix
Additional comments about closing:  Working as intended. Commands follow policy which is configurable -- not the commands.
Comment by Dave Reisner (falconindy) - Thursday, 08 November 2012, 23:59 GMT
Sounds like working as intended. Look at the output of 'loginctl'. The default behavior (by pam_systemd) is that processes left running by a user session are not forcibly killed on logout.
Comment by Bernhard Koenig (Antunes) - Friday, 09 November 2012, 12:07 GMT
It is different from the earlier behavior and it means that I cannot shutdown my system without root privileges (just because some other user was logged in before).

Please note: there are two users, one is logged out, but the system thinks he is still logged in. I think this is not expected.
Comment by Dave Reisner (falconindy) - Friday, 09 November 2012, 13:53 GMT
and the output of loginctl....
Comment by Bernhard Koenig (Antunes) - Friday, 09 November 2012, 13:54 GMT
After googling a little on the issue, I think I see the problem now. Would it not be possible to add an option to systemctl to override the password authentication in case earlier users are logged out by now?

Please note that this issue is important for graphical user shutdown menus. They will not work if there is a password query.
Comment by Bernhard Koenig (Antunes) - Friday, 09 November 2012, 13:55 GMT
Sorry, yes output is

loginctl
SESSION UID USER SEAT
1 1000 bernhard seat0
3 1001 bkoenig seat0
4 1000 bernhard seat0

3 sessions listed.

I switch back and forth between two sessions and it lists all earlier sessions.
Comment by Dave Reisner (falconindy) - Friday, 09 November 2012, 14:02 GMT
Right, so this is working as intended.

> Would it not be possible to add an option to systemctl to override the password authentication in case earlier users are logged out by now?
If "earlier users" weren't logged in, you wouldn't have this problem. The check is done at the time of the reboot/shutdown request.

This isn't related to what systemctl can do, or should do. If you want to override the check for other users, then write a polkit rule for the policy file /usr/share/polkit-1/actions/org.freedesktop.login1.policy.
Comment by Bernhard Koenig (Antunes) - Friday, 09 November 2012, 16:14 GMT
Thank you very much for your help and I don't want to bug you but I am still wondering: which command would one use to reboot/shutdown without root privileges in this case? I think there should be way because graphical session menus depend on it.

I can see now that changing the rules in polkit is a way but that would require rewriting a system file. There must be an easier way. Please note that the old way was this: https://wiki.archlinux.org/index.php/ConsoleKit#Use_D-Bus_for_power_operations

And that worked without root privileges, even if other users were logged in before.
Comment by Dave Reisner (falconindy) - Friday, 09 November 2012, 16:22 GMT
Again, you need to override policy for the action that's being triggered. From org.freedesktop.login1.policy:

<action id="org.freedesktop.login1.reboot-multiple-sessions">
<description>Reboot the system while other users are logged in</description>
<message>Authentication is required for rebooting the system while other users are logged in.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>

Compare this to simple 'reboot' (without multiple-sessions) and note that allow_active is set to 'yes' rathe than 'auth_admin_keep'.
Comment by Bernhard Koenig (Antunes) - Friday, 09 November 2012, 16:25 GMT
Yes, I saw that. But to give you an example. What do I put in the oblogout or the gnome session menu to work? And I don't want to have to change a system file for that.

I think there are bugs on that, e.g. https://bugs.archlinux.org/task/32379
Comment by Dave Reisner (falconindy) - Friday, 09 November 2012, 16:44 GMT
You're conflating multiple problems.

1) gnome-session will just work, since it's logind aware. If you want to change the behavior so that requesting a reboot via gnome-session works, then for the third time: modify policy. You can't avoid this. Add your own override in /etc/polkit-1/rules.d
2) oblogout is an entirely separate issue because it expects consolekit to be available. Since it isn't, it needs to be adapted to make a dbus call to logind instead. Of course, if you want that to be capable of working without a password even with other users logged in, you need to modify policy.

Off the top of my head, to reboot via a dbus call to login1 is something like:

dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Reboot true

But this has nothing to do with this bug report.
Comment by Bernhard Koenig (Antunes) - Friday, 09 November 2012, 17:53 GMT
Well OK, sorry to bug you. I understand that modifying policy is an option. But I also told you why this is not a perfect solution.

I still believe the current behavior is unexpected and I currently see no way to reconfigure power managers under systemd (like oblogout, didn't test GNOME3) to get back their old functionality. Googling the internet, there are many bug reports on this and there will be even more when other distros switch to systemd.

Loading...