a picture of 3 plastic bears, blue, orange, and yellow
kernpanik

mare liberum

How to prevent your Linux laptop from waking up at night

07 Jan 2015

Every time I put my X1 Carbon to suspend over night, it suddenly wakes up after some hours of sleeping. When it is connected to the power adapter, it just stays awake; when it is on battery, it eventually shuts down due to low power.

As described in this forum post, the reason for this strange behavior is an Intel® power setting in the X1's BIOS, which tries to put the machine to hibernate after 3 hours of suspend. As I use an encrypted harddrive in Ubuntu, hibernate is not available, so the process is interrupted and the notebook stays awake. (At least I guess that the encryption is the reason; but maybe the Intel® setting isn't compatible with Linux at all and also affects users who have not encrypted their HD.)

This is what the system log looks like:

Jan  7 00:11:14 carbon NetworkManager[821]: <info> (wlan0): cleaning up...
Jan  7 00:11:14 carbon NetworkManager[821]: <info> (wlan0): taking down device.
Jan  7 00:11:14 carbon dbus[488]: [system] Activating service name='org.freedesktop.n
m_dispatcher' (using servicehelper)
Jan  7 00:11:14 carbon dbus[488]: [system] Successfully activated service 'org.freede
sktop.nm_dispatcher'
Jan  7 00:11:14 carbon dbus[488]: [system] Activating service name='org.freedesktop.s
ystemd1' (using servicehelper)
Jan  7 00:11:14 carbon dbus[488]: [system] Successfully activated service 'org.freede
sktop.systemd1'
Jan  7 00:11:15 carbon kernel: [ 5507.757822] init: anacron main process (4953) kille
d by TERM signal
Jan  7 03:05:00 carbon kernel: [ 5507.807220] PM: Syncing filesystems ... done.
Jan  7 03:05:00 carbon kernel: [ 5507.814353] PM: Preparing system for mem sleep
Jan  7 03:05:00 carbon kernel: [ 5507.814656] Freezing user space processes ... (elap
sed 0.001 seconds) done.
Jan  7 03:05:00 carbon kernel: [ 5507.816363] Freezing remaining freezable tasks ... 
(elapsed 0.048 seconds) done.
Jan  7 03:05:00 carbon kernel: [ 5507.864491] PM: Entering mem sleep
Jan  7 03:05:00 carbon kernel: [ 5507.864562] Suspending console(s) (use no_console_s
uspend to debug)
Jan  7 03:05:00 carbon kernel: [ 5507.997388] sd 0:0:0:0: [sda] Synchronizing SCSI ca
che
Jan  7 03:05:00 carbon kernel: [ 5508.000197] sd 0:0:0:0: [sda] Stopping disk
Jan  7 03:05:00 carbon kernel: [ 5508.220963] mei_me 0000:00:16.0: H_RDY is not clear
ed 0x801A1A18
Jan  7 03:05:00 carbon kernel: [ 5509.045623] PM: suspend of devices complete after 1
179.763 msecs
Jan  7 03:05:00 carbon kernel: [ 5509.061579] PM: late suspend of devices complete af
ter 15.936 msecs
Jan  7 03:05:00 carbon kernel: [ 5509.077773] ehci-pci 0000:00:1d.0: System wakeup en
abled by ACPI
Jan  7 03:05:00 carbon kernel: [ 5509.093654] e1000e 0000:00:19.0: System wakeup enab
led by ACPI
Jan  7 03:05:00 carbon kernel: [ 5509.125628] xhci_hcd 0000:00:14.0: System wakeup en
abled by ACPI
Jan  7 03:05:00 carbon kernel: [ 5509.141835] PM: noirq suspend of devices complete a
fter 80.168 msecs
Jan  7 03:05:00 carbon kernel: [ 5509.142126] ACPI: Preparing to enter system sleep s
tate S3
Jan  7 03:05:00 carbon kernel: [ 5509.143885] PM: Saving platform NVS memory
Jan  7 03:05:00 carbon kernel: [ 5509.144546] Disabling non-boot CPUs ...
Jan  7 03:05:00 carbon kernel: [ 5509.146056] smpboot: CPU 1 is now offline
Jan  7 03:05:00 carbon kernel: [ 5509.249722] smpboot: CPU 2 is now offline
Jan  7 03:05:00 carbon kernel: [ 5509.250089] Broke affinity for irq 23
Jan  7 03:05:00 carbon kernel: [ 5509.250091] Broke affinity for irq 56
Jan  7 03:05:00 carbon kernel: [ 5509.353841] smpboot: CPU 3 is now offline
Jan  7 03:05:00 carbon kernel: [ 5509.355278] ACPI: Low-level resume complete
Jan  7 03:05:00 carbon kernel: [ 5509.355332] PM: Restoring platform NVS memory
Jan  7 03:05:00 carbon kernel: [ 5509.355842] Enabling non-boot CPUs ...
Jan  7 03:05:00 carbon kernel: [ 5509.355870] x86: Booting SMP configuration:
Jan  7 03:05:00 carbon kernel: [ 5509.355870] smpboot: Booting Node 0 Processor 1 API
C 0x1
Jan  7 03:05:00 carbon kernel: [ 5509.370096] CPU1 is up
Jan  7 03:05:00 carbon kernel: [ 5509.370111] smpboot: Booting Node 0 Processor 2 API
C 0x2
Jan  7 03:05:00 carbon kernel: [ 5509.384378] CPU2 is up
Jan  7 03:05:00 carbon kernel: [ 5509.384390] smpboot: Booting Node 0 Processor 3 API
C 0x3
Jan  7 03:05:00 carbon kernel: [ 5509.398650] CPU3 is up
Jan  7 03:05:00 carbon kernel: [ 5509.402365] ACPI: Waking up from system sleep state
 S3
Jan  7 03:05:00 carbon kernel: [ 5509.523787] xhci_hcd 0000:00:14.0: System wakeup di
sabled by ACPI
Jan  7 03:05:00 carbon kernel: [ 5509.587848] ehci-pci 0000:00:1d.0: System wakeup di
sabled by ACPI
Jan  7 03:05:00 carbon kernel: [ 5509.620121] PM: noirq resume of devices complete af
ter 141.186 msecs
Jan  7 03:05:00 carbon kernel: [ 5509.620222] PM: early resume of devices complete af
ter 0.083 msecs

As forum member lobner points out, the solution is to disable the deep-sleep option in the X1's BIOS. Here is how it's done:

BIOS Power Settings

Your Linux laptop will now stay asleep over night.