Ubuntu 20.04/22.04 suddenly disables network cards (due to falling asleep)

Another nice experience that you never want to make yourself, because you won’t most likely won’t find the reason for it:

I have set up an Ubuntu Server, but out of the sudden it disconnects all network card, saying something like “carrier lost” in /var/log/syslog. If you read very carefully your logs, you might find the following:

Jul  2 15:00:52 comm NetworkManager[1087]: <info>  [1656774052.0149] manager: sleep: sleep requested (sleeping: no  enabled: yes)
Jul  2 15:00:52 comm NetworkManager[1087]: <info>  [1656774052.0151] manager: NetworkManager state is now ASLEEP
Jul  2 15:00:52 comm ModemManager[1271]: <info>  [sleep-monitor] system is about to suspend
Jul  2 15:00:52 comm systemd[1]: Reached target Sleep.
Jul  2 15:00:52 comm systemd[1]: Starting Record successful boot for GRUB...
Jul  2 15:00:52 comm systemd[1]: Starting System Suspend...
Jul  2 15:00:52 comm systemd[1]: grub-common.service: Deactivated successfully.
Jul  2 15:00:52 comm systemd[1]: Finished Record successful boot for GRUB.
Jul  2 15:00:52 comm systemd[1]: Starting GRUB failed boot detection...
Jul  2 15:00:52 comm systemd[1]: Stopping Atop advanced performance monitor...
Jul  2 15:00:52 comm systemd[1]: grub-initrd-fallback.service: Deactivated successfully.
Jul  2 15:00:52 comm systemd[1]: Finished GRUB failed boot detection.
Jul  2 15:00:52 comm systemd[1]: atop.service: Deactivated successfully.
Jul  2 15:00:52 comm systemd[1]: Stopped Atop advanced performance monitor.
Jul  2 15:00:52 comm systemd-sleep[4340]: Entering sleep state 'suspend'...
Jul  2 15:00:52 comm kernel: [ 2037.277746] PM: suspend entry (deep)
Jul  2 15:00:52 comm kernel: [ 2037.306799] Filesystems sync: 0.029 seconds
Jul  2 15:06:12 comm kernel: [ 2037.308344] Freezing user space processes ... (elapsed 0.002 seconds) done.
[...]
Jul  2 15:06:12 comm kernel: [ 2037.348751] r8169 0000:05:00.0 enp5s0: Link is Down
Jul  2 15:06:12 comm kernel: [ 2037.348830] e1000e: EEE TX LPI TIMER: 00000000
Jul  2 15:06:12 comm kernel: [ 2037.349454] e1000e: EEE TX LPI TIMER: 00000011
Jul  2 15:06:12 comm kernel: [ 2037.452307] sd 4:0:0:0: [sda] Synchronizing SCSI cache
Jul  2 15:06:12 comm kernel: [ 2037.452504] sd 4:0:0:0: [sda] Stopping disk
Jul  2 15:06:12 comm kernel: [ 2037.875898] ACPI: PM: Preparing to enter system sleep state S3
Jul  2 15:06:12 comm kernel: [ 2038.084364] ACPI: PM: Saving platform NVS memory
Jul  2 15:06:12 comm kernel: [ 2038.084390] Disabling non-boot CPUs ...
Jul  2 15:06:12 comm kernel: [ 2038.086669] smpboot: CPU 1 is now offline
[... other CPUs ...]
Jul  2 15:06:12 comm kernel: [ 2038.119491] ACPI: PM: Low-level resume complete
Jul  2 15:06:12 comm kernel: [ 2038.119573] ACPI: PM: Restoring platform NVS memory
Jul  2 15:06:12 comm kernel: [ 2038.120867] Enabling non-boot CPUs ...
Jul  2 15:06:12 comm kernel: [ 2038.120902] x86: Booting SMP configuration:
Jul  2 15:06:12 comm kernel: [ 2038.120902] smpboot: Booting Node 0 Processor 1 APIC 0x1
[... other CPUs ...]
Jul  2 15:06:12 comm kernel: [ 2038.134188] ACPI: PM: Waking up from system sleep state S3

In a nutshell, what’s happening is the operating system trying to go into the sleep mode (S3 level) – however, get’s pull up immediately, but is unable to restore contact and carrier for your network cards. As the “suspend” phase is taking less than a second, you even won’t notice that something like this happened. The only thing that you’ll notice is the fact that the network cards are disconnected – and you can’t even revive them even with unplugging the cable. You have to restart the machine instead.

The “cure of this disease” is described in this stackoverflow/askubuntu question: https://askubuntu.com/a/1398887: Disable the suspend mode by masking the corresponding targets:

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

This will ensure that the suspend commands are never reached and the system does not fall asleep — something that I would consider to be self-evident for a server operating system. Apparently, this does not hold true for Ubuntu, though…

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Leave a Reply

Your email address will not be published. Required fields are marked *

*