How to restart window manager so that styles (or whatever) are restored?

After doing /etc/init.d/networking stop they feel completely broken.

  • 2
    This is not an answer in any way but just saying, a nicer way to stop the networking service is by sudo service networking stop – Nitin Venkatesh Sep 30 '11 at 17:11
  • Or sudo stop networking. – Eliah Kagan Jul 6 '12 at 17:58
  • 1
    possible duplicate of How can I restart x-server from the command line? – rds Nov 6 '13 at 19:50
  • I have reinstalled lightdm. I have restarted lightdm. Nothing seems to help. Is there a command line tool which to reconfigure lightdm with? – user309429 Jul 26 '14 at 16:02

You may need to restart your display manager to fix your problem.

11.04 and earlier.

sudo service gdm restart

Ubuntu 11.10 and newer.

sudo service lightdm restart

lightdm replaces gdm in Ubuntu 11.10

Ubuntu 15.04 and newer.

sudo service sddm restart

While restarting lightdm restarts the entire display manager, you may be able to resolve the issue by restarting unity or compiz (Unity is a compiz plugin).

Restarting Unity (nohup setsid unity OR nohup unity --restart on the CLI OR Alt+F2 and type unity) restarts the Unity shell.

If that doesn't work, restart compiz with nohup compiz --replace. You may need to restart unity again after restarting compiz.

Restarting lightdm restarts the entire display manager which is most likely to work but it will also close your running applications. Which you need to do depends on how broken your session is. If you can just restart Unity or Compiz, do that. If that doesn't work, restart lightdm.

The following wiki article has additional information about fixing LightDM issues:


| improve this answer | |
  • 1
    Admittedly, the question is somewhat vague. But why would it be necessary to restart the display manager? The window manager is what provides window styles and restarting it is usually as effective as entering a new session. (This answer is accepted and presumably worked ...but it seems to me it does much more than is actually required to fix this problem. Restarting the computer would work, too, but is unnecessary. Restarting lightdm/gdm might also be unnecessary.) – Eliah Kagan Mar 27 '14 at 19:14
  • 1
    You are right. Restarting the window manager would presumably fix a problem with the window decorations. However, if that doesn't work, restarting the session would the next step before power cycling the box. – Omegamormegil Apr 8 '14 at 20:45
  • 3
    NB: this will close all your open windows and everything in them will be lost!!! – isomorphismes Sep 30 '14 at 19:24
  • 3
    with Ubuntu 16.04, sudo service sddm restart is not a recognized command, and the other options mentioned resulted in logging my user out, so restarting the machine would have worked just as poorly. – matanster Mar 6 '17 at 5:04
  • I use 19.04. With this version, the command is sudo service gdm restart. As far as I understand, it is so since 18.04. – SR_ Apr 29 '19 at 7:43

Press Alt+F2 and type unity, then press Enter (this is the same as running unity --replace).

| improve this answer | |
  • 6
    IMO this is the correct answer to the exact question. Restarting lightdm/gdm will restart your entire X session – Collin Peters May 10 '12 at 15:13
  • This should definitely be the accepted answer. People please upvote! – NiKo May 8 '16 at 18:34
  • But this assumes the user is running unity. Not every user has to run unity; unless the user said s/he is running unity, I'm not sure if this answer should be an accepted answer... – Ray May 11 '16 at 0:45
  • Ubuntu 16.04: this crashes chrome – matanster Mar 6 '17 at 5:06

If everything freezes, another place you might want to restart lightdm from is from a TTY. This will kill all your programs.

  • hit Ctrl + Alt + F2
  • login
  • sudo service lightdm restart
| improve this answer | |

A solution for KDE:

You have to type kwin --replace &

I have no idea, why @Álvaro says about sudo service kdm restart, but, at least on Kubuntu no such a service.

| improve this answer | |

There are few methods to restart X.

If everything froze for example, you can kill it by pressing Clt+PrtScr+K.

Or you can restart it from terminal, as described in previous answers.

More details on how to Restart X in Ubuntu.

| improve this answer | |

You should type: sudo service XXX restart

The XXX should be (without quotes):

  • gdm if you use Ubuntu 11.04 or older
  • lightdm for Ubuntu 11.10
  • kdm for Kubuntu
  • xdm for Xubuntu

In case you have installed another display manager on your (K/X/L)Ubuntu you should restart the one you're using e.g. if you have installed KDE on Ubuntu (and it's the one you're using) you should restart kdm not lightdm.

In case you are not sure what to restart see the files in /etc/init.d/ and see if there is a file with a name that contains the XXX already mentioned, or something like YYYdm (the dm is short for "display manager").

| improve this answer | |
  • kdm: unrecognized service: Kubuntu. – Hi-Angel Aug 14 '14 at 14:49

Try the following:

setsid unity

If that doesn't work, try restarting X. Note that this will crash everything:

sudo service gdm restart
| improve this answer | |
  • setsid unity seemed to launch something but styles remain broken. sudo service gdm restart fails with restart: Unknown instance:. This way it ends very often when I try to restart service, so in most cases I have to stop-start them. – Dmitry Volosnykh Oct 8 '11 at 14:14
  • 1
    This is because Oneiric uses lightdm by default, so you would need to type sudo service lightdm restart. – Nathan Osman Nov 15 '11 at 20:07

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.