"Restart" and "Shut Down" don't work if anyone else is logged in

Bug #855556 reported by Matthew Paul Thomas on 2011-09-21
114
This bug affects 23 people
Affects Status Importance Assigned to Milestone
Session Menu
Confirmed
High
Unassigned
casper (Ubuntu)
Undecided
Unassigned
gnome-session (Ubuntu)
High
Unassigned
indicator-session (Ubuntu)
High
Unassigned

Bug Description

gnome-session 3.1.91-0ubuntu2, lightdm 0.9.7-0ubuntu1, indicator-session 0.3.5.1-0ubuntu1, Ubuntu 11.10 beta

1. Start up the computer.
2. At the login screen, choose "Restart", and confirm it.
3. Log in.
4. From the device menu, choose "Restart", and confirm it.
5. Log in again.
6. Switch to a guest session.
7. Switch back to your user account.
8. From the device menu, choose "Restart", and confirm it.
9. From the login screen, choose "Restart", and confirm it.

What happens:
2. The computer restarts.
4. The computer restarts.
8. Ubuntu returns to the login screen.
9. Nothing at all.

What should happen:
2. The computer restarts.
4. The computer restarts.
8. The computer restarts.
9. The computer restarts.

The same problem happens with "Shut Down". At a terminal, "sudo reboot" and "sudo shutdown" work as expected.

See also bug 838792, where "Restart" logs out with no-one else logged in (that bug does not occur for me). While testing this bug I also triggered bug 740382.

Related branches

description: updated
Sebastien Bacher (seb128) wrote :

Thanks Matthew, some questions for you:

- should something warn you that other users are logged in before doing the restart or shutdown?
- should non-admin user be allow to shutdown the machine when other sessions are active?
- what should happen if the user who wants to shutdown is not authorized the close other user sessions?

Changed in gnome-session (Ubuntu):
status: New → Confirmed
importance: Undecided → High
Matthew Paul Thomas (mpt) wrote :

Huh, I assumed this was just a regression, not something that would need design work.

The design is fairly simple, though it would require one new string. There should be a PolicyKit permission for shutting down (including restarting) while other people are logged in, and only admins should have it. So if you choose either command while other accounts are logged in, you should get a PolicyKit dialog saying "Other user accounts are logged in. Shutting down before they log out may cause them to lose work. To continue, you need to authenticate."

That would answer all three questions: the dialog would be the thing warning you, if you weren't an admin you'd need an admin to authenticate for you, and that means the dialog could appear regardless of whether the active user account is an admin.

Sebastien Bacher (seb128) wrote :

if you aren't an admin and not allow to take down other users' session what should happen? should restart and shutdown just log out? or display a dialog? or not be enabled in the indicator to indicate you can't do those?

Chris Coulson (chrisccoulson) wrote :

The original plan a couple of years ago to fix this properly was to have a new shutdown API in Consolekit which the sessions of all logged in users could interact with to ensure a clean shutdown for all users, and allow other sessions to inhibit shutdown if the user had unsaved work or etc (and also provide a way for system jobs such as software updates to inhibit shutdown). This never materialized though, and I guess that there is little motivation for fixing this in consolekit / gnome-session now with all these being eventually replaced by systemd.

Some background info:

http://mail.gnome.org/archives/gdm-list/2009-June/msg00007.html
https://bugs.freedesktop.org/show_bug.cgi?id=24493

Matthew Paul Thomas (mpt) wrote :

Sebastian, as I said, if you weren't an admin you'd need an admin to authenticate for you, so the dialog could appear regardless of whether the active user account is an admin.

Chris, software installation/removal inhibiting shutdown is discussed in bug 842799.

harriv (harriv) wrote :

Local user should be able to shutdown even when not admin, otherwise she will use power button..

Tim Cole (tcole) wrote :

Until this is sorted out properly, it would be nice if the user at least got feedback as to why the shutdown/restart attempt failed.

sit0yen (sit0yen) wrote :

There is no sense in preventing non admin users from shutting down the computer since local users may force shutdown.
A least, there could be a prompt for admin password in order to force all users logout before shutdown.

Morten Siebuhr (msiebuhr) wrote :

Combined with bug874870 (user-switching fails for some reason; https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/874872), this makes LightDM useless for all but the inital login for me. I AM the admin, but when I can't even log into my own session, I'm only left with doing hard-resets.

Ubuntu QA Website (ubuntuqa) wrote :

This bug has been reported on the Ubuntu ISO testing tracker.

A list of all reports related to this bug can be found here:
http://iso.qa.ubuntu.com/qatracker/reports/bugs/855556

tags: added: iso-testing
Bilal Akhtar (bilalakhtar) wrote :

