Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use Ubuntu 11.10 64 bits with Gnome Shell.
I have opened a bug because sometimes "Close session" and "Shutdown" buttons doesn't work. gnome-session-quit only works sometimes: bug

How can I close the session cleanly from console without gnome-session-quit?

share|improve this question

That should do it for your 'username' session

# pkill -KILL -u username

share|improve this answer
Thanks, but I said "cleanly". To use this, I prefer use the Ctrl+Alt+BackSpace key combination. – Juan Simón Mar 20 '12 at 9:38
well, is it not as clean as "gnome-session-quit"? – cipricus Mar 21 '12 at 14:41

The following command is an alternative for the gnome-session-quit (logout) which should close the session cleanly (not killing the gdm):

dbus-send --session --type=method_call --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.Logout uint32:1.

(it's one line)

share|improve this answer
It works the first time but if I cancel and I try to use it again, it doesn't work. It only shows: method return sender=:1.2 -> dest=:1.6450 reply_serial=2. I think this is related directly with the bug mentioned before. – Juan Simón Mar 20 '12 at 9:35
@Simón Probably gnome-session-quit is executing the above dbus command behind the scenes so you are hitting the same bug. – yossile Mar 20 '12 at 9:44
This answer doesn't work from a terminal not part of the dbus session. How do you set it up so an unrelated terminal can use another dbus environment? – Zan Lynx Feb 14 '13 at 21:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.