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


Last night I upgraded my stationary desktop computer from Ubuntu 19.04 to 20.04. The upgrade went without any difficulty whatsoever.

Next day I found myself needing to use my 3D printer for a small project. I downloaded the model and began printing. The process was estimated to take just under 2 hours.

My printer is kind of loud so I decided to go and do something else in the mean time. About half an hour later I returned to find that my computer had gone into suspend, or hibernation or whatever, and that the printer was stopped in the middle of the model.

Why is my computer doing that, and how do I prevent that from happening? I never want my computer to hibernate for any reason at all.

I'm not a big fan of the Gnome desktop so I use XFCE 4.12. Here are my power settings (which are unaltered – this is how they have been all the time):

Power manager pane 1

Power manager pane 2

Everything looks pretty normal to me.

Any ideas? Also which logs can I check to see why my computer went into suspended state? This is kind of a huge deal for me, as I also leave my computer running for other reasons.

Best Answer

  • 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.