This isn't an issue with indicator-session, but with either lightdm or gnome-session.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in lightdm (Ubuntu):
status: New → Confirmed
affects: indicator-session (Ubuntu) → lightdm (Ubuntu)
Changed in indicator-session:
status: New → Incomplete
status: Incomplete → Invalid
Doug McMahon (mc3man) wrote :

Well if the intention is to allow the admin (group:sudo in 12.04) to be able to do this then why not just add a .pkla for consolekit?

Seems quite similar to 'indicatorcpufreqselector' which has been handled that way when polkit's auth_admin_keep was ineffectual

Changed in indicator-session:
status: Invalid → New
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Sebastien Bacher (seb128) wrote :

Bilal, lightdm has nothing to do with that, indicator-session is used, the issue is mostly with gnome-session,consolekit but indicator-session since it's what handle the logout dialog could help messaging that somebody else is logged in

Changed in indicator-session (Ubuntu):
status: New → Confirmed
Sebastien Bacher (seb128) wrote :

@Doug: I doubt we want shutdown to log out all active sessions without asking for confirmation first, it would be too easy to misclick and take sessions down that you didn't notice were running and that you didn't want to stop in this case

affects: lightdm (Ubuntu) → indicator-session (Ubuntu)
Robert Ancell (robert-ancell) wrote :

@Bilal, also please assign bugs with the greeter to the unity-greeter package as that is the most likely location of the problem. We'll reassign them to LightDM if the problem turns out to be from there.

Changed in indicator-session:
status: New → Confirmed
Changed in indicator-session (Ubuntu):
status: New → Confirmed
Changed in indicator-session:
importance: Undecided → High
Changed in indicator-session (Ubuntu):
importance: Undecided → High
Ernst Sjöstrand (ernstp) wrote :

The temporary workaround is to edit /usr/share/polkit-1/actions/org.freedesktop.consolekit.policy (every time it's updated)
and in org.freedesktop.consolekit.system.restart-multiple-users and org.freedesktop.consolekit.system.stop-multiple-users set <allow_active>yes</allow_active>

Alex Chiang (achiang) wrote :

The merge proposal I submitted above (https://code.launchpad.net/~achiang/ubuntu/quantal/casper/bug-855556/+merge/106476) is a minimal fix to allow shutdown/restart to work from the Unity greeter during a live session.

I don't think it fixes the general case mpt is talking about in the original description, but my patch is a small step in the right direction.

Stéphane Graber (stgraber) wrote :

Adding a casper task to be closed by the change proposed by Alex.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package casper - 1.317

---------------
casper (1.317) quantal; urgency=low

  * scripts/casper-bottom/44pk_allow_ubuntu: grant admin polkit privileges
    to lightdm user, which enables restart and shutdown from the greeter
    (LP: #855556)
 -- Alex Chiang <email address hidden> Tue, 22 May 2012 11:32:24 -0400

Changed in casper (Ubuntu):
status: New → Fix Released
mindbox (mindbox) wrote :

So, this bug is still active and only fixed for live sessions, right?

Besides, isn't it a duplicate of #861171?

Workaround:

Edit the file /usr/share/polkit-1/actions/org.freedesktop.consolekit.policy using your favorite text editor. You will need root permissions.

Change the section relating to shutdown when others are logged in from

  <action id="org.freedesktop.consolekit.system.stop-multiple-users">
    <description>Stop the system when multiple users are logged in</description>
    <message>System policy prevents stopping the system when other users are logged in</message>
    <defaults>
      <allow_inactive>no</allow_inactive>
      <allow_active>auth_admin_keep</allow_active>
    </defaults>
  </action>

to

  <action id="org.freedesktop.consolekit.system.stop-multiple-users">
    <description>Stop the system when multiple users are logged in</description>
    <message>System policy prevents stopping the system when other users are logged in</message>
    <defaults>
      <allow_inactive>no</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>
  </action>

and the section relating to rebooting when others are logged in from

  <action id="org.freedesktop.consolekit.system.restart-multiple-users">
    <description>Restart the system when multiple users are logged in</description>
    <message>System policy prevents restarting the system when other users are logged in</message>
    <defaults>
      <allow_inactive>no</allow_inactive>
      <allow_active>auth_admin_keep</allow_active>
    </defaults>
  </action>

to

  <action id="org.freedesktop.consolekit.system.restart-multiple-users">
    <description>Restart the system when multiple users are logged in</description>
    <message>System policy prevents restarting the system when other users are logged in</message>
    <defaults>
      <allow_inactive>no</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>
  </action>

And that will allow you (any user) shutdown and reboot the PC when multiple users are logged in. Whether you want to do that is a different question.

Source: http://askubuntu.com/questions/1190/how-can-i-make-shutdown-not-require-admin-password

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.