5

Problem

I currently have my own Ubuntu server set up at home for development. However, when I try to ssh again after a certain period of time (about 20-30 minutes), it times out. Even after trying the ping command, no packets came back. If I do a physical reboot, ssh connection is possible without any problem.

What I want to solve

In order to be able to always ssh from another client PC even after a certain period of time has passed, I need to make the Ubuntu server sleep or suspend. Suspend? I'd like to know how to set it up so that it doesn't go into sleep/suspend mode.

Things I've tried

  1. sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target.

I disabled suspend and hibernate with this command and tried to reboot, but the result was the same.

  1. I found that for some reason, despite being an Ubuntu Server, I was able to change the gnome settings so I tried to change the settings with the following command.
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type nothing
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 0
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type nothing
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0

However, the result was the same here.

  1. I came across this question Ubuntu 20.04 keeps goes to sleep and tried it out but it did not work.

  2. I also changed the settings in the /etc/gdm3/greeter.dconf-defaults file as follows but there was no change even after rebooting after changing.

# Automatic suspend
# =================
[org/gnome/settings-daemon/plugins/power]
# - Time inactive in seconds before suspending with AC power.
# 1200=20 minutes, 0=never
# sleep-inactive-ac-timeout=1200
sleep-inactive-ac-timeout=0
# - What to do after sleep-inactive-ac-timeout
# 'blank', 'suspend', 'shutdown', 'hibernate', 'interactive' or 'nothing'.
# sleep-inactive-ac-type='suspend'
# - As above but when on battery
# sleep-inactive-battery-timeout=1200
sleep-inactive-battery-timeout=0
# sleep-inactive-battery-type='suspend'

System configuration

  • Ubuntu Server 20.04.2 LTS (GNU/Linux 5.4.0-80-generic x86_64)
  • AMD Ryzen 5950
  • AsRock Taichi X570

I would appreciate it if you could help me with a solution. Thank you very much for your help.

4
  • Ubuntu Server does not have any power management features out of the box, as servers are (generally) not supposed to suspend or otherwise become unavailable. Have you confirmed the machine is entering suspend mode? Have you installed a UI on top of the server? Have you confirmed that the assigned network addresses are consistent? 🤔
    – matigo
    Jul 25, 2021 at 22:13
  • @matigo Thank you for your comment. > Have you installed a UI on top of the server? I do not think I have installed UI however, it might have happened since there is a gnome setting.
    – user76333
    Jul 25, 2021 at 23:45
  • @matigo As for the network environment, I am sure that the server has static IP since I use VPN via tailscale.
    – user76333
    Jul 26, 2021 at 0:08
  • 1
    If the machine is going into suspend (or some other low-power mode), then there should be something in the logs that states as much. You should see something in /var/log/syslog. This would also be the place to check for other system errors or, as I've seen from time to time, network-related issues that can take an interface offline ...
    – matigo
    Jul 26, 2021 at 0:11

2 Answers 2

2

I run into the same error and I want to sum it up a little. Like @matigo mentioned, this is not a default behavior and comes with an UI. I didn't install it on purpose but when I was looking for my nvidia drivers by using ubuntu-drivers devices this was displayed:

enter image description here

The recommended driver was a non-server driver. With this installation I got an UI on board by mistake. The solution was like @hphex said here and as easy as firing this command:

sudo apt-get remove xserver-xorg-core

Be careful when picking the drivers, I hope this helps

1

SOLVED:

I had installed xcape which is written in my dotfiles for another Ubuntu desktop env.

After running this command from this post, removed all desktop related libraries and never went to sleep mode.

Remove GUI on Ubuntu Server

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .