shutdown menu immediately logs out

Bug #399531 reported by Chris Jones
42
This bug affects 5 people
Affects Status Importance Assigned to Milestone
consolekit (Ubuntu)
Fix Released
High
Martin Pitt
Karmic
Fix Released
High
Martin Pitt
gnome-session (Ubuntu)
Fix Released
Medium
Chris Coulson
Karmic
Fix Released
Medium
Chris Coulson

Bug Description

Binary package hint: gnome-session

Fresh install of current amd64 karmic daily-live. Choosing Shutdown from the System menu immediately logs me out and returns me to the GDM screen instead of presenting the suspend/hibernate/reboot/shutdown options.

ProblemType: Bug
Architecture: amd64
Date: Wed Jul 15 00:33:30 2009
DistroRelease: Ubuntu 9.10
Package: gnome-session 2.26.1-1ubuntu2
ProcEnviron:
 PATH=(custom, user)
 LANG=en_GB.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-3.19-generic
SourcePackage: gnome-session
Uname: Linux 2.6.31-3-generic x86_64

Revision history for this message
Chris Jones (cmsj) wrote :
Revision history for this message
Chris Coulson (chrisccoulson) wrote :
Download full text (11.3 KiB)

It looks like gnome-session crashes before showing the dialog:

#0 0x00007f0f8e871d50 in strlen () from /lib/libc.so.6
No symbol table info available.
#1 0x00007f0f8e83a7ce in vfprintf () from /lib/libc.so.6
No symbol table info available.
#2 0x00007f0f8e8eff90 in __vasprintf_chk () from /lib/libc.so.6
No symbol table info available.
#3 0x00007f0f8f53677b in vasprintf (string=0x3c,
    format=<value optimised out>, args=<value optimised out>)
    at /usr/include/bits/stdio2.h:199
No locals.
#4 IA__g_vasprintf (string=0x3c, format=<value optimised out>,
    args=<value optimised out>)
    at /build/buildd/glib2.0-2.21.3/glib/gprintf.c:315
        len = <value optimised out>
        __PRETTY_FUNCTION__ = "IA__g_vasprintf"
#5 0x00007f0f8f522ff0 in IA__g_strdup_vprintf (
    format=0x3c <Address 0x3c out of bounds>, args=0x7fffe88a62c8)
    at /build/buildd/glib2.0-2.21.3/glib/gstrfuncs.c:244
        string = 0x0
#6 0x00007f0f8f52308d in IA__g_strdup_printf (
    format=0x3c <Address 0x3c out of bounds>)
    at /build/buildd/glib2.0-2.21.3/glib/gstrfuncs.c:270
        args = {{gp_offset = 16, fp_offset = 48,
            overflow_arg_area = 0x7fffe88a6380,
            reg_save_area = 0x7fffe88a62c0}}
#7 0x00000000004149e5 in gsm_logout_set_info_text (logout_dialog=0xfa9230,
    seconds=60) at gsm-logout-dialog.c:273
        name = <value optimised out>
        info_text = 0x429c48 "You are currently logged in as \"%s\".\n"
        markup = <value optimised out>
        session_type = 0xef4ad0 ""
        __PRETTY_FUNCTION__ = "gsm_logout_set_info_text"
#8 0x0000000000414c7b in gsm_logout_dialog_show (logout_dialog=0x3c,
    user_data=<value optimised out>) at gsm-logout-dialog.c:212
No locals.
#9 0x00007f0f8f9d662e in IA__g_closure_invoke (closure=0xfb8860,
    return_value=0x0, n_param_values=1, param_values=0xfcf760,
    invocation_hint=0x7fffe88a6510)
    at /build/buildd/glib2.0-2.21.3/gobject/gclosure.c:767
        marshal = 0x3c
        marshal_data = 0x646567676f6c2079
        __PRETTY_FUNCTION__ = "IA__g_closure_invoke"
