0

I have Ubuntu server 24.04 running on a desktop machine. It has a GUI installed (though I don't know if that is relevant). I am running this server as a headless machine at the moment, though until recently it was running with a monitor attached and everything was OK. Now, when I SSH to the machine it will shutdown after 15 minutes, even if I am doing something on it, or if I am doing a long download. I have edited /etc/systemd/logind.conf as follows:

IdleAction=ignore HandleSuspendKey=ignore HandleHibernateKey=ignore HandleLidSwitch=ignore HandleLidSwitchExternalPower=ignore HandleLidSwitchDocked=ignore 

Everything else is commented out. This is a Desktop machine so issues of lid closure are not relevant even though I have specified them (copied from another post). I have also run sudo systemctl restart systemd-logind, followed by a reboot. I can RDP to the GUI using Remmina, and the only power options available are to set Power Mode to 'Balanced' (the default), and I have set 'Screen Blank' to 'Never', though I would have thought this is not relevant.

In response to: gsettings list-recursively org.gnome.settings-daemon.plugins.power, I get the following:

org.gnome.settings-daemon.plugins.power ambient-enabled true org.gnome.settings-daemon.plugins.power idle-brightness 30 org.gnome.settings-daemon.plugins.power idle-dim true org.gnome.settings-daemon.plugins.power lid-close-ac-action 'suspend' org.gnome.settings-daemon.plugins.power lid-close-battery-action 'suspend' org.gnome.settings-daemon.plugins.power lid-close-suspend-with-external-monitor false org.gnome.settings-daemon.plugins.power power-button-action 'interactive' org.gnome.settings-daemon.plugins.power power-saver-profile-on-low-battery true org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 7200 org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing' org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 900 org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'suspend' 

In response to: sudo journalctl -b -1 -ex, I get the following:

Aug 06 17:17:57 MERLIN systemd[1]: Reached target final.target - Late Shutdown Services. ░░ Subject: A start job for unit final.target has finished successfully ░░ Defined-By: systemd ░░ Support: http://www.ubuntu.com/support ░░ ░░ A start job for unit final.target has finished successfully. ░░ ░░ The job identifier is 7917. Aug 06 17:17:57 MERLIN systemd[1]: systemd-poweroff.service: Deactivated successfully. ░░ Subject: Unit succeeded ░░ Defined-By: systemd ░░ Support: http://www.ubuntu.com/support ░░ ░░ The unit systemd-poweroff.service has successfully entered the 'dead' state. Aug 06 17:17:57 MERLIN systemd[1]: Finished systemd-poweroff.service - System Power Off. ░░ Subject: A start job for unit systemd-poweroff.service has finished successfully ░░ Defined-By: systemd ░░ Support: http://www.ubuntu.com/support ░░ ░░ A start job for unit systemd-poweroff.service has finished successfully. ░░ ░░ The job identifier is 7916. Aug 06 17:17:57 MERLIN systemd[1]: Reached target poweroff.target - System Power Off. ░░ Subject: A start job for unit poweroff.target has finished successfully ░░ Defined-By: systemd ░░ Support: http://www.ubuntu.com/support ░░ ░░ A start job for unit poweroff.target has finished successfully. ░░ ░░ The job identifier is 7915. Aug 06 17:17:57 MERLIN systemd[1]: Shutting down. Aug 06 17:17:57 MERLIN systemd-shutdown[1]: Syncing filesystems and block devices. Aug 06 17:17:57 MERLIN systemd-shutdown[1]: Sending SIGTERM to remaining processes... Aug 06 17:17:57 MERLIN dnsmasq[2069]: exiting on receipt of SIGTERM Aug 06 17:17:57 MERLIN systemd-journald[428]: Journal stopped ░░ Subject: The journal has been stopped ░░ Defined-By: systemd ░░ Support: http://www.ubuntu.com/support ░░ ░░ The system journal process has shut down and closed all currently ░░ active journal files. 

As this is an area I know nothing about, it is saying to me 'I am shutting down', but it is not telling me why. Maybe someone can interpret differently?

Any suggestions, please. As I said, this all seemed to start when I went headless!

Regards, StuartM

3
  • 1
    Can you edit the question to include the output of gsettings list-recursively org.gnome.settings-daemon.plugins.power? Commented Aug 5 at 19:45
  • 2
    After the system comes up again, the terminal command sudo journalctl -b -1 -ex will show the system logs leading up to the crash/shutdown. You can look at other shutdowns by varying the -b -1 option. If nothing stands out, suspect overheating or sudden power outage. Do sudo journalctl --list-boots. For more journalctl help, see my StackExchange profile (click on my username). Commented Aug 5 at 22:59
  • Looking at the gsettings and journalctl output nothing stands out as the cause. The journalctl output looks the same as on my Ubuntu 24.04.2 LTS desktop where the previous Power Off was requested from the GUI, which implies a software commanded shutdown rather than a sudden power outage. The answers in How to find out from the logs what caused system shutdown? give more clues, but not yet sure which of answers will help. Commented Aug 7 at 12:30

1 Answer 1

0

This is not so much an answer, but more of a workround to the problem. I did some experimentation. I re-attached the monitor, keyboard and mouse, and then found:

  • Logging into the GUI on the attached monitor meant that the server did not shutdown after 15 mins (as you would expect)

  • After reboot, not logging in anywhere, the server would shutdown (I suspect it actually suspended) after 15 mins

  • RDP'ing to the server meant that I could not log into the GUI on the monitor (understandable)

  • Logging in at the monitor meant that I could not RDP to the server (understandable)

  • Not logging in at the monitor but connecting via SSH or RDP, the server would shutdown (or suspend) after 15 mins, as per my OP

Is this expected behaviour? Is this behaviour experienced by other users that want their server to be headless but with a GUI installed for the rare ocassion when a GUI is required? I have a VPS running Ubuntu Server that has a GUI installed (though I rarely use it) but I don't have a problem with it shutting down. The only real difference between the 2 servers is that one is a remote VM, the other is a local physical server.

So my solution/workaround is to disable the Display Manager (lightdm in my case). Referring to this post here I created scripts to start and stop the DM, disable and enable the DM at boot. The suggestion in the provided link to enable the DM did not work so I had to do this: sudo dpkg-reconfigure lightdm instead. It is not the answer that I wanted but it is OK for me for the time being. Thanks all that contributed. If anyone has a better solution, please feel free to respond.

Regards, StuartM

1
  • This is interesting, but on my systems haven't seen this behaviour. E.g. have an AlmaLinux 8.10 installation for which either login into the GUI, or remotely via ssh -X. When using ssh I haven't seen the computer shutdown. There might be something by which the GUI login on your system disables an "idle" shutdown, so will try and perform some more research. Commented Aug 10 at 12:00

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.