Sleep Battery Drain -- Deepin

When I go into sleep mode (let’s say before bed – at 80% battery) and then I open up my laptop again later (when I wake up), my battery is completely drained.

I tried:
(1) echo deep > /sys/power/mem_sleep after I saw that cat /sys/power/mem_sleep had s2idle selected instead of deep. But that did not seem to fix the issue… that being said on reboot it is back at s2idle instead of deep… RedditPost. If I also then try to write mem to /sys/power/state after that, the laptop screen will not turn back on no matter what and I have to hard shutdown and restart (which I know is bad, but I try everything else first).

(2) I read in the above link, that to make the change to deep permenant to try changing "in your kernel cmdline in your bootloader: mem_sleep_default=deep" – but I haven’t figured out how to do that or where that is.

(3) TLP is already installed

(4) While I see reports of sleep being an issue for some Dell XPS computers, sleep has worked fine in Windows and a previous linux installation before on this same laptop

(5) Output of systemctl suspend journalctl | grep "PM: suspend" gives Jan 19 09:28:08 keith-xps139300 kernel: PM: suspend entry (s2idle) Jan 19 09:28:31 keith-xps139300 kernel: PM: suspend exit – which I want deep, but not sure how to change that

– If I had to guess, I hope that I just need to figure out how to execute #2 “change mem_sleep_default to deep in linux kernel commandline”. I saw that mentioned here too Linux Sleep States but again, I cannot figure out how to actually do that.

Here’s some potentially helpful information on my system:

inxi --full --admin --verbosity=7 --filter --no-host
System:    Kernel: 5.10.8-arch1-1 x86_64 bits: 64 compiler: gcc v: 10.2.0 
           parameters: BOOT_IMAGE=/boot/vmlinuz-linux 
           root=UUID=00c1d828-42cc-4e2b-93f7-c6c15462005f rw quiet loglevel=3 nowatchdog 
           Desktop: Deepin 20.1 tk: Qt 5.15.2 info: dde-dock wm: kwin_x11 dm: LightDM 1.30.0 
           Distro: EndeavourOS 
Machine:   Type: Laptop System: Dell product: XPS 13 9300 v: N/A serial: <filter> Chassis: 
           type: 10 serial: <filter> 
           Mobo: Dell model: 077Y9N v: A00 serial: <filter> UEFI: Dell v: 1.4.1 
           date: 11/23/2020 
Battery:   ID-1: BAT0 charge: 25.8 Wh condition: 45.5/51.0 Wh (89%) volts: 8.1/7.6 
           model: SMP DELL WN0N005 type: Li-poly serial: <filter> status: Charging 
Memory:    RAM: total: 15.22 GiB used: 2.23 GiB (14.6%) 
           RAM Report: missing: Required program dmidecode not available 
CPU:       Info: Quad Core model: Intel Core i7-1065G7 bits: 64 type: MT MCP arch: Ice Lake 
           family: 6 model-id: 7E (126) stepping: 5 microcode: A0 L2 cache: 8 MiB 
           bogomips: 23968 
           Speed: 3800 MHz min/max: 400/3900 MHz Core speeds (MHz): 1: 3800 2: 3800 3: 2071 
           4: 3806 5: 1935 6: 2054 7: 1389 8: 1941 
           Flags: 3dnowprefetch abm acpi adx aes aperfmperf apic arat arch_capabilities 
           arch_perfmon art avx avx2 avx512_bitalg avx512_vbmi2 avx512_vnni avx512_vpopcntdq 
           avx512bw avx512cd avx512dq avx512f avx512ifma avx512vbmi avx512vl bmi1 bmi2 bts 
           clflush clflushopt cmov constant_tsc cpuid cpuid_fault cx16 cx8 de ds_cpl dtes64 
           dtherm dts epb ept ept_ad erms est f16c flexpriority flush_l1d fma fpu fsgsbase fsrm 
           fxsr gfni ht hwp hwp_act_window hwp_epp hwp_pkg_req ibpb ibrs ibrs_enhanced ida 
           intel_pt invpcid invpcid_single lahf_lm lm mca mce md_clear mmx monitor movbe msr 
           mtrr nonstop_tsc nopl nx ospke pae pat pbe pcid pclmulqdq pdcm pdpe1gb pebs pge pku 
           pln pni popcnt pse pse36 pts rdpid rdrand rdseed rdtscp rep_good sdbg sep sha_ni 
           smap smep split_lock_detect ss ssbd sse sse2 sse4_1 sse4_2 ssse3 stibp syscall tm 
           tm2 tpr_shadow tsc tsc_adjust tsc_deadline_timer tsc_known_freq umip vaes vme vmx 
           vnmi vpclmulqdq vpid x2apic xgetbv1 xsave xsavec xsaveopt xsaves xtopology xtpr 
           Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled 
           Type: l1tf status: Not affected 
           Type: mds status: Not affected 
           Type: meltdown status: Not affected 
           Type: spec_store_bypass 
           mitigation: Speculative Store Bypass disabled via prctl and seccomp 
           Type: spectre_v1 
           mitigation: usercopy/swapgs barriers and __user pointer sanitization 
           Type: spectre_v2 mitigation: Enhanced IBRS, IBPB: conditional, RSB filling 
           Type: srbds status: Not affected 
           Type: tsx_async_abort status: Not affected 
