How-To Fix a Fast Draining Battery in Suspend Mode
If you recently switched from Microsoft Windows to Ubuntu MATE, you may have noticed that when you close your lid on your laptop it appears to go into suspend mode. However, you also noticed that when your laptop resumes, your power level had significantly dropped. This can be a bit frustrating, especially if you're new to Linux.
On this page, I will provide you with some information that may fix your issue. Your problem could come from a variety of different things, so don't get frustrated if the solutions below doesn't work for you. I enjoy when people provide me solutions to their problems. I usually update my webpage with a new solution and it helps me and the rest of the Linux community. People helping people is what GNU Linux is about. |
When your computer or laptop goes into suspend mode, it can go into one of four sleeps states: Suspend-To-Idle "s2idle" ("freeze"), Standby/Power-On Suspend "shallow" ("standby"), Suspend-to-RAM "deep," and Suspend-to-disk "disk." (ACPI defines levels of system sleep state support.) The properties of each of these sleep states are described below.
State: Suspend-To-Idle
ACPI state: S0
Label: "s2idle" ("freeze")
"This state is a generic, pure software, light-weight, system sleep state. It allows more energy to be saved relative to runtime idle by freezing user space and putting all I/O devices into low-power states (possibly lower-power than available at run time), such that the processors can spend more time in their idle states."
"This state can be used for platforms without Power-On Suspend/Suspend-to-RAM support, or it can be used in addition to Suspend-to-RAM to provide reduced resume latency. It is always supported."
State: Standby/Power-On Suspend
ACPI state: S1
Label: "shallow" ("standby")
"This state, if supported, offers moderate, though real, power savings, while providing a relatively low-latency transition back to a working system. No operating state is lost (the CPU retains power), so the system easily starts up again where it left off."
"In addition to freezing user space and putting all I/O devices into low-power states, which is done for Suspend-To-Idle too, nonboot CPUs are taken offline and all low-level system functions are suspended during transitions into this state. For this reason, it should allow more energy to be saved relative to Suspend-To-Idle, but the resume latency will generally be greater than for that state."
State: Suspend-to-RAM
ACPI state: S3
Label: "deep"
"This state, if supported, offers significant power savings as everything in the system is put into a low-power state, except for memory, which should be placed into the self-refresh mode to retain its contents. All of the steps carried out when entering Power-On Suspend are also carried out during transitions to STR. Additional operations may take place depending on the platform capabilities. In particular, on ACPI systems the kernel passes control to the BIOS (platform firmware) as the last step during STR transitions and that usually results in powering down some more low-level components that aren't directly controlled by the kernel."
"System and device state is saved and kept in memory. All devices are suspended and put into low-power states. In many cases, all peripheral buses lose power when entering STR, so devices must be able to handle the transition back to the "on" state."
"For at least ACPI, STR requires some minimal boot-strapping code to resume the system from it. This may be the case on other platforms too."
State: Suspend-to-disk
ACPI state: S4
Label: "disk"
"This state offers the greatest power savings, and can be used even in the absence of low-level platform support for power management. This state operates similarly to Suspend-to-RAM, but includes a final step of writing memory contents to disk. On resume, this is read and memory is restored to its pre-suspend state."
"STD can be handled by the firmware or the kernel. If it is handled by the firmware, it usually requires a dedicated partition that must be setup via another operating system for it to use. Despite the inconvenience, this method requires minimal work by the kernel, since the firmware will also handle restoring memory contents on resume."
"For suspend-to-disk, a mechanism called 'swsusp' (Swap Suspend) is used to write memory contents to free swap space. swsusp has some restrictive requirements, but should work in most cases. Some, albeit outdated, documentation can be found in Documentation/power/swsusp.txt. Alternatively, userspace can do most of the actual suspend to disk work, see userland-swsusp.txt."
"Once memory state is written to disk, the system may either enter a low-power state (like ACPI S4), or it may simply power down. Powering down offers greater savings, and allows this mechanism to work on any system. However, entering a real low-power state allows the user to trigger wake up events (e.g. pressing a key or opening a laptop lid)." -- Quoted text by Rafael J. Wysocki
State: Suspend-To-Idle
ACPI state: S0
Label: "s2idle" ("freeze")
"This state is a generic, pure software, light-weight, system sleep state. It allows more energy to be saved relative to runtime idle by freezing user space and putting all I/O devices into low-power states (possibly lower-power than available at run time), such that the processors can spend more time in their idle states."
"This state can be used for platforms without Power-On Suspend/Suspend-to-RAM support, or it can be used in addition to Suspend-to-RAM to provide reduced resume latency. It is always supported."
State: Standby/Power-On Suspend
ACPI state: S1
Label: "shallow" ("standby")
"This state, if supported, offers moderate, though real, power savings, while providing a relatively low-latency transition back to a working system. No operating state is lost (the CPU retains power), so the system easily starts up again where it left off."
"In addition to freezing user space and putting all I/O devices into low-power states, which is done for Suspend-To-Idle too, nonboot CPUs are taken offline and all low-level system functions are suspended during transitions into this state. For this reason, it should allow more energy to be saved relative to Suspend-To-Idle, but the resume latency will generally be greater than for that state."
State: Suspend-to-RAM
ACPI state: S3
Label: "deep"
"This state, if supported, offers significant power savings as everything in the system is put into a low-power state, except for memory, which should be placed into the self-refresh mode to retain its contents. All of the steps carried out when entering Power-On Suspend are also carried out during transitions to STR. Additional operations may take place depending on the platform capabilities. In particular, on ACPI systems the kernel passes control to the BIOS (platform firmware) as the last step during STR transitions and that usually results in powering down some more low-level components that aren't directly controlled by the kernel."
"System and device state is saved and kept in memory. All devices are suspended and put into low-power states. In many cases, all peripheral buses lose power when entering STR, so devices must be able to handle the transition back to the "on" state."
"For at least ACPI, STR requires some minimal boot-strapping code to resume the system from it. This may be the case on other platforms too."
State: Suspend-to-disk
ACPI state: S4
Label: "disk"
"This state offers the greatest power savings, and can be used even in the absence of low-level platform support for power management. This state operates similarly to Suspend-to-RAM, but includes a final step of writing memory contents to disk. On resume, this is read and memory is restored to its pre-suspend state."
"STD can be handled by the firmware or the kernel. If it is handled by the firmware, it usually requires a dedicated partition that must be setup via another operating system for it to use. Despite the inconvenience, this method requires minimal work by the kernel, since the firmware will also handle restoring memory contents on resume."
"For suspend-to-disk, a mechanism called 'swsusp' (Swap Suspend) is used to write memory contents to free swap space. swsusp has some restrictive requirements, but should work in most cases. Some, albeit outdated, documentation can be found in Documentation/power/swsusp.txt. Alternatively, userspace can do most of the actual suspend to disk work, see userland-swsusp.txt."
"Once memory state is written to disk, the system may either enter a low-power state (like ACPI S4), or it may simply power down. Powering down offers greater savings, and allows this mechanism to work on any system. However, entering a real low-power state allows the user to trigger wake up events (e.g. pressing a key or opening a laptop lid)." -- Quoted text by Rafael J. Wysocki
In a lot of suspend problems, laptops go into s2idle when it should be going into deep suspend mode. The s2idle uses more power during suspend mode compared to the amount of power used in deep suspend mode. Here's some steps that you should try to determine if your computer is going into s2idle or deep suspend mode.
Open the Terminal and enter sudo pm-suspend. This will automatically put your laptop in suspend mode.
Press your power button or move your mouse to wake your system up or bring it out of suspend mode. Then open your Terminal and enter
sudo journalctl | grep "PM: suspend" | tail -2. It will display your sleep status in parentheses (s2idle) or (deep).
sudo journalctl | grep "PM: suspend" | tail -2. It will display your sleep status in parentheses (s2idle) or (deep).
My laptop is going into "deep" suspend mode and it doesn't have problem with the battery draining while it's in suspend mode. However, your Terminal might display:
Jan 25 00:43:38 HP-Pavilion kernel: PM: suspend entry (s2idle)
Jan 25 00:43:53 HP-Pavilion kernel: PM: suspend exit
This means that your system is not going into deep sleep mode.
Jan 25 00:43:38 HP-Pavilion kernel: PM: suspend entry (s2idle)
Jan 25 00:43:53 HP-Pavilion kernel: PM: suspend exit
This means that your system is not going into deep sleep mode.
You can also check by opening your Terminal and typing the following command: cat /sys/power/mem_sleep
As you can see, deep is surrounded by brackets which means that is the sleep status mode of my system.
If yours shows [s2idle] deep then your system is going into s2idle mode.
If yours shows [s2idle] deep then your system is going into s2idle mode.
To fix this type of problem you'll need to edit your bootloader command. I will use gedit to edit my bootloader. You can use your favorite text editor or you can install gedit by opening your Terminal and entering sudo apt-get install gedit. Open your Terminal and enter the following: sudo -H gedit /etc/default/grub. Press the Enter or Return key and enter your password.
Locate the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
Replace this line with GRUB_CMDLINE_LINUX_DEFAULT="quiet splash mem_sleep_default=deep" and then click the Save button.
After you save and close your text editor, you'll need to regenerate your grub configuration by entering the following in your Terminal: sudo grub-mkconfig -o /boot/grub/grub.cfg
After you press Enter or Return and type in your password, it will regenerate your grub configuration,