Electricity towers

📷Fré Sonneveld

I bought a Lenovo IdeaPad 3 15ALC6. It features an AMD Ryzen 3 5300U with integrated graphics, 8GB of RAM and 512GB NVMe. These features are adequate for its low price, though an even better deal would have been the slightly more expensive model with AMD Ryzen 5 5500U. The main limitation I can see is the small amount of memory which is shared with the GPU, but this is common in budget laptops.

Its compatibility with Linux turned out to be excellent because Lenovo has apparenly made some effort to ensure Fedora and Ubuntu work smoothly on their laptops. The model I bought didn’t have an OS preinstalled and I decided to install Ubuntu 22.04.

Installation

The first thing to do before installation was to visit BIOS by pressing F2. You can select the boot media by pressing F12.

I disabled Secure Boot because it usually gets in the way of Linux distributions, although it’s not strictly necessary for Ubuntu.

Another option of interest was Set UMA Frame Buffer size. This gives you the option of choosing how much of the shared memory to be allocated to the GPU, either 512MB, 1GB or the default 2GB. If you leave it at the default setting, you will find that only 6GB out of 8GB are available to the main system and that’s not much.

After completing the installation, I wanted to try certain things that could improve the battery life. I took some hints from the Arch wiki. I configured the system to use the newer AMD P-State driver instead of ACPI CPUFreq. Phoronix has some benchmarks that show it to be marginally more energy efficient.

I modified /etc/default/grub to look like:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash amd_pstate=passive"

then ran sudo update-grub.

Phoronix has also benchmarked the power consumption of Gnome and KDE under Wayland and X.Org and found that Wayland is more power efficient in either Gnome or KDE.

Mostly AC power

If you mostly use the laptop connected to a power supply, Lenovo has a feature called Conservation Mode which can prolong the life of the battery. It keeps the battery charged at 50-60% instead of going up to 100% and staying there continuously, which can reduce its capacity over time. Here is a good source of information on the issue.

To enable Conservation Mode:

echo 1 | sudo tee /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode

To disable Conservation Mode:

echo 0 | sudo tee /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode

This feature is sticky, you only have to do it once and it survives across reboots.

Mostly battery

I plan to use this laptop now and then, mostly on battery. This means that the laptop will stay a lot of time in suspend mode. Suspend does use up a small amount of the energy over time, so a better idea would be to either Power Off or to enable Hibernate.

I enabled Suspend-Then-Hibernate. This mode combines the best of both options: The system is suspended when I close the lid. It starts again quickly when I open it. If I don’t use for 3 hours, then a RTC trigger wakes it up and hibernates it.

Here is how to enable Hibernate on Ubuntu 22.04:

  • Boot a live USB.
  • Start gparted
  • Shrink the main partition. The laptop has 8GB of RAM so I went with a 10GB partition, following this advice.
  • Create a swap partition with type linux-swap
  • Reboot into main installation.

Modify /etc/fstab to include the new swap partition:

# Get the UUID of the swap partition
lsblk --fs
sudo swapoff -a
## /etc/fstab
#/swapfile  none    swap    defaults        0       0 
UUID=<YOUR_SWAP_UUID>  none    swap    defaults        0       0

Comment out the line about the swapfile, we are using a swap partition now. You can later remove /swapfile to reclaim its space.

sudo swapon -a

Modify /etc/default/grub again to look like:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=<YOUR_SWAP_UUID>"
sudo update-grub

Try it:

sudo systemctl hibernate

This also enabled the option to Hibernate in Gnome’s Power Off/Log out menu. I didn’t need to install any package, since it’s all handled by systemd.

And now we can enable Suspend-Then-Hibernate:

Modify /etc/systemd/logind.conf. Change

#HandleLidSwitch=suspend

to

HandleLidSwitch=suspend-then-hibernate

You can also use hybrid-sleep if you prefer, which hibernates the system and then suspends it instead of powering off.

Have also a look at /etc/systemd/sleep.conf and in particular HibernateDelaySec=180min, the time before the system wakes up from suspension to hibernate.

Reboot.

Note that this method only handles suspension when you close the lid. If suspension is triggered by other means e.g. by inactivity after some time, then it will go into normal suspension. However it’s good enough for me. There are other options that may work better for you.

Another tip that will prevent the battery from losing capacity over time: Don’t fully charge it and don’t let it fully discharge. Keep the battery levels at 30%-80%.

Other tweaks

Although I prefer Firefox, I installed Google Chrome. I didn’t use snap but went instead with apt and the .deb straight from Google. The reason I picked Google Chrome, not even Chromium, was because I wanted to make sure video decoding was hardware accelerated (and more power efficient). You can verify that this is the case visiting chrome://gpu.

I also tried TLP and auto-cpufreq. These are often recommended to optimize battery life further. However, I am not sure they do something useful. Gnome has power-profiles-daemon and KDE has the equivalent powerdevil. Bluetooth, which is power hungry, is turned off by default by Gnome. So perhaps TLP isn’t as useful these days as it used to be. As for auto-cpufreq, what it does is toggle the scheduler between powersave and performance as well as turn CPU boost on and off, instead of letting schedutil handle it. It seems a bit messy to me and possibly hurting performance, so I didn’t keep it after all.

So what is the battery life on this Linux laptop compared to Windows? I haven’t run a benchmark but compared to the battery life of a Dell Latitude 3520, a laptop with similar specifications running Windows, my impression is that they last about the same. Linux however uses fewer resources, especially memory and it generally feels snappier.