2

I'm having a problem similar to here, where my dash and top panel won't load.

When trying to logout from a terminal (since there is no top menu bar to use) but I get this error:

~$ gnome-session-quit

** (gnome-session-quit:6288): WARNING **: Failed to call logout: GDBus.Error:org.gnome.SessionManager.NotInRunning: Logout interface is only available during the Running phase

Is there another way for me to logout when this happens, other than rebooting the computer?

1

Not elegant, but you could try this:

ps -wweo pid,args | grep gnome | grep -v grep

That will give you AT LEAST one line of output. Each line will be the process id number followed by one space, followed by the exact and full command string that started the process. You can probably tell which (assuming there is more than one) process is the gnome session and kill it this:

kill NUMBER

or if that complains about permissions (but I don't think it will)

sudo kill NUMBER

where NUMBER is the process id number that the ps command showed you.

If this happens a lot, you can change the second grep so that it looks for an exact match on the entire command string so that it shows only the one process you want to kill. That will be the string following the process id number on the line corresponding to the gnome session in the output of

ps -wweo pid,args | grep gnome | grep -v grep

I can't tell you what it will be because I don't use gnome and I'm not certain every gnome system would use exactly the same string anyway. There may be some options that vary. Put that string in a script that extracts the process number and kills it. Like this:

#!/bin/bash
PID_to_kill=$(ps -wweo pid,args | grep "ENTIRE COMMAND STRING GNOME IS STARTED WITH" | grep -v grep | cut -d' ' -f1)    
kill $PID_to_kill

By using the entire command string, you remove any possibility of killing some process you really didn't want to kill, just because it had "gnome" as part of the command string that started it.

Name the script something easy to remember like "killgnome". Put it in a directory on your path. "/usr/local/bin/" would be a fairly conventional place. Make it executable. Invoke it by entering its name in a terminal or run box.

This will log you out and take you back to your "display manager" (the gui login dialog) if you have one. If you're not running a default setup and have eschewed a display manager (they are really totally unnecessary) it stops X also, leaving you a login prompt. Or at least that's the way it works with Openbox. Probably the way they all work.

2
  • pgrep gnome, pkill gnome
    – muru
    May 18 '17 at 5:39
  • Good point, muru. Shouldn't need "sudo". I edited my post to indicate that. May 18 '17 at 14:29
5

What about sudo service lightdm restart ?

This should stop the display manager, effectively login you out, start lightdm again and you should be on the login screen in no-time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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