I've just installed Ubuntu 20.04 on Lenovo Legion 5 15ARH05. The touchpad doesn't work and I read on multiple forums it's a common problem.

I tried to update kernel using Ubuntu Mainline Kernel Installer GUI app to 5.10.2 but I probably need (according to https://www.mail-archive.com/ubuntu-bugs@lists.ubuntu.com/msg5867550.html) to apply this patch:


I can't figure out how to do that. I've downloaded the compressed tar.gz file but now I'm stuck since I don't know how to do the patch.

I've tried sudo patch linux-47a0001436352c9853d72bf2071e85b316d688a2.tar.gz but that seems to do nothing (just hangs).

Do you know how to fix it? It should be fixed in the next kernel version but I can't wait.

EDIT: The touchpad works in BIOS.

EDIT: After following @dariofac's answer, it looked good but it raises error:

BTF: .tmp_vmlinux.btf: pahole version v1.15 is too old, need at least v1.16
Failed to generate BTF for vmlinux
make: *** [Makefile:1164: vmlinux] Error 1
  • Did you install it from a .deb or did you compile it from source? – dariofac Dec 22 '20 at 16:07
  • @dariofac To update the kernel I used GUI (Ubuntu Mainline Kernel Installer). To apply the patch, I just don't know how, I've downloaded the tar.gz but can't figure it out. – Milano Dec 22 '20 at 16:11
  • It seems that Mainline downloads a pre-built kernel (the one you can find here kernel.ubuntu.com/~kernel-ppa/mainline/v5.10.2/amd64) and installs it as a normal .deb file. – dariofac Dec 22 '20 at 16:32
  • @dariofac Thanks, it seems to work, the kernel is updated and touchpad recognized, although it still does not work. I need to check of other solutions probably. – Milano Dec 22 '20 at 16:43
  • the files you can find in the link I posted are not patched. To install the patched kernel, you have to follow the guide I posted as answer. – dariofac Dec 22 '20 at 16:46

The following is a simple guide to compile and install a kernel starting from sources. I did not test this guide with the .tag.gz linked, so my recommendation is to take a backup of the whole system before trying to install it.


To compile a kernel, you need to install some requirements first. To do so, issue:

sudo apt install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison

Extract sources

From the directory where you downloaded the archive, issue:

tar -xvzf linux-47a0001436352c9853d72bf2071e85b316d688a2.tar.gz

Move to the newly created directory using cd linux-47a0001436352c9853d72bf2071e85b316d688a2.

Configure kernel

Before compiling the kernel, you need to select which modules to include.

To copy the modules of your current kernel, just issue:

cp /boot/config-$(uname -r) .config

If now you issue make menuconfig a configuration window opens up and from there you can enable or disable every available module.

Compile and install kernel

To start compiling the kernel, issue:


and answer to the questions which may arise (they depend on the starting kernel and the kernel being compiled). This step will take a lot of time.

After this step, you have to install modules by issuing:

make modules_install

Also this step will take some time to complete.

Finally, to install the kernel issue:

sudo make install

Enable kernel on boot

To enable kernel on boot, issue:

sudo update-initramfs -c -k <version>

where you need to replace <version> with the version you actually compiled.

After this, update grub by issuing:

sudo update-grub
  • Looked good but eventually it printed this error: BTF: .tmp_vmlinux.btf: pahole version v1.15 is too old, need at least v1.16 Failed to generate BTF for vmlinux Try to disable CONFIG_DEBUG_INFO_BTF make: *** [Makefile:1164: vmlinux] Error 1 – Milano Dec 22 '20 at 19:24
  • @Milano try downloading this archive.ubuntu.com/ubuntu/pool/universe/d/dwarves-dfsg/… and installing it (using dpkg -i dwarves_1.17-1_amd64.deb) – dariofac Dec 22 '20 at 19:58
  • I've upgraded to 20.10 and run the commands again. Now I'm waiting for the finish. Thanks – Milano Dec 22 '20 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.