45

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

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

I have reinstalled lightdm. I have restarted lightdm. Nothing seems to help.

Is there a command line tool to reconfigure lightdm with?

2

7 Answers 7

69

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:

https://wiki.ubuntu.com/LightDM

6
  • 3
    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.) Mar 27, 2014 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. Apr 8, 2014 at 20:45
  • 6
    NB: this will close all your open windows and everything in them will be lost!!! Sep 30, 2014 at 19:24
  • 4
    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.
    – matanox
    Mar 6, 2017 at 5:04
  • 2
    On 18.10, I tried sudo service gdm restart while debugging a solution to a button mapping problem and found, to my dismay, that the system would not let me login at all. I had to resort to rebooting anyhow.
    – bgoodr
    Jun 8, 2019 at 21:34
39

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

1
  • 1
    My window manager is broken, I can start programs from terminal but not from gui menu and cannot move the windows, neither by mouse nor by keyboard.Alt+F1 works, but Alt+F2 does nothing.A programme always is in front and cannot be moved backwards nor resized. I use Lubuntu 20_04 with Lxqt on old hardware.
    – Timo
    Mar 1, 2022 at 13:00
5

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
1
  • It does nothing, see here, one comment above. Btw Alt+F1 brings tty1, I see the cursor but cannot type in, the screen does not accept keyboard inputs.
    – Timo
    Mar 1, 2022 at 13:05
3

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.

2

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

0
1

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.

0

Try the following:

setsid unity

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

sudo service gdm restart
2
  • 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. Oct 8, 2011 at 14:14
  • 1
    This is because Oneiric uses lightdm by default, so you would need to type sudo service lightdm restart. Nov 15, 2011 at 20:07

You must log in to answer this question.

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