Ubuntu 20.04 suspends when idle, even if relevant power settings are disabled

Solution 1:

I found a way to at least work around the problem for now.

Looking at /var/log/syslog I noticed that it was the systemd sleep service which was putting my system into suspended state.

Following the information I found on this page I ran the following command:

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

So far my system hasn't shut down. I'll have to do a few more, longer lasting tests to be sure.

As an ordinary end user, I find my trust in Ubuntu being somewhat shaken by this experience. It seems there is no easy or user friendly way to control the suspend behavior, yet it has evidently been introduced as default behavior in Ubuntu 20.04.

Edit: The solution suggested here has one serious downside: It disables automatic hibernation but it ALSO disables any option to hibernate the system manually. I.e. by selecting Hibernate from the power menu or Whisker menu or whatever you are using. The option simply isn't there anymore.