If you’re using a ThinkPad laptop with Ubuntu Linux, you might be probably also using a package called
acpi-call-dkms. This package installs a kernel module that provides a way for software to do ACPI calls. One of the most popular program to use it – is TLP.
If you run Ubuntu 21.10 and have
acpi-call-dkms installed, you can check if it works for you by running this command:
sudo dmesg | grep "BUG: kernel NULL pointer dereference" -A 10
In my case among the lines there was something like this:
[45420.141212] BUG: kernel NULL pointer dereference, address: 0000000000000000 [45420.141217] #PF: supervisor instruction fetch in kernel mode [45420.141220] #PF: error_code(0x0010) - not-present page [45420.141221] PGD 0 P4D 0 [45420.141224] Oops: 0010 [#4] SMP NOPTI [45420.141226] CPU: 3 PID: 85578 Comm: tpacpi-bat Tainted: G D O 5.13.0-19-generic #1 [45420.141229] Hardware name: LENOVO 20NLCTO1WW/20NLCTO1WW, BIOS R13ET49P(1.23 ) 11/24/2020 [45420.141231] RIP: 0010:0x0 [45420.141236] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6. [45420.141238] RSP: 0018:ffffa60ec2fc3ef0 EFLAGS: 00010246
Because of that issue TLP can’t set battery charge thresholds, so if you want to preserve your laptop’s battery in good health, this issue won’t let you do that.
But worry not, as there’s a solution!
It seems like Canonical builds
acpi-call-dkms package from a rather outdated source – mkottman/acpi_call, while there’s another version of this module maintained by NixOS community: nix-community/acpi_call.
The latter works perfectly fine with the latest Linux version and that’s what we’re going to use.
Time needed: 5 minutes.
Here’s how to make Ubuntu 21.10 work with acpi-call
- Remove previously installed acpi-call-dkms package (if any)
sudo apt purge acpi-call-dkms
- Install git (if you don’t have it installed yet)
sudo apt install git
- Clone the repository at nix-community/acpi_call
git clone --branch v1.2.2 https://github.com/nix-community/acpi_call.git
- Navigate to the cloned repository
- Prepare dkms.conf file
- Copy the module source to the shared sources directory
sudo cp -R . /usr/src/acpi-call-1.2.2
- Add the module to the dkms tree for build
sudo dkms add -m acpi-call -v 1.2.2
- Build the module
sudo dkms build -m acpi-call -v 1.2.2
- Install the module
sudo dkms install -m acpi-call -v 1.2.2
Voila! Now acpi-call module will work again and TLP will be able to control battery charge thresholds.