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.