Linux Developer Systems

Last reply by 09-08-2022 Unsolved
Start a Discussion
2 Bronze
2 Bronze
5495

Battery Dying in Sleep mode

I have a brand new XPS 13 with Ubuntu pre-installed. The battery is dying rapidly when it is on standby, as if the computer is still on. Dell customer service was worse than useless, after waiting for 45 minutes they just said "we can't help you because that is Ubuntu" and it is "normal."

Does anyone have any fixes for this?

I won't ever buy a Dell again and I won't ever suggest to anyone to buy one. For a brand-new computer, an expensive one at that, to have these problems and to have zero customer service help is messed up.

 

If anyone wants to buy it off me let me know.

Replies (9)
3 Silver
5483

I got a XPS 2020 9300 on Ubuntu 18.04

If I put the machine on sleep with the lid closed, it can stay all day like that and I barely lose a few % of battery. Yesterday I had my XPS with me at work. Used it on morning at 9:00 AM to check my emails, then closed the lid. Worked on the work laptop and woke up the XPS by 5:40 PM and battery was around 96 % so I had lost about 4 % on sleep.

If your machine eat about half the battery on "sleep" then it was not sleeping when you closed the lid.

5477

Yeah. It's been losing way more than that, like I'll leave it unplugged and closed (after it's been fully charged) and I'll open it and log in and it will be close to dead with less than 10% battery life left after sitting all day. Dell PMed me and was utterly unhelpful, they don't have anyone to help apparently. Next time I'm buying from a small business.

5463

Set up your SSH so you can log from outside.

Write down your IP

Close the lid, and while it's closed, try to ping the machine

And try to SSH to the machine

If it's not sleeping, you need to check first the UEFI bios (where you can tell the BIOS not to put the machine to sleep when the lid is closed) and then we have to check the kernel log to see what happens (you write down the date/time before closing the lid then look in the logs)

2 Bronze
2 Bronze
5426

It is possible that you're using s2idle (S0) instead of deep (S3) sleep:

https://www.kernel.org/doc/Documentation/power/states.txt

 

From a terminal, run:

#> cat /sys/power/mem_sleep

 

If you see:

[s2idle] deep

 

Then you are using s2idle. You'll want deep sleep for power savings, which would like like:

s2idle [deep]

 

I'll leave it up to you to figure out how to change on Ubuntu. Elsewhere in these forums someone mentioned that waking up from deep (S3) sleep fails unless two "Signs of Life" options are disabled in BIOS/Firmware:

https://www.dell.com/community/XPS/XPS-13-9300-Wake-from-sleep/td-p/7523159

 

5407

On my machine, putting the machine to sleep for a whole day only uses a few % of battery

(about 5-6 % for 7/8 hours lid closed)

And my setting is :

gilbert@asgard:/etc$ cat /sys/power/mem_sleep
[s2idle] deep

s2idle should not eat most of the battery if lid remains closed for hours.

5404

I have switched my machine from idle to deep sleep and it seems to work fine.

1. BIOS

Turn off in POST -> Signs of line the 2 checkboxes of "signs of life"

2. Grub config

Start by making a backup of the grub file :

cd /etc/default

sudo cp grub grub.backup

Then you edit the grub file. I use vim but if you are not at ease with vi/vim I suggest you install and use "nano" which is very user-friendly.

Add the following in BOLD to your kernel options :

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash mem_sleep_default=deep noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off tsx=on tsx_async_abort=off mitigations=off"

I got plenty options because this is a development machine, contains nothing but code so I turn off all mitigations for Spectre/Meltdown/etc. so the machine is as speedy as possible.

Do NOT do this on a machine that contains any personnal or sensitive information.

3. Test

I opened two terminals. One set with a tail -f over the /var/log/kern.log file

And another tail -f /var/log/syslog

I then closed the lid, waited a few minutes and woke the machine back.

4. Logs

Closing the lid :

Jun 24 15:00:01 asgard kernel: [ 976.773631] wlp0s20f3: deauthenticating from e0:dc:ff:29:df:36 by local choice (Reason: 3=DEAUTH_LEAVING)
Jun 24 15:00:06 asgard kernel: [ 981.671159] PM: suspend entry (deep)
Jun 24 15:17:47 asgard kernel: [ 981.671162] PM: Syncing filesystems ... done.
Jun 24 15:17:47 asgard kernel: [ 981.676285] Freezing user space processes ... (elapsed 0.003 seconds) done.
Jun 24 15:17:47 asgard kernel: [ 981.679537] OOM killer disabled.
Jun 24 15:17:47 asgard kernel: [ 981.679537] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Jun 24 15:17:47 asgard kernel: [ 981.680921] printk: Suspending console(s) (use no_console_suspend to debug)
Jun 24 15:17:47 asgard kernel: [ 981.933301] psmouse serio1: Failed to disable mouse on isa0060/serio1
Jun 24 15:17:47 asgard kernel: [ 984.839822] ACPI: EC: interrupt blocked
Jun 24 15:17:47 asgard kernel: [ 984.969813] ACPI: Preparing to enter system sleep state S3
Jun 24 15:17:47 asgard kernel: [ 984.990370] ACPI: EC: event blocked
Jun 24 15:17:47 asgard kernel: [ 984.990371] ACPI: EC: EC stopped
Jun 24 15:17:47 asgard kernel: [ 984.990372] PM: Saving platform NVS memory
Jun 24 15:17:47 asgard kernel: [ 984.990484] Disabling non-boot CPUs ...
Jun 24 15:17:47 asgard kernel: [ 984.992281] smpboot: CPU 1 is now offline
Jun 24 15:17:47 asgard kernel: [ 984.994894] smpboot: CPU 2 is now offline
Jun 24 15:17:47 asgard kernel: [ 984.997436] smpboot: CPU 3 is now offline
Jun 24 15:17:47 asgard kernel: [ 984.999082] IRQ 174: no longer affine to CPU4
Jun 24 15:17:47 asgard kernel: [ 985.000097] smpboot: CPU 4 is now offline
Jun 24 15:17:47 asgard kernel: [ 985.001954] IRQ 124: no longer affine to CPU5
Jun 24 15:17:47 asgard kernel: [ 985.001966] IRQ 125: no longer affine to CPU5
Jun 24 15:17:47 asgard kernel: [ 985.001993] IRQ 175: no longer affine to CPU5
Jun 24 15:17:47 asgard kernel: [ 985.002004] IRQ 179: no longer affine to CPU5
Jun 24 15:17:47 asgard kernel: [ 985.003029] smpboot: CPU 5 is now offline
Jun 24 15:17:47 asgard kernel: [ 985.003909] IRQ 17: no longer affine to CPU6
Jun 24 15:17:47 asgard kernel: [ 985.003923] IRQ 122: no longer affine to CPU6
Jun 24 15:17:47 asgard kernel: [ 985.003952] IRQ 146: no longer affine to CPU6
Jun 24 15:17:47 asgard kernel: [ 985.003973] IRQ 176: no longer affine to CPU6
Jun 24 15:17:47 asgard kernel: [ 985.003988] IRQ 180: no longer affine to CPU6
Jun 24 15:17:47 asgard kernel: [ 985.005031] smpboot: CPU 6 is now offline
Jun 24 15:17:47 asgard kernel: [ 985.007140] smpboot: CPU 7 is now offline

Jun 24 15:00:01 asgard NetworkManager[1042]: <info> [1593003601.2957] manager: NetworkManager state is now ASLEEP
Jun 24 15:00:01 asgard NetworkManager[1042]: <info> [1593003601.2961] device (wlp0s20f3): state change: activated -> deactivating (reason 'sleeping', sys-iface-state: 'managed')
Jun 24 15:00:01 asgard NetworkManager[1042]: <info> [1593003601.2996] device (wlp0s20f3): state change: deactivating -> disconnected (reason 'sleeping', sys-iface-state: 'managed')
Jun 24 15:00:01 asgard avahi-daemon[1004]: Withdrawing address record for fe80::5f10:74f3:fa5b:5a82 on wlp0s20f3.
Jun 24 15:00:01 asgard avahi-daemon[1004]: Leaving mDNS multicast group on interface wlp0s20f3.IPv6 with address fe80::5f10:74f3:fa5b:5a82.
Jun 24 15:00:01 asgard avahi-daemon[1004]: Interface wlp0s20f3.IPv6 no longer relevant for mDNS.

After I wake up :

Jun 24 15:17:47 asgard kernel: [ 985.010918] ACPI: Low-level resume complete
Jun 24 15:17:47 asgard kernel: [ 985.011025] ACPI: EC: EC started
Jun 24 15:17:47 asgard kernel: [ 985.011025] PM: Restoring platform NVS memory
Jun 24 15:17:47 asgard kernel: [ 985.012086] Enabling non-boot CPUs ...
Jun 24 15:17:47 asgard kernel: [ 985.012128] x86: Booting SMP configuration:
Jun 24 15:17:47 asgard kernel: [ 985.012128] smpboot: Booting Node 0 Processor 1 APIC 0x2
Jun 24 15:17:47 asgard kernel: [ 985.012795] cache: parent cpu1 should not be sleeping
Jun 24 15:17:47 asgard kernel: [ 985.013122] CPU1 is up
Jun 24 15:17:47 asgard kernel: [ 985.013144] smpboot: Booting Node 0 Processor 2 APIC 0x4
Jun 24 15:17:47 asgard kernel: [ 985.013991] cache: parent cpu2 should not be sleeping
Jun 24 15:17:47 asgard kernel: [ 985.014348] CPU2 is up
Jun 24 15:17:47 asgard kernel: [ 985.014476] smpboot: Booting Node 0 Processor 3 APIC 0x6
Jun 24 15:17:47 asgard kernel: [ 985.015372] cache: parent cpu3 should not be sleeping
Jun 24 15:17:47 asgard kernel: [ 985.015735] CPU3 is up
Jun 24 15:17:47 asgard kernel: [ 985.015778] smpboot: Booting Node 0 Processor 4 APIC 0x1
Jun 24 15:17:47 asgard kernel: [ 985.016651] cache: parent cpu4 should not be sleeping
Jun 24 15:17:47 asgard kernel: [ 985.017220] CPU4 is up
Jun 24 15:17:47 asgard kernel: [ 985.017250] smpboot: Booting Node 0 Processor 5 APIC 0x3
Jun 24 15:17:47 asgard kernel: [ 985.017839] cache: parent cpu5 should not be sleeping
Jun 24 15:17:47 asgard kernel: [ 985.018234] CPU5 is up
Jun 24 15:17:47 asgard kernel: [ 985.018275] smpboot: Booting Node 0 Processor 6 APIC 0x5
Jun 24 15:17:47 asgard kernel: [ 985.019050] cache: parent cpu6 should not be sleeping
Jun 24 15:17:47 asgard kernel: [ 985.019469] CPU6 is up
Jun 24 15:17:47 asgard kernel: [ 985.019508] smpboot: Booting Node 0 Processor 7 APIC 0x7
Jun 24 15:17:47 asgard kernel: [ 985.020259] cache: parent cpu7 should not be sleeping
Jun 24 15:17:47 asgard kernel: [ 985.020732] CPU7 is up
Jun 24 15:17:47 asgard kernel: [ 985.029744] ACPI: Waking up from system sleep state S3
Jun 24 15:17:47 asgard kernel: [ 985.053833] ACPI: EC: interrupt unblocked
Jun 24 15:17:47 asgard kernel: [ 986.791476] ACPI: EC: event unblocked

Jun 24 15:17:47 asgard systemd[1]: Created slice User Slice of root.
Jun 24 15:17:47 asgard gsd-color[1821]: failed to set screen _ICC_PROFILE: Failed to open file “/home/gilbert/.local/share/icc/edid-1c820e5fd3f4716da10f18c70e8e338e.icc”: Permission denied
Jun 24 15:17:47 asgard systemd[1]: Starting User Manager for UID 0...
Jun 24 15:17:47 asgard systemd[1]: Started Session c12 of user root.
Jun 24 15:17:47 asgard systemd-sleep[3755]: System resumed.
Jun 24 15:17:47 asgard kernel: [ 987.600009] PM: suspend exit
Jun 24 15:17:47 asgard systemd[1]: Started Suspend.
Jun 24 15:17:47 asgard systemd[1]: sleep.target: Unit not needed anymore. Stopping.
Jun 24 15:17:47 asgard systemd[1]: Stopped target Sleep.
Jun 24 15:17:47 asgard systemd[1]: tlp-sleep.service: Unit not needed anymore. Stopping.
Jun 24 15:17:47 asgard systemd[1]: Stopping TLP suspend/resume...
Jun 24 15:17:47 asgard systemd[1]: Reached target Suspend.
Jun 24 15:17:47 asgard systemd[1]: suspend.target: Unit not needed anymore. Stopping.
Jun 24 15:17:47 asgard systemd[1]: Stopped target Suspend.
Jun 24 15:17:47 asgard NetworkManager[1042]: <info> [1593004667.5968] manager: sleep: wake requested (sleeping: yes enabled: yes)

gilbert@asgard:~$ cat /sys/power/mem_sleep
s2idle [deep]

You should get something like that.

5399

I run into this problem myself. After many hours or research I found the following Terminal command:

echo deep | sudo tee /sys/power/mem_sleep

This command will add "deep" sleep to Ubuntu. Be aware, you have to run the command every time you computer reboot after an update. I still looking for a permanent solution. 

To check if your computer is going in "deep sleep" run the following command after closing the lid and letting the computer going into sleep. Just open the lid and run the following:

sudo journalctl | grep "PM: suspend" | tail -2

The command should come back with "deep" in it. I hope this help.

5390

To make it survive boot, you need to add the mem_sleep_default=deep kernel parameter to grub config. See steps #1-2 Gilbou92 posted in the post above yours, then I believe you need to run 'sudo update-grub' (https://wiki.ubuntu.com/Kernel/KernelBootParameters)

 

On Fedora 32, the kernel parameter can be added with this command:

sudo grubby --update-kernel=ALL --args="mem_sleep_default=deep"

867

Unfortunately this is not working on my Dell XPS (on Debian stable).

I disabled the two "Sign of Life" options in BIOS, but I still don't have access to deep sleep mode.

Latest Solutions
Top Contributor