Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

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

share|improve this question
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 –  nitstorm 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? –  Berloni Jul 26 at 16:02

7 Answers 7

up vote 22 down vote accepted

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

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:

https://wiki.ubuntu.com/LightDM

share|improve this answer
    
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 at 19:14
    
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 at 20:45
    
NB: this will close all your open windows and everything in them will be lost!!! –  isomorphismes Sep 30 at 19:24

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

share|improve this answer
4  
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

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.

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

share|improve this answer
    
kdm: unrecognized service: Kubuntu. –  Hi-Angel Aug 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
share|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. –  Dmitrii 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

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
share|improve this answer
    
Downvoters please explain why so I can learn and improve info. I never retaliate. –  Ciro Santilli Mar 28 at 9:11
    
Probably because of killing programs: the topic starter was just needed to restart a Window Manager. –  Hi-Angel Aug 14 at 15:06

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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