Hibernation, Ubuntu & Battery Life
Power savings for fun and profit!
3 min read
I've been playing quite a bit with my new (old) laptop, a Dell Latitude 7490. Great laptop for sure. Feel like a ThinkPad, great 1080p screen, decent battery life, i7, 16gb ram, but I digress. I would often pick up and put down what I was working on throughout the day, but not having to reopen everything each time I decide to boot back up. After much digging I discovered that while my laptop supported S3 sleep, hibernation was no where to be found. I also had been struggling with getting a decently long amount of usage out of the refurbished battery it came with.
I'm not 100% sure if this impacts anyone running other distribution's, but at least for me running Ubuntu MATE 22.04 LTS, the hibernation option is missing. This might also be related to having a custom data partition using BTRFS (which is AMAZING BTW).
I did some digging around Google and realized that there were TWO things that I needed to do to fix my problem.
Edit the following file and add the below and reboot.
[Re-enable hibernate by default in upower] Identity=unix-user:* Action=org.freedesktop.upower.hibernate ResultActive=yes [Re-enable hibernate by default in logind] Identity=unix-user:* Action=org.freedesktop.login1.hibernate ResultActive=yes
This would enable the menu option, but when I tried it, I would get a blank desktop. To fix this, you need to do a small edit to the GRUB boot loader.
Look up the UUID of your swap partition
cat /etc/fstab | grep swap
# swap was on /dev/sda2 during installation UUID=92cd717b-83f8-4aab-beb9-3cd7a84f9224 none swap sw 0 0
ADD the follow to your
resume=UUID=XXXXXXXXXXXXXXXXXreplacing the value here with the value you found from above
GRUB_DEFAULT="0" GRUB_TIMEOUT_STYLE="hidden" GRUB_TIMEOUT="5" GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`" GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=92cd717b-83f8-4aab-beb9-3cd7a84f9224" GRUB_CMDLINE_LINUX=""
sudo update-grub and REBOOT!
Sleep states 💻
In addition to the benefits of enabling hibernation, I would also recommend you check out both TLP (
- GitHub - linrunner/TLP: TLP - Optimize Linux Laptop Battery Life) and PowerTOP (GitHub - fenrus75/powertop: The Linux PowerTOP tool).
TLP has some great auto tune options to help you get he best battery life you can out of your laptop. PowerTOP replicates quite a few of the tweaks in TLP, but also gives you some handy stats as well. I would say to try to not use them both at the same time, as the have slightly different ideas on what settings to tweak.
If your having issues, also be sure to check to see what sleep states your laptop supports via
sudo dmesg | grep 'S3\|suspend' and
You can also get a quick look into how your battery health is looking via
upower -i /org/freedesktop/UPower/devices/battery_BAT0 or if you really want to see all the nuts and bolts
Some useful background info on different power states:
A Minimum Complete Tutorial of CPU Power Management, C-states and P-states
Running a calibrate with PowerTOP should give you a good estimate of how long your battery SHOULD last.
If you find that your laptop is not sleeping properly, I would dig through your BIOS settings to make sure that sleep is enabled. Also updating your BIOS can helps as well, but that's outside the scope of this article :wink:!
- As always, if anyone has any corrections or comments, feel free to message here or drop me a email.