#10 0x00007f0f8f9ec846 in signal_emit_unlocked_R (node=0xf02360,
    detail=<value optimised out>, instance=<value optimised out>,
    emission_return=<value optimised out>,
    instance_and_params=<value optimised out>)
    at /build/buildd/glib2.0-2.21.3/gobject/gsignal.c:3247
        tmp = 0x7f0f8eb6d5b0
        handler = 0xfcb530
        accumulator = 0x0
        emission = {next = 0x0, instance = 0xfa9230, ihint = {signal_id = 12,
            detail = 0, run_type = G_SIGNAL_RUN_FIRST}, state = EMISSION_RUN,
          chain_type = 4}
        class_closure = 0xf022d0
        handler_list = 0xfcb530
        return_accu = <value optimised out>
        accu = {g_type = 0, data = {{v_int = 0, v_uint = 0, v_long = 0,
              v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0,
              v_double = 0, v_pointer = 0x0}, {v_int = 0, v_uint = 0,
              v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0,
              v_double = 0, v_pointer = 0x0}}}
        signal_id = 12
        max_sequential_handler_number = ...

Changed in gnome-session (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Chris Coulson (chrisccoulson) wrote :
Download full text (3.3 KiB)

There are 2 bugs here. The first one is due to one of our patches to implement a different session dialog, which will cause gnome-session to crash if shutdown is not available. In particular, this bit of gnome-session/gsm-logout-dialog.c:

        switch (logout_dialog->priv->default_response) {
        case GSM_LOGOUT_RESPONSE_LOGOUT:
                info_text = ngettext ("You will be automatically logged "
                                      "out in %d second.",
                                      "You will be automatically logged "
                                      "out in %d seconds.",
                                      seconds);
                break;

        case GSM_LOGOUT_RESPONSE_SHUTDOWN:
                info_text = ngettext ("This system will be automatically "
                                      "shut down in %d second.",
                                      "This system will be automatically "
                                      "shut down in %d seconds.",
                                      seconds);
                break;

        case GTK_RESPONSE_CANCEL:
                info_text = _("You are currently logged in as \"%s\".\n"); ****GOES WRONG HERE****
                break;

        default:
                g_assert_not_reached ();
        }

        if (session_type == NULL) {
  GsmConsolekit *consolekit;

                consolekit = gsm_get_consolekit ();
                session_type = gsm_consolekit_get_current_session_type (consolekit);
                g_object_unref (consolekit);
        }

        if (g_strcmp0 (session_type, GSM_CONSOLEKIT_SESSION_TYPE_LOGIN_WINDOW) != 0) {
                char *name, *buf, *buf2;
                name = g_locale_to_utf8 (g_get_real_name (), -1, NULL, NULL, NULL);

                if (!name || name[0] == '\0' || strcmp (name, "Unknown") == 0) {
                   name = g_locale_to_utf8 (g_get_user_name (), -1 , NULL, NULL, NULL);
                }

                if (!name) {
                        name = g_strdup (g_get_user_name ());
                }

                buf = g_strdup_printf (_("You are currently logged in as \"%s\"."), name);
                buf2 = g_strdup_printf (info_text, seconds); ****CRASHES HERE****
                markup = g_markup_printf_escaped ("<i>%s</i>", g_strconcat (buf, "\n", buf2, NULL));
                g_free (buf);
                g_free (buf2);
                g_free (name);

I think that looks like the first bug.

The default_response is earlier set to GTK_RESPONSE_CANCEL (when it would normally be GTK_RESPONSE_SHUTDOWN) because this fails:

                if (!gsm_logout_supports_shutdown (logout_dialog)) {
                        gtk_widget_set_sensitive (tile, FALSE);
                        /* If shutdown is not available, let's just fallback
                         * on cancel as the default action. We could fallback
                         * on reboot first, then suspend and then hibernate
                         * but it's not that useful, really */
                        logout_dialog->priv->default_response = GTK_RESPONSE_CANCEL;
                }

The reason for this is because in gsm_c...

Read more...

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Subscribing pitti - I'm not sure if the consolekit part is related to the polkit-1 migration, I've not had a chance to look at it further yet.

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Right, it seems CanStop needs explicitly allowing in /etc/dbus-1/system.d/ConsoleKit.conf

Changed in consolekit (Ubuntu):
importance: Undecided → High
status: New → Triaged
Changed in gnome-session (Ubuntu):
importance: High → Medium
status: Confirmed → Triaged
Revision history for this message
Sebastien Bacher (seb128) wrote :

don't use the title to specify the version you are using it create extra work and confusion when next version opens

summary: - [karmic] shutdown menu immediately logs out
+ shutdown menu immediately logs out
Changed in consolekit (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
Revision history for this message
Martin Pitt (pitti) wrote :

Ah, that worked fine when I tested the polkit-1-ified consolekit. I guess the new gnome-session uses the CanStop API now. Thanks, Chris, for figuring this out!

Revision history for this message
Martin Pitt (pitti) wrote :

I updated the CK polkit patch to allow CanStop/CanRestart, and tested with d-feet that this actually works now. Patch sent to upstream (https://bugs.freedesktop.org/show_bug.cgi?id=22178).

However, I didn't upload it since it aggravates the situation: now most programs don't even start any more, and gnome-session crashes immediately. It seems we need to fix gnome-session's usage of can_stop() first before we can upload the CK fix.

Changed in consolekit (Ubuntu):
status: Triaged → Fix Committed
Changed in gnome-session (Ubuntu Karmic):
importance: Medium → High
Revision history for this message
Martin Pitt (pitti) wrote :

Chris said he'd look into this.

Changed in gnome-session (Ubuntu Karmic):
assignee: nobody → Chris Coulson (chrisccoulson)
importance: High → Medium
tags: added: regression-potential
Changed in gnome-session (Ubuntu Karmic):
status: Triaged → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnome-session - 2.26.2-1ubuntu3

---------------
gnome-session (2.26.2-1ubuntu3) karmic; urgency=low

  * debian/patches/20_polkit1.patch:
    - Change to not crash in gsm_consolekit_can_{stop,restart}
      funtions.
  * debian/patches/19_gnome-wm-tweaking.patch:
    - Don't start gtk-window-decorator before Compiz. This is
      not necessary as Compiz will start it anyway, and running
      it on some setups that don't support compositing can cause
      issues, as it bypasses all the sanity checks that Compiz
      normally does.
  * debian/patches/80_new_upstream_session_dialog.patch:
    - Change to not crash when ConsoleKit tells us we can't stop or
      restart the machine, or if ConsoleKit is not contactable
      (LP: #399531).

 -- Chris Coulson <email address hidden> Wed, 15 Jul 2009 20:19:35 +0100

Changed in gnome-session (Ubuntu Karmic):
status: In Progress → Fix Released
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

gnome-session will no longer crash now. However, you will currently be presented with a session dialog where the shutdown and restart options are greyed out when you select Shutdown from the system menu.

Martin,

It should be safe to upload the ConsoleKit change now.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package consolekit - 0.3.0-2ubuntu6

---------------
consolekit (0.3.0-2ubuntu6) karmic; urgency=low

  * Drop 04-consolekit_park.patch: Not necessary with new gdm any more.
  * Rename patches which are in upstream git now:
    - 05-dbus_policy.patch → 00git-dbus_policy.patch
    - 05-pam-add-nox11.patch → 00git-pam-add-nox11.patch
    - 08-fix-double-close.patch → 00git-fix-double-close.patch
    - 09-directory-handle-leak.patch → 00git-directory-handle-leak.patch
    - 10-file_monitor_remove_watch_crash.patch → 00git-file_monitor_remove_watch_crash.patch
    - 11-unref-dbus-proxy.patch → 00git-unref-dbus-proxy.patch
  * 12-allow-get-sessions.patch: Add upstream bug link.
  * 07-polkit1.patch: Allow CanRestart and CanStop in D-BUS policy. (LP: #399531)

 -- Martin Pitt <email address hidden> Wed, 15 Jul 2009 11:45:56 +0200

Changed in consolekit (Ubuntu Karmic):
status: Fix Committed → Fix Released
Revision history for this message
Marcerino (mastervanleeuwen) wrote :

I still have this or a similar issue with today's Karmic. If I choose 'shutdown' from the session menu, I am logged out, but the computer does not shut down.

In the daemon.log, I get the following message:
Oct 27 23:26:02 purple gnome-session[1849]: WARNING: Unable to stop system: Not privileged for action: org.freedesktop.consolekit.system.stop no

So it seems to be an issue with permissions inside gnome. Not sure where to change the setting, though. Any ideas?

consolekit version: 0.3.1-0ubuntu2
gnome-session: 2.28.0-0ubuntu5

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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