8

I have an Ubuntu server instance that enters sleep mode from time to time (on average every two months). By looking in the syslog file, I see that it is the networkManager that requests to put the host to sleep.

Here is the log entry:

Aug 24 11:33:28 home dbus-daemon[1108]: [session uid=108 pid=1108] Activating service name='org.freedesktop.Notifications' requested by ':1.12' (uid=108 pid=1145 comm="/usr/lib/unity-settings-daemon/unity-settings-daem" label="unconfined")
Aug 24 11:33:29 home org.freedesktop.Notifications[1108]: Unable to init server: Impossible de se connecter : Connexion refusée
Aug 24 11:33:29 home notify-osd[19718]: cannot open display: 
Aug 24 11:33:29 home dbus-daemon[1108]: [session uid=108 pid=1108] Activated service 'org.freedesktop.Notifications' failed: Process org.freedesktop.Notifications exited with status 1
Aug 24 11:33:29 home dbus-daemon[1108]: [session uid=108 pid=1108] Activating service name='org.freedesktop.Notifications' requested by ':1.12' (uid=108 pid=1145 comm="/usr/lib/unity-settings-daemon/unity-settings-daem" label="unconfined")
Aug 24 11:33:29 home NetworkManager[880]: <info>  [1598261609.2373] manager: sleep: sleep requested (sleeping: no  enabled: yes)
Aug 24 11:33:29 home NetworkManager[880]: <info>  [1598261609.2382] manager: NetworkManager state is now ASLEEP
Aug 24 11:33:29 home whoopsie[21081]: [11:33:29] offline
Aug 24 11:33:29 home org.freedesktop.Notifications[1108]: Unable to init server: Impossible de se connecter : Connexion refusée
Aug 24 11:33:29 home notify-osd[19725]: cannot open display: 
Aug 24 11:33:29 home dbus-daemon[1108]: [session uid=108 pid=1108] Activated service 'org.freedesktop.Notifications' failed: Process org.freedesktop.Notifications exited with status 1
Aug 24 11:33:29 home systemd[1]: Reached target Sleep.
Aug 24 11:33:29 home systemd[1]: Starting Suspend...
Aug 24 11:33:29 home kernel: [3268843.256198] PM: suspend entry (deep)
Aug 24 11:33:29 home systemd-sleep[19726]: Suspending system...

What is causing this ? Is this the consequence of a network problem or a configuration issue ?

EDIT: here is some additional info requested in the comment

$ sudo systemctl status suspend.target
[sudo] Mot de passe de meessen : 
● suspend.target - Suspend
   Loaded: loaded (/lib/systemd/system/suspend.target; static; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:systemd.special(7)
12
  • 1
    Have you added a desktop? and thus turned your server into a desktop? (which will sleep) You didn't provide release details which may have confirmed my suspicion.
    – guiverc
    Aug 30, 2020 at 11:21
  • What is the output of sudo systemctl status suspend.target?
    – starkus
    Aug 30, 2020 at 11:32
  • 4
    The output indicates that NetworkManager was not the trigger of the sleep command. It received the sleep command along with other services. NM has a lot to do when a sleep command is received. The first log entry is that the command to sleep was received, and it's starting the process. The second log entry is that the process completed successfully, and NM is now asleep.
    – user535733
    Aug 30, 2020 at 11:42
  • 1
    You could mask those services responsible for energy saving, like suspend and hibernate, as told in the link. I would give it a try. If you encounter any trouble you also may revert your changes, as told at the end of the link.
    – starkus
    Aug 30, 2020 at 12:58
  • 1
    @waltinator logs are the same as then one I found in syslog. It doesn't help
    – chmike
    Aug 30, 2020 at 17:30

1 Answer 1

3

Here is what works for me:

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

This command disables the sleep mode on the server.

If we would like to enable it again:

systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.