Dec 092016
 

I’ve had my Toshiba Satellite L750D laptop for quite a few years and when I first had it, the battery would show up in the battery meter in Ubuntu. Over the years and after a few Ubuntu upgrades, the battery just disappeared. The system wouldn’t detect the battery at all anymore. I tried all sorts of things to get it to discover the battery, reinserting, restarting, reinstalling, re-everything-else too, but it just wouldn’t show up.

After quite a bit of research, I finally came across this kernel bug post explaining that the issue is in fact not with Ubuntu, but with the BIOS in this laptop. The first clue to this was with these messages in the syslog –

kernel: [ 1.169722] ACPI Error: Method parse/execution failed [\_SB.BAT1.UBIX] (Node ffff8803fe8e2168), AE_AML_PACKAGE_LIMIT (20150930/psparse-542)
kernel: [ 1.169730] ACPI Error: Method parse/execution failed [\_SB.BAT1._BIX] (Node ffff8803fe8e20f0), AE_AML_PACKAGE_LIMIT (20150930/psparse-542)
kernel: [ 1.169737] ACPI Exception: AE_AML_PACKAGE_LIMIT, Evaluating _BIX (20150930/battery-450)
kernel: [ 1.193307] ACPI Error: Method parse/execution failed [\_SB.BAT1.UBIX] (Node ffff8803fe8e2168), AE_AML_PACKAGE_LIMIT (20150930/psparse-542)
kernel: [ 1.193314] ACPI Error: Method parse/execution failed [\_SB.BAT1._BIX] (Node ffff8803fe8e20f0), AE_AML_PACKAGE_LIMIT (20150930/psparse-542)
kernel: [ 1.193419] ACPI Exception: AE_AML_PACKAGE_LIMIT, Evaluating _BIX (20150930/battery-450)
kernel: [ 1.217331] ACPI Error: Method parse/execution failed [\_SB.BAT1.UBIX] (Node ffff8803fe8e2168), AE_AML_PACKAGE_LIMIT (20150930/psparse-542)
kernel: [ 1.217338] ACPI Error: Method parse/execution failed [\_SB.BAT1._BIX] (Node ffff8803fe8e20f0), AE_AML_PACKAGE_LIMIT (20150930/psparse-542)
kernel: [ 1.217343] ACPI Exception: AE_AML_PACKAGE_LIMIT, Evaluating _BIX (20150930/battery-450)
kernel: [ 1.241294] ACPI Error: Method parse/execution failed [\_SB.BAT1.UBIX] (Node ffff8803fe8e2168), AE_AML_PACKAGE_LIMIT (20150930/psparse-542)
kernel: [ 1.241301] ACPI Error: Method parse/execution failed [\_SB.BAT1._BIX] (Node ffff8803fe8e20f0), AE_AML_PACKAGE_LIMIT (20150930/psparse-542)
kernel: [ 1.241306] ACPI Exception: AE_AML_PACKAGE_LIMIT, Evaluating _BIX (20150930/battery-450)
kernel: [ 1.265292] ACPI Error: Method parse/execution failed [\_SB.BAT1.UBIX] (Node ffff8803fe8e2168), AE_AML_PACKAGE_LIMIT (20150930/psparse-542)
[ 1.265298] ACPI Error: Method parse/execution failed [\_SB.BAT1._BIX] (Node ffff8803fe8e20f0), AE_AML_PACKAGE_LIMIT (20150930/psparse-542)
kernel: [ 1.265304] ACPI Exception: AE_AML_PACKAGE_LIMIT, Evaluating _BIX (20150930/battery-450)

It took quite a while of Googling these messages before I came across the kernel bug that gave me my solution. One of the members of the list contributed a patch that actually removes the functionality that the kernel checks for so that it never encounters the buggy BIOS at all. The patch just comments out the 2 lines that causes the issue so I decided to patch my kernel manually.

First thing I needed to do was to download the source code for the kernel from the apt repositories.
I’ve run all commands below as root here (sudo -i), otherwise you’ll need to prepend sudo to these commands.

# apt-get install linux-source

Once the source is downloaded, uncompress it into the /usr/src directory. I also copied the configuration file from the current running kernel into the source tree so that I wouldn’t need to reconfigure the kernel.
Keep in mind that these paths may change with later versions of kernels.

# cd /usr/src/linux-source-4.4.0
# tar -xvjf linux-source-4.4.0.tar.bz2
# cp /boot/config-`uname -r` linux-source-4.4.0/.config

I found the battery.c file which needed to be modified. I’ve downloaded the patch file and just applied it to the kernel tree. The alternative way of doing this is to just comment out the 2 lines specified in the patch. I’ll cover both ways here.

The first way is applying the patch.

# wget -O ubixpatch "https://bugzilla.kernel.org/attachment.cgi?id=198891&action=diff&context=patch&collapsed=&headers=1&format=raw"
# cd linux-source-4.4.0
# patch -p1 < ../ubixpatch

The second way is to manually edit the file. Replace nano with your favourite text editor.

# cd linux-source-4.4.0
# nano drivers/acpi/battery.c

Then find the line the following 2 lines and comment them out with //s.

if (acpi_has_method(battery->device->handle, "_BIX"))
set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags);

So it should look like this -

// if (acpi_has_method(battery->device->handle, "_BIX"))
// set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags);

Once the modifications have been done, the kernel can be compiled with the following commands -
I have a dual core CPU, so I've used -j2 to compile with. Feel free to start more threads by changing the 2 to a 4 if you have a quadcore CPU.

# make -j2
...Queue waiting for the kernel to compile...
# make modules_install install

Once the kernel was compiled, I rebooted it and could finally see how much battery I had left.

Share

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)