1

Main Question:

Need a solution to apply a hardware support patch to my current working kernel in Ubuntu 22.04, so that it will fix the exact issue (here keyboard not working) without affecting other settings.

Background

Tried dual booting Ubuntu on my laptop(Asus vivobook s14-K3402ZA), the installation succeeded but keyboard was not working from boot, later found that only external keyboard is supporting and internal keyboard not working with Ubuntu 22.04 LTS - kernel 5.15.0-50-generic

The issue was identified at “Try before install” and do proceed because I found a patch online that solved the issue for similar models - from the information got from comments It will be added in a future 6.1 kernel release.

But in order to get it working on current mainline kernel, Tried the steps mentioned in this answer.

Downloaded latest longterm 5.15 release 5.15.74, Successfully complied the .deb package and installed - the keyboard issue fixed but there are several other issues regarding display brightness, scaling, refresh rate etc.

2 Answers 2

2

I think the issue is because the Ubuntu / Debian release kernel comes with some extra patches or may be due to the configuration difference in installed kernel version and the one from kernel.org.

Note that 5.15.74 is a mainline Linux version and mentioned 5.15.0-50 is an Ubuntu version, both are not same.

As all other functionalities are working in source kernel, it is better to build a custom patched kernel from source kernel to correct the issue.

Steps to follow,

  1. Enable source code repositories, this will add needed deb-src lines in /etc/apt/sources.list.

    enable-source-repo

  2. Install the tools require to compile the packages from source code,also ensure around 20+ GB disc space before building.

    # To install build tools
    sudo apt update
    sudo apt build-dep linux linux-image-$(uname -r)
    
    sudo apt install libncurses-dev gawk flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf llvm build-essential libncurses5-dev gcc bc dwarves
    
  3. Obtaining the source for Ubuntu release: The source code which generated a specific binary package may be obtained using the apt source <package> command, to get other versions check this - official documentation, [ ref-2 ]

    # switch to root
    sudo su
    
    # get the current kernel source downloaded and extracted (ignore the end user warning)
    apt source linux-image-unsigned-$(uname -r)
    
    cd /path/to/linux-<version>/
    
    # Give all user execution permissions to scripts (Important, otherwise error will be thrown even if you are running them as root)
    chmod a+x debian/scripts/*
    chmod a+x -R ./scripts
    
  4. Download and apply the patch,

    patch -p1 < ~/Downloads/<patch-name>.patch
    
  5. Copy the existing configurations,

    cp /boot/config-$(uname -r) ./.config
    
    # update config for new kernel
    make oldconfig
    
  6. Compile the kernel, [ref]

    make -j16 deb-pkg LOCALVERSION=-custom
    

    You want to replace -j16 with however many threads your processor has (use getconf _NPROCESSORS_ONLN to get the number). the “LOCALVERSION” option can be anything you want. It’s only there for documentation purposes. Now your kernel should be compiling. This could take a while, depending on your hardware (1-2 hours)

  7. Install the new patched kernel, update grub and reboot to new kernel

    # change to parent dir
    cd ..
    
    dpkg -i *.deb
    
    update-grub
    reboot
    

    Use the mainline tool to remove old kernel,

-1

Tried using the mainline tool to install the latest (already fixed and patched) kernel?

sudo add-apt-repository ppa:cappelikan/ppa
sudo apt update
sudo apt install mainline


And then use the tool.
2
  • Not only a bad answer an extremely bad idea. Using an untested test kernel will interfere with upgrades.
    – David
    Apr 16 at 7:31
  • Coul,d you not install only LTS or stable kernels with that? Am I wrong? Apr 17 at 18:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .