5

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?

5 Answers 5

5

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.)

5

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.

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
2
  • What if it says Window manager error: Unable to open X display :0?
    – Dan M.
    Mar 2, 2020 at 12:12
  • Try a different value for the display, for example DISPLAY=:1 Apr 15, 2020 at 10:42
0

There is not a keyboard shortcut for restarting Gnome Shell.
But you can assign a shortcut for gnome-shell --replace command.
This will be very useful, but sometimes killing X is the only solution about Shell crash.

0

If you have an ssh server installed this can also be done over an ssh connection, just log in and run

DISPLAY=:0 gnome-shell --replace

You might have to select another value for the display, for example DISPLAY=:1

DISPLAY=:1 gnome-shell --replace

One thing to keep in mind now is that the process is now attached to the current terminal, so you might want to experiment with nohup and detach with &. But if you just want to salvage a bad situation it might be ok to be connected so you can save and shutdown the gnome session or reboot in a controlled manner.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .