How to restart Gnome Shell after a crash short of killing X?

22,825

Solution 1

I will assume you are running 3.2 Currently due to the obvious bugs the best thing to do is 1 of the following.

The first thing to do is create a seperate profile in whatever terminal you have as default, or whichever it would be if you opened a terminal from your file browsers right click menu. Try to name this profile something you will notice like Restart Shell. In this new profile you want to set it to 'Run a custom command instead of my shell', you would find this in Gnome Terminal under Edit>Profile Preferences>Title and Command. Check the box and insert

gnome-shell --replace

Next do one of the follwing when you run into a crash. Always remember to keep the terminal running once it's open.:

a) Keep a browser open. Example, Firefox is open, no Title Bars and you can't restart, close anything that might be blocking the focus of Firefox. In FF click Tools>Downloads and find a recent download, right click on it and click Open Containing Folder. Now right click and Open in Terminal. It will now either open your default profile or you will right click and select the Restart Shell profile and open a new tab, thus automatically starting a new shell. You must now keep the terminal open.

b) always keep a terminal open. Then when you crash, you just select the alternate profile, and open a new tab which should launch that profile and the command to start a new shell.

c) In empathy and pidgin, perhaps other IM clients as well, type file:/// and hit enter. This will allow you to click the link and should open your file browser(Nautilus). If not, try right clicking on it and selecting the appropriate action. From the browser you open the terminal by right clicking.

All of these options can come in handy and help prevent a lot of frustration. One thing to remember is sometimes to get to the window you need, i.e Firefox, since everything might be blocking focus; File>Exit, should normally do the trick.

Solution 2

I found that all the other ways did not work for me (i.e. those based around gnome-shell --replace).

First, switch to tty1 with ctrl+alt+1, then log in. Use top or htop (or pkill?) to kill gnome-shell (you will probably need to kill with sigkill 9). (You might need to run DISPLAY=:0 gnome-shell, although I usually don't.)

Switch back to the GUI with ctrl+alt+7. (Normally gnome-shell will automatically restart for me.)

Solution 3

Have you tried

DISPLAY=:0 gnome-shell --replace

from a console prompt (see also this answer)?

  • Hit Ctr+Alt+F1
  • Log in
  • Execute DISPLAY=:0 gnome-shell --replace
  • Hit Ctr+Alt+F7
Share:
22,825

Related videos on Youtube

wintercorn
Author by

wintercorn

Updated on September 18, 2022

Comments

  • wintercorn
    wintercorn almost 2 years

    How can I restart Gnome Shell after a crash? Alt+F2 and restart won't work as the prompt crashed with the shell. Since windows focus is gone along with the shell as well, I can't type gnome-shell --replace in a terminal, either. The Ctr+Alt+F1 command line can't open the X display. So I'm left with killing X, thus loosing all open applications. Is there a keyboard shortcut for restarting Gnome Shell?

  • Dan M.
    Dan M. over 4 years
    What if it says Window manager error: Unable to open X display :0?
  • Ronny Andersson
    Ronny Andersson about 4 years
    Try a different value for the display, for example DISPLAY=:1