6

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.

Elias
  • 2,159

3 Answers3

7

You can try:

systemctl restart gdm
double-beep
  • 195
  • 1
  • 5
  • 13
fmo
  • 375
4

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.

1
# Supposing the home path is /home/username/:

fuser -k /home/username/
#or: fuser -k "$HOME"

Not needing the root privilege, this can kill all user level processes attached to your home directory, which leads to a restart of the X-Session login page in my case.

This is tested on Ubuntu 24.04, but should be a universal solution to many more Linux distributions.

Lh Guo
  • 11