5

I am using Ubuntu 19.04 (Disco Dingo). My question is the same as this old one: How to restart X Window Server from command line?

However, the much upvoted answer there does not work for me. When I run sudo systemctl restart display-manager as suggested there, the window system is restarted but then after that I cannot login, it seems like the window system is restarted again at each login attempt. So then I anyway need to reboot to make things work again. So that does not achieve what I want. What I would like is to be able to restart the window system without doing a full system reboot.

The other suggestion in the old answer was to check which display manager is used by doing cat /etc/X11/default-display-manager (in my case this gives /usr/sbin/gdm3) and then run sudo restart gdm but that gives me an error message: sudo: restart: command not found.

Is there a way to restart the X window system in Ubuntu 19.04 without doing a full reboot, and be able to login again afterwards?

Edit: I also tried systemctl restart gdm but that gives the same problem as sudo systemctl restart display-manager -- the window system is restarted but after that I cannot login, need to reboot to make things work again.

3
  • sudo systemctl restart gdm is the correct answer, if it does not work, then you have found a bug. What do the logs in /var/log/gdm/say ?
    – thecarpy
    Commented May 20, 2019 at 6:54
  • 1
    @thecarpy I have no /var/log/gdm/ directory. There is a /var/log/gdm3/ directory but that one is empty.
    – Elias
    Commented May 20, 2019 at 9:41
  • My bad, I forgot the 3 and systemd: what does journalctl --since=today|grep gdm report ?
    – thecarpy
    Commented May 20, 2019 at 17:42

2 Answers 2

6

You can try:

systemctl restart gdm
1
  • Thanks, I tried that now but it did not help, I have just added it as an edit to the question.
    – Elias
    Commented May 10, 2019 at 8:27
3
+25

This old Q&A: How to restart GNOME Shell from command line? may have the answers for you.

Initially these used to work for people:

  • The easiest way is to Alt+F2 and type r then .
  • The command to replace the gnome-shell would be gnome-shell --replace.

Now days this seems to be the only solution:

  • You can also do a killall -3 gnome-shell.

Note: This Q&A focuses on restarting gnome display manager without loosing all work and going back to Login screen.


What does Alt+F2 do?

From: 13 Keyboard Shortcut Every Ubuntu 18.04 User Should Know

10. Alt+F2: Run console

This is for power users. If you want to run a quick command, instead of opening a terminal and running the command there, you can use Alt+F2 to run the console.

5
  • what does alt+f2 then r mean? The complete command is? Thanks. When I use r in terminal, command not found. What window does alt+f2 open?
    – WesternGun
    Commented Apr 13, 2021 at 17:41
  • @WesternGun I updated the answer for your comment. What version / flavour of Ubuntu are you using? Commented Apr 13, 2021 at 22:41
  • Thanks for the update. I use Ubuntu 18.04. The complete output for r is: Command 'r' not found, but can be installed with: sudo apt install r-cran-littler
    – WesternGun
    Commented Apr 14, 2021 at 6:33
  • @WesternGun r is not a command to be run in Linux. r takes you to an option on Alt+F2. Does Alt + F2 work for you? If not it may be your version of Ubuntu or Flavor/Desktop. Commented Apr 14, 2021 at 23:13
  • Alt+F2 works for me, I just don't know why I can simply type r in the command window and I thought it is equivalent to terminal, but it seems not.
    – WesternGun
    Commented Apr 15, 2021 at 5:01

You must log in to answer this question.

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