It sounds like your LightDM restart attempts are not always restoring a functional session, which could be due to driver issues, session state corruption, or even a deeper hardware problem. Here are some alternative methods to try:
Alternative Ways to Restart LightDM
- Manually Stop & Start LightDM Instead of Restarting
Try stopping LightDM first and then starting it again:
sudo systemctl stop lightdm
sleep 2
sudo systemctl start lightdm
This ensures that LightDM fully stops before being restarted.
- Kill LightDM Processes Manually If LightDM is stuck, try force-killing and then restarting it:
sudo pkill -9 lightdm
sudo systemctl start lightdm
This ensures any zombie processes don't interfere with the restart.
- Use xinit to Manually Start the Desktop If LightDM is unresponsive, you can manually start an X session with:
startx /usr/bin/mate-session
This is useful if LightDM itself is the issue but X and Mate are fine.
Fixing MATE Session Issues Without Restarting
- Restart the Window Manager (Marco or Compiz) If window decorations or responsiveness are an issue, restart the window manager:
marco --replace &
or
compiz --replace &
- Restart the Panel If the MATE panel is frozen or unresponsive:
killall mate-panel
nohup mate-panel &
- Restart MATE Components Individually If specific parts of MATE are glitching, restart them:
killall caja && nohup caja & # Restart file manager
killall mate-settings-daemon && nohup mate-settings-daemon & # Reset settings daemon
- Full Session Restart Without Logout If the desktop environment is misbehaving but you want to avoid logging out:
mate-session --replace &
(As you already mentioned, this is a great hack!)
Debugging the Issue
Since GDM3 seems more stable, it might be worth testing if switching to GDM3 resolves your issues:
sudo dpkg-reconfigure lightdm
Then select gdm3 as the default display manager.
You might also check logs for clues:
journalctl -xe -u lightdm
dmesg | grep -i error
If the issue is hardware-related (e.g., GPU issues), try switching to modesetting instead of proprietary drivers.
Would you like to explore potential hardware diagnostics as well?