0X01 Cause
The standby time of my lapta\op (ThinkPad X1C 2014) when running linux is sooo short, but when running windows, the time is OK. So I searched on web: what can I do, and find TLP, it’s easy to use, basically, we can use default configuration. As we now, Lenovo have a threshold config for battery, I do care about it, because each of my laptop, the battery damage fist, TLP support this config (ThinkPad only), location at /etc/default/tlp, we need the module called acpi-call.
The installation is smoothly.
sudo apt-get update && sudo apt-get install acpi-call-dkms
# OK, let's check if we success
sudo tlp-stat
# unfortunately, it still inactive
sudo dpkg -l | grep dkms # first, we have to check if we installed this package
sudo dkms install # I guess we should use like this.
# we will get a tip, tell us should not use like this, use help subcommand
sudo dkms help # oh, this autoinstall is OK
Usage: /usr/sbin/dkms [action] [options]
[action] = { add | remove | build | install | uninstall | match | autoinstall
| mkdriverdisk | mktarball | ldtarball | mkrpm | mkkmp | mkdeb | mkbmdeb | status }
[options] = [-m module] [-v module-version] [-k kernel-version] [-a arch]
[-d distro] [-c dkms.conf-location] [-q] [--force] [--all]
[--templatekernel=kernel] [--directive='cli-directive=cli-value']
[--config=kernel-.config-location] [--archive=tarball-location]
[--kernelsourcedir=source-location] [--no-prepare-kernel] [--no-initrd]
[--binaries-only] [--source-only] [-r release (SuSE)] [--verbose]
[--size] [--spec=specfile] [--media=floppy|iso|tar] [--legacy-postinst=0|1]
[--no-depmod]
[-j number]
Error! No action was specified.
sudo dkms autoinstall
0X02 What happened
I find the error message below. It said we don’t have the function copy_from_user.
DKMS make.log for acpi_call-1.2.0 for kernel 4.12.1-chrysalis (x8664)
Thu Jul 13 19:31:39 CEST 2017
make -C /lib/modules/4.12.1-chrysalis/build M=/var/lib/dkms/acpi_call/1.2.0/build modules
make[1]: Entering directory ‘/tmp/linux-4.12.1’
CC [M] /var/lib/dkms/acpi_call/1.2.0/build/acpi_call.o
/var/lib/dkms/acpi_call/1.2.0/build/acpi_call.c: In function ‘acpi_proc_write’:
/var/lib/dkms/acpi_call/1.2.0/build/acpi_call.c:307:9: error: implicit declaration of function ‘copy_from_user’ [-Werror=implicit-function-declaration]
if (copy_from_user( input, buff, len )) {
^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:309: /var/lib/dkms/acpi_call/1.2.0/build/acpi_call.o] Error 1
make[1]: *** [Makefile:1512: _module/var/lib/dkms/acpi_call/1.2.0/build] Error 2
make[1]: Leaving directory ‘/tmp/linux-4.12.1’
make: *** [Makefile:7: default] Error 2
I find several possibly solution:
- Add -Werror=implicit-function-declaration compile option
- use define to declare ( not suitable, I haven’t try it)
- we have not import right header (at first, I think it should not have this error, it’s system official package)
And when I read the web page above, I find the function copy_from_user may locate at two location: <asm/uaccess.h> or <linux/uaccess.h>, use locate command to finde the source code, it import <asm/uaccess.h>, I changed asm to linux, then run command below, I success.
sudo dkms autoinstall