Just to add, I've tried multiple workarounds, and the best one (works every time) and less intrusive is modifying the file /etc/init/lightdm.conf adding "respawn" like this:
... stop on runlevel [016]
respawn
emits login-session-start emits desktop-session-start emits desktop-shutdown ---
Just to add, I've tried multiple workarounds, and the best one (works every time) and less intrusive is modifying the file /etc/init/ lightdm. conf adding "respawn" like this:
...
stop on runlevel [016]
respawn
emits login-session-start session- start
emits desktop-
emits desktop-shutdown
---