You Got A Question? Ask    GNOME Community!

How to restart GNOME Shell when freezes – if ever ;)

This post was made with an older stylesheet

Replacing GNOME Shell within GNOME Session

In case that GNOME Shell starts to go slow you might want to replacing/restart it.

The easiest way is to  <ALT+F2> + “r”


You can also do that from a terminal:

$ gnome-shell -r (--replace)

Notice that if you restart GS within a Terminal, if you close the Terminal you will actually kill GS :)

Replacing GNOME Shell from Console

Sometimes Shell can completely crash like the figure bellow..


In this case we can’t either <ALT+F2> or write on Gnome Terminal -if we had one open. We could restart the PC or GDM from our Console, but this will close all our windows and we might lose some work.

Instead we can try to replace GNOME Shell from the Console. Press <Ctrl+Alt+F2> to go in your TTY2. Login and then type:

$ gnome-shell --replace

That will output you a message that gnome-shell cannot open display, or something like that. So we need to run this for the current X Display. Type again:

$ DISPLAY=:0 gnome-shell --replace

This will export DISPLAY variable to 0 for the current command only. Notice that “0” is the display that Fedora uses. Ubuntu uses 6 or 7. So you can now restart Shell without lose any time by restarting the whole system ;)

Restarting GDM

To restart GDM you can either from your Console

$ sudo service gdm start|stop|restart

for Arch

$ sudo systemctl start|stop|restart gdm

or just kill it and it will auto-restart

$ sudo killall -9 gdm or gdm-binary

  We can't watch comments unless G+ provides an API or if you send a notification, e.g +World Of Gnome
     Sometimes is better to place your questions on GNOME Community
  • Adrià Arrufat

    Nice tip to avoid a reboot. However, for systemd users (at least in Arch), the command translates to:
    sudo systemctl restart gdm

    • alex285

      Thanks, I added that!

    • Luya Tshimbalanga

      Also valid for soon to be released Fedora 18.

  • chrys

    I just type killall -9 gnome-shell it seem st start the shell again after kill

    • alex285

      aha, I didn’t know that. But if Shell crashes you can’t actually kill it, because it isn’t running :)

    • Žygintas Beručka

      Good for you, for me it doesn’t. Ubuntu 12.10 here. So I just switch to a console with Ctrl+Alt+F1 or F2 or whatever, login and then do `gnome-shell –replace -d :0.0′. (However, sometimes I need to use -d :0.1 or even -d :0.2 as a display, in case it says that it cannot open one on :0.0.)

      I wonder if it’s possible to set some keyboard shortcut that would replace the hanged instance of gnome-shell with a fresh one while being _in_ GNOME without the need to fallback to the console.

      • Adonis K. (Varemenos)

        “I wonder if it’s possible to set some keyboard shortcut that would
        replace the hanged instance of gnome-shell with a fresh one while being
        _in_ GNOME without the need to fallback to the console.”

        create an .sh file with the command

        add that .sh file as the command argument in a custom shortcut


        • alex285

          You can’t use the shortcuts if Shell is not running!

    • chrys

      I type it in the TTY ;), not in the Gnome-shell. I use Fedora 17.

  • Bastian Hougaard

    Thanks for this article – I always wondered how to act when gnome-shell froze, and now i know. :)

  • Adonis K (Vαяēмēиøš)

    sudo service gdm restart?

    • alex285

      F1 is used as the X Server display in some distros. That is why I used F2. But what is the question?

  • Philip Witte

    Wow, awesome! Thanks so much. Gnome has completely locked up on me a couple of times in the past, and I’ve never been able to fix it from a different TTY. That ‘DISPLAY=:0…’ looks like exactly what I was missing. Great!

  • António Fernandes

    Oh, so that is how you tell it about the display form another tty. I looked everywhere for that and didn’t find it. Thanks for sharing the tip.

    • alex285

      More over you can start another session like that in another display. DISPLAY=:2 gdm or lightdm. So you can run unity and gnome at the same time.. There isn’t a reason to do that, but you can :)

  • Jeremy Bicha

    I believe DISPLAY=:0 gnome-shell -r works fine in Ubuntu; it’s what I use at least.