Ubuntu 20.04.3 desktop (Cinnamon) - SSH disconnects when user logs off the desktop!

Bijan Soleymani bijan at psq.com
Wed Jan 26 19:29:12 UTC 2022


On 2022-01-26 12:50 p.m., Bo Berglund wrote:
> On Tue, 25 Jan 2022 17:55:52 -0500, Bijan Soleymani <bijan at psq.com> wrote:
> 
>> On 2022-01-25 3:26 p.m., Liam Proven wrote:
>>> On Mon, 24 Jan 2022 at 22:35, Colin Law <clanlaw at gmail.com> wrote:
>>>
>>>> Bo's system is not going to sleep, it is rebooting.
>>>
>>> Ah, yes, it is, _but_ maybe it's _trying_ to go to sleep (or drop into
>>> some power-saving mode) and that's failing and crashing it...?
>>
>> Yes I thought something similar.
>>
>> Some things he could try:
>> 1. Try to suspend, hibernate and power off display and see if any of
>> them triggers the reboot.
> 
> How can I do this on a non-laptop computer?

suspend run command:
pm-suspend

hibernate run command:
pm-hibernate

hybrid run command:
pm-suspend-hybrid

But to reproduce exactly what gnome/lightdm do, you should use dbus as 
described here:
https://askubuntu.com/questions/1792/how-can-i-suspend-hibernate-from-command-line/131022#131022

suspend command:
dbus-send --system --print-reply \
     --dest="org.freedesktop.UPower" \
     /org/freedesktop/UPower \
     org.freedesktop.UPower.Suspend

hibernate command:
dbus-send --system --print-reply \
     --dest="org.freedesktop.UPower" \
     /org/freedesktop/UPower \
     org.freedesktop.UPower.Hibernate:

I don't know how to specifically turn off monitor only remotely. But I 
suspect one of the above would trigger the issue, if this was the issue.

>> 2. Disable suspend/hibernate temporarily systemwide and see if that
>> fixes it:
>> https://www.tecmint.com/disable-suspend-and-hibernation-in-linux/
> 
> I ran the verification test without first running the mask command just to see
> the current state:
> 
[...]
>   
> So it is already set to *NOT* do any of these...

My system shows the same and will suspend, so I think the active means 
whether it is suspended or suspending, not whether suspending is enabled.

>> 3. Disable lightdm/gdm startup and startup of X locally, since it is not
>> needed for remote VNC and see if that fixes it. Not even necessary to
>> disable it at boot, can boot normally and then /etc/init.d/lightdm stop
>> or /etc/init.d/gdm stop (or whatever the current syntax is for shutting
>> down a service).
> 
> I lost you here, what is the command to do this?

Assuming you have lightdm:
sudo /etc/init.d/lightdm stop

If you have gdm3:
sudo /etc/init.d/gdm3 stop

Otherwise do:
ls /etc/init.d/*dm

To see what the display manager is.

>> 4. Configure lightdm and ubuntu greeter not to suspend:
>> https://askubuntu.com/questions/1337649/how-to-disable-suspend-in-20-minutes-from-the-lightdm-login-screen
>>
>> This last one is the most difficult because if you don't get the
>> settings just right it won't have an effect. So what I would recommend
>> is setting the settings down to 1 minute or less and see if that
>> triggers it quicker. Otherwise it is a bit annoying to test (although
>> waiting 6 minutes is not as bad as 20 minutes).
> 
> But as shown above in my 2nd comment all of the related services are shut off
> (dead) so how could a config for them affect anything?

I think the gnome based display managers use dbus and not systemctl 
directly, also I don't think your 2nd comment means that suspend is not 
available on your system, because my system will suspend and I get the 
same output as you did.

> But anyway, I have a workaround by configuring the system to log me on to the
> desktop at startu...
> Then none of these reboots ever happen.

Yes, this makes me think it is not a hardware issue, but is a software 
issue instead. Because I don't see how being logged out should be harder 
on the hardware than being logged in.

Of course since you have a working solution, you can go on with your 
life, but I find it good to root cause things. If your local desktop 
session crashes or some system change or upgrade breaks auto-log in, 
then your system would suspend again on next reboot, etc.

Bijan




More information about the ubuntu-users mailing list