24

Battery drains in about 10 hours when the computer is asleep with Ubuntu 18.04, it is a lenovo y520 (7700hq, 1060 with bumblebee).
When I tested no USB devices were plugged in, actually nothing was plugged in.
The sleep mode is s2 - deep. I am not interested in hibernation (it is quite slow and takes a lot of space).
In windows and Mac OS (hackintosh) sleep mode uses 1 or 2% of battery in a day.

Sss
  • 1,022
George
  • 343
  • 2
    Instead of unplugging USB make sure buses are powered off. Also make sure Wake on LAN is turned off. On phone so don't haven't links handy here. – WinEunuuchs2Unix Sep 04 '18 at 17:48
  • 1
    Wake on LAN as in a bios setting ? If yes, it is disabled, trying to check usb status right now – George Sep 04 '18 at 18:45
  • It.might be possible for Linux to override the BIOS setting but I believe it would respect it unless forced. (Still on phone) – WinEunuuchs2Unix Sep 04 '18 at 19:58
  • 1
    Ok, so I tried cutting the usb power, but from what I understand, for newer kernels "suspend" does not work anymore. So I checked if the values in "/sys/bus/usb/devices/usbX/power" are correct, and they seem to be. Not sure if it's the right way though – George Sep 07 '18 at 18:15
  • 1
    Any suggestion is appreciated. I noticed the cpu isn't really going to sleep. Voltage going through it even if the machine is in sleep mode. – George Sep 09 '18 at 08:47
  • I've been grappling with that problem for a long time and even offered a bounty on it once: https://askubuntu.com/questions/828486/systemd-suspends-system-but-upon-resume-kernel-then-enters-sleep-and-wake-up – WinEunuuchs2Unix Sep 09 '18 at 15:57
  • Yes. The CPU's being awake when they should have been sleeping problem was ~2 years ago. Now I'm on Kernel 4.13.0-36 and problem still persisted over the 2 years. I look back at issue every few months but all three of my laptops are plugged in 24/7 so it's not that big of a deal for me. – WinEunuuchs2Unix Sep 09 '18 at 19:37
  • 1
    So, I guess you switched kernels ? Sleep is extremely important to me, allows me to move around without waiting for the startup and launching my suite. It's disappointing to have this issue. – George Sep 09 '18 at 19:38
  • 1
    Hey, I still face this issue, have you fixed it with a newer kernel version maybe > – George Oct 20 '18 at 18:18
  • Sorry I don't follow up on this issue as my laptops are plugged in 24/7 it's low priority. – WinEunuuchs2Unix Oct 20 '18 at 18:26
  • 1
    Sure, wasn't really expecting a response so thanks :D – George Oct 21 '18 at 17:23
  • Due to guilty conscience I posted an answer :D – WinEunuuchs2Unix Oct 21 '18 at 17:30
  • on a lenovo x1, didn't have issues with this before, but recently (last month or so?) I've noticed power drain in sleep that I wasn't seeing before. – monkut Jan 17 '20 at 08:39

2 Answers2

9

After resuming from suspend, use this command in the terminal:

journalctl -b | grep -i "should not be sleeping"

If you see this:

Oct 21 07:20:18 alien kernel:  cache: parent cpu1 should not be sleeping
Oct 21 07:20:18 alien kernel:  cache: parent cpu2 should not be sleeping
Oct 21 07:20:18 alien kernel:  cache: parent cpu3 should not be sleeping
Oct 21 07:20:18 alien kernel:  cache: parent cpu4 should not be sleeping
Oct 21 07:20:18 alien kernel:  cache: parent cpu5 should not be sleeping
Oct 21 07:20:18 alien kernel:  cache: parent cpu6 should not be sleeping
Oct 21 07:20:18 alien kernel:  cache: parent cpu7 should not be sleeping

It could mean when you suspended the CPU's were not put to sleep as per his bounty Q&A a couple of years ago: systemd suspends system but upon resume kernel then enters sleep and wake-up

If so, I'm sad to report the problem persists to this day on my newest laptop just as it did on that older laptop.


Problem since 2012?

This old email chain: Re: Kernel stops at "PM: Preparing system for mem sleep", never makes it to "Freezing user space processes ... " has a similar problem.

From my log file today:

Oct 21 13:48:15 alien kernel: PM: Preparing system for sleep (mem)
Oct 21 13:48:16 alien acpid[964]: client 1171[0:0] has disconnected
Oct 21 13:48:32 alien kernel: Freezing user space processes ... (elapsed 0.003 seconds) done.
  • Line 1 is normal
  • Line 2 is abnormal and linked to old X11 crash bugs
  • Line 3 is occurs after resuming but should have happened as part of suspend.

Some other interesting points is it often takes 5 to 8 seconds to suspend when it should be about 1 second. This bug is reported in many places too.


If you don't have the same problem in the previous sections and, your laptop stays warm when suspended, then your fix maybe here: Ubuntu 18.04 - Dell XPS13 9370 no longer suspends on lid close

  • Yep, I get the same output :| – George Oct 21 '18 at 18:55
  • Is it the same thing for 16.04 ? – George Oct 21 '18 at 19:00
  • Yes. The logs above were generated this morning under Ubuntu 16.04.5 LTS. – WinEunuuchs2Unix Oct 21 '18 at 19:03
  • Maybe you saw this coming, but what about 14.04 ? – George Oct 21 '18 at 19:05
  • According to the first link, I believe 14.04 works OK but can't confirm it today as that laptop needs some TLC to get boot working again. However with email chain I discovered with kernel developers and just posted in this answer it may have been broken for some in Ubuntu 14.04 all the way back to Ubuntu 12.04. – WinEunuuchs2Unix Oct 21 '18 at 20:28
  • Just so I know, does this mean there's no difference between sleep and idle for the cpu or does it chill out a bit ? – George Oct 27 '18 at 22:12
  • Hey, umm, more great news, I tried switching to windows for a day, then I find out not even windows' sleep is working anymore, is it related to linux, (bootloader more specifically) – George Nov 02 '18 at 18:03
  • I've done a frsh install of windows, sleep behaves now just like ubuntu, it;s ridiculous. How do I get rid of this...? – George Nov 16 '18 at 18:29
  • @WinEunuuchs2Unix Do you suppose out-of-order-execution could be to blame for https://askubuntu.com/questions/828486/kernel-suspends-too-quickly-upon-resume-continues-suspend-tasks ? I updated my answer there with a way you could test that. – Elder Geek Apr 21 '19 at 18:10
  • 1
    @ElderGeek I quickly read your answer revisions. I'm not sure that's the culprit but am hoping the bug report filed yeseterday will give answers: https://bugs.launchpad.net/ubuntu/+source/linux-signed-hwe/+bug/1825636 – WinEunuuchs2Unix Apr 21 '19 at 18:49
1

On my old computer, I solved my suspend issues by adjusting some settings in the motherboard BIOS.

For my hardware:

On the "Advanced" page in BIOS under "CPU configuration", I set "Enhanced Alt State" to ENABLED, and under "ACPI Settings" , I set "Suspend to RAM" to AUTO and "ACPI table" to ENABLED.

After I made these changes, I could suspend my PC.

Note: BIOS settings and motherboard firmware vary by manufacturer and model

Nmath
  • 12,333