Graphics:  Device-1: Intel Iris Plus Graphics G7 vendor: Dell driver: i915 v: kernel 
           bus ID: 00:02.0 chip ID: 8086:8a52 
           Device-2: Realtek Integrated_Webcam_HD type: USB driver: uvcvideo bus ID: 3-9:3 
           chip ID: 0bda:5511 serial: <filter> 
           Display: x11 server: X.org 1.20.10 compositor: kwin_x11 driver: intel 
           unloaded: fbdev,modesetting,vesa resolution: <missing: xdpyinfo> 
           Message: Unable to show advanced data. Required tool glxinfo missing. 
Audio:     Device-1: Intel Smart Sound Audio vendor: Dell driver: snd_hda_intel v: kernel 
           alternate: snd_sof_pci bus ID: 00:1f.3 chip ID: 8086:34c8 
           Device-2: Realtek USB Audio type: USB driver: snd-usb-audio bus ID: 5-2.3.4:7 
           chip ID: 0bda:402e serial: <filter> 
           Sound Server: ALSA v: k5.10.8-arch1-1 
Network:   Device-1: Intel Killer Wi-Fi 6 AX1650i 160MHz Wireless Network Adapter 
           vendor: Bigfoot Networks driver: iwlwifi v: kernel port: 4000 bus ID: 00:14.3 
           chip ID: 8086:34f0 
           IF: wlan0 state: up mac: <filter> 
           IP v4: <filter> type: dynamic noprefixroute scope: global broadcast: <filter> 
           IP v6: <filter> type: noprefixroute scope: link 
           Device-2: Realtek RTL8153 Gigabit Ethernet Adapter type: USB driver: r8152 
           bus ID: 6-2.4:4 chip ID: 0bda:8153 serial: <filter> 
           IF: enp3s0u2u4 state: up speed: 1000 Mbps duplex: full mac: <filter> 
           IP v4: <filter> type: dynamic noprefixroute scope: global broadcast: <filter> 
           IP v6: <filter> type: noprefixroute scope: link 
           WAN IP: <filter> 
RAID:      Message: No RAID data was found. 
Drives:    Local Storage: total: 957.62 GiB used: 61.57 GiB (6.4%) 
           SMART Message: Unable to run smartctl. Root privileges required. 
           ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Intel model: SSDPEMKF010T8 NVMe 1024GB 
           size: 953.87 GiB block size: physical: 512 B logical: 512 B speed: 31.6 Gb/s 
           lanes: 4 serial: <filter> rev: 7003 temp: 36.9 C 
           ID-2: /dev/sda maj-min: 8:0 type: USB vendor: SanDisk model: Cruzer size: 3.75 GiB 
           block size: physical: 512 B logical: 512 B serial: <filter> rev: 8.02 
           SMART Message: Unknown USB bridge. Flash drive/Unsupported enclosure? 
           Message: No Optical or Floppy data was found. 
Partition: ID-1: / raw size: 390.62 GiB size: 383.49 GiB (98.17%) used: 61.48 GiB (16.0%) 
           fs: ext4 dev: /dev/nvme0n1p7 maj-min: 259:7 label: N/A 
           uuid: 00c1d828-42cc-4e2b-93f7-c6c15462005f 
           ID-2: /boot/efi raw size: 190 MiB size: 186 MiB (97.89%) used: 91.2 MiB (49.0%) 
           fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1 label: ESP uuid: 30DF-6832 
           ID-3: /run/media/keithd/ENDEAVOUROS raw size: 1.81 GiB size: <superuser required> 
           used: <superuser required> fs: iso9660 dev: /dev/sda1 maj-min: 8:1 
           label: ENDEAVOUROS uuid: 2020-09-20-20-31-31-00 
Swap:      Alert: No Swap data was found. 
Unmounted: ID-1: /dev/nvme0n1p2 maj-min: 259:2 size: 128 MiB fs: <superuser required> 
           label: N/A uuid: N/A 
           ID-2: /dev/nvme0n1p3 maj-min: 259:3 size: 547.55 GiB fs: bitlocker label: N/A 
           uuid: N/A 
           ID-3: /dev/nvme0n1p4 maj-min: 259:4 size: 990 MiB fs: ntfs label: WINRETOOLS 
           uuid: 3830AA4330AA07C8 
           ID-4: /dev/nvme0n1p5 maj-min: 259:5 size: 13.11 GiB fs: ntfs label: Image 
           uuid: F812AA9A12AA5D7E 
           ID-5: /dev/nvme0n1p6 maj-min: 259:6 size: 1.3 GiB fs: ntfs label: DELLSUPPORT 
           uuid: BE181DA1181D59AB 
           ID-6: /dev/sda2 maj-min: 8:2 size: 64 MiB fs: vfat label: ARCHISO_EFI 
           uuid: 8D52-3AEA 
USB:       Hub: 1-0:1 info: Full speed (or root) Hub ports: 1 rev: 2.0 speed: 480 Mb/s 
           chip ID: 1d6b:0002 
           Hub: 2-0:1 info: Full speed (or root) Hub ports: 4 rev: 3.1 speed: 10 Gb/s 
           chip ID: 1d6b:0003 
           Hub: 3-0:1 info: Full speed (or root) Hub ports: 12 rev: 2.0 speed: 480 Mb/s 
           chip ID: 1d6b:0002 
           Device-1: 3-5:2 info: Shenzhen Goodix FingerPrint type: <vendor specific> 
           driver: N/A interfaces: 1 rev: 2.0 speed: 12 Mb/s chip ID: 27c6:533c 
           Device-2: 3-9:3 info: Realtek Integrated_Webcam_HD type: Video driver: uvcvideo 
           interfaces: 5 rev: 2.0 speed: 480 Mb/s chip ID: 0bda:5511 serial: <filter> 
           Device-3: 3-10:4 info: Intel type: Bluetooth driver: btusb interfaces: 2 rev: 2.0 
           speed: 12 Mb/s chip ID: 8087:0026 
           Hub: 4-0:1 info: Full speed (or root) Hub ports: 6 rev: 3.1 speed: 10 Gb/s 
           chip ID: 1d6b:0003 
           Hub: 5-0:1 info: Full speed (or root) Hub ports: 2 rev: 2.0 speed: 480 Mb/s 
           chip ID: 1d6b:0002 
           Hub: 5-2:2 info: Realtek Dell dock ports: 5 rev: 2.1 speed: 480 Mb/s 
           chip ID: 0bda:5487 
           Hub: 5-2.3:3 info: Realtek Dell dock ports: 6 rev: 2.1 speed: 480 Mb/s 
           chip ID: 0bda:5413 
           Device-1: 5-2.3.1:5 info: Logitech Unifying Receiver type: Keyboard,Mouse,HID 
           driver: logitech-djreceiver,usbhid interfaces: 3 rev: 2.0 speed: 12 Mb/s 
           chip ID: 046d:c52b 
           Device-2: 5-2.3.2:6 info: SanDisk Cruzer type: Mass Storage driver: usb-storage 
           interfaces: 1 rev: 2.0 speed: 480 Mb/s chip ID: 0781:5530 serial: <filter> 
           Device-3: 5-2.3.4:7 info: Realtek USB Audio type: Audio driver: snd-usb-audio 
           interfaces: 4 rev: 2.0 speed: 480 Mb/s chip ID: 0bda:402e serial: <filter> 
           Device-4: 5-2.3.5:8 info: Dell Dell dock type: HID driver: hid-generic,usbhid 
           interfaces: 1 rev: 2.0 speed: 480 Mb/s chip ID: 413c:b06f 
           Device-5: 5-2.5:4 info: Dell Dell dock type: HID driver: hid-generic,usbhid 
           interfaces: 1 rev: 2.0 speed: 480 Mb/s chip ID: 413c:b06e 
           Hub: 6-0:1 info: Full speed (or root) Hub ports: 2 rev: 3.1 speed: 10 Gb/s 
           chip ID: 1d6b:0003 
           Hub: 6-2:2 info: Realtek Dell dock ports: 4 rev: 3.1 speed: 10 Gb/s 
           chip ID: 0bda:0487 
           Hub: 6-2.3:3 info: Realtek Dell dock ports: 4 rev: 3.1 speed: 5 Gb/s 
           chip ID: 0bda:0413 
           Device-1: 6-2.4:4 info: Realtek RTL8153 Gigabit Ethernet Adapter type: Network 
           driver: r8152 interfaces: 1 rev: 3.0 speed: 5 Gb/s chip ID: 0bda:8153 
           serial: <filter> 
Sensors:   System Temperatures: cpu: 58.0 C mobo: N/A 
           Fan Speeds (RPM): cpu: 5438 mobo: 5093 fan-2: 
Info:      Processes: 262 Uptime: 3m wakeups: 952 Init: systemd v: 247 Compilers: gcc: 10.2.0 
           Packages: pacman: 1244 lib: 419 Shell: Bash v: 5.1.4 running in: deepin-terminal 
           inxi: 3.2.01 

Thank you!

You say this is a Deepin issue - have you tried with a different DE?

https://wiki.archlinux.org/index.php/Kernel_parameters#GRUB

1 Like

I have not really. I guess I did not know under what category to post it on or where the issue stemmed from. It worked fine when I had Manjaro Gnome and Plasma before. But I have not tried with a different DE on EndeavorOS. I will try to figure it out from your link. Thank you!

1 Like

OK, to document what I’ve done in case it helps someone else in the future:

I edited /etc/default/grub and appended my kernel option mem_sleep_default=deep between the quotes in the GRUB_CMDLINE_LINUX_DEFAULT line… so it ended looking like:
GRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel=3 nowatchdog mem_sleep_default=deep"

Then automatically re-generated the grub.cfg file with:
grub-mkconfig -o /boot/grub/grub.cfg

All of this I got thanks to your link in your previous comment, under Grub section for Kernel Parameters. I am hoping that solves it and I will report back if not!

2 Likes

OK. That seems to make it go into Deep Sleep, but now it can’t wake up from it! If I touch the power button it makes sounds like it’s turning on (I hear the Deepin notification sound) but the screen stays stuck at the Dell Loading screen (black screen with white Dell symbol) and won’t change from there :/. Maybe Dell made deep sleep impossible to use/wake-up-from? Or is this a common issue for many computers and deep sleep and there is another work-around? I had to hard restart it with pushing down the power button and holding it down :/.

1 Like

If sleep works with other distros then you’d have to look at the differences. One good starting point is the kernel - try linux-lts and see if that makes a difference, there are some older LTS kernels available, and other kernels like linux-lqx which are compiled with different settings than linux.

I appreciate your help. Unfortunately using linux-lts did not make a difference. I will try other kernels later… I was pretty sure it worked with other distributions, but it has been a while since I last tried, so perhaps I am incorrect… I remember it being a struggle with Windows for a while, but then a BIOS update “fixed” it… I wonder if it’s another issue with that sort of thing. It looks like online that a lot of Dell XPS are “unable to go into an S3 state” … which I don’t completely understand because it appears it goes into S3 fine now, but can’t get out of it properly…

1 Like

It will also be reading the model-specific page on the Arch wiki:

https://wiki.archlinux.org/index.php/Dell_XPS_13_(9300)#Power_Management

Summary: seems to have various issues, some, but not all of them, resolvable…

1 Like

Amazing. So to document: I edited /etc/default/grub and appended mem_sleep_default=deep and intel_iommu=off to GRUB_CMDLINE_LINUX_DEFAULT, so it looks like GRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel=3 nowatchdog mem_sleep_default=deep intel_iommu=off"

Then I regenerated the grub.cfg with grub-mkconfig -o /boot/grub/grub.cfg

Then restarted, clicking F2 repeatedly to get to BIOS, went to POST Behavior, disabled “Display Logo Sign of Life” saved/exited.

Then I tested it by suspending, and then clicking the power button to unsuspend and it successfully came out of suspend! I am not sure if the intel_iommu=off was necessarily needed or not… also unsure if it has any repercussions.

I will test it more tonight by leaving it in sleep and then checking the battery drain before marking as solved for sure.

But thank you so very much. Extremely helpful!

1 Like

OK we’re close – I tried closing the lid yesterday (because I have it set to suspend on lid closure) and then in the morning my battery was completely drained… but I suspect it’s because it is no longer suspending at all on lid closure (I confirm this by closing the lid, waiting a bit, and then opening to a completely “on” screen…). I have confirmed though I can suspend it by using the normal on the screen way, or when I have it set to suspend with power button, that works too.

Anyways, I suspect it not suspending with lid closure may be a separate issue.

1 Like