Home Command line utilities Linux Kernel Utilities – Scripts To Compile And Update Latest Linux Kernel For Debian And Derivatives

Linux Kernel Utilities – Scripts To Compile And Update Latest Linux Kernel For Debian And Derivatives

By sk
Published: Updated: 4.9K views

A while ago, we have published a guide about a tool UKUU that is used to install, and/or update latest Linux kernel in DEB-based systems, such as Ubuntu, Linux Mint. Today, we will see about a similar tool called "Linux Kernel Utilities". It is a set of BASH shell scripts that can be used to compile and / or update latest Linux kernels for Debian and derivatives.

Linux Kernel Utilities contains the following three scripts.

  • compile_linux_kernel.sh - Compile and install the latest Linux Kernel from source,
  • update_ubuntu_kernel.sh - Download and install or update the precompiled Ubuntu Kernel,
  • remove_old_kernels.sh - Remove all inactive/unused Linux Kernels.

In this brief guide, I will explain how to install and use Linux Kernel Utilities in Ubuntu 16.04 LTS.

Linux Kernel Utilities - Scripts To Compile And Update Latest Linux Kernel

Install Linux Kernel Utilities

We can install Linux Kernel Utilities in two ways.

Method 1:

The recommended way to do this is git clone the repository using command:

$ git clone https://github.com/mtompkins/linux-kernel-utilities.git

The above command will clone the contents of the repository in a folder called "linux-kernel-utilities" in your current working directory.

Go that directory:

$ cd linux-kernel-utilities/

Make the scripts executable using command:

$ chmod 750 *.sh

Scripts will prompt to update when necessary. To update them, just run:

$ git pull

Method 2:

Another way to install this script is download the DEB packages and install it manually.

Go to the Releases page and download the latest version. As of writing this guide, the latest version was 1.1.6.

$ wget https://github.com/mtompkins/linux-kernel-utilities/releases/download/v1.1.6/linux-kernel-utilities_1.1.6_all.deb

Then, install it as shown below.

$ sudo dpkg -i linux-kernel-utilities*.deb

All scripts will be installed under /opt location. You can execute the scripts from here.

To remove it, run:

$ sudo dpkg -r linux-kernel-utilities

Compile Linux Kernel

As I mentioned in the introduction section, Linux Kernel Utilities consists of three scripts. compile_linux_kernel.sh script is used to download and compile the latest Kernel from http://www.kernel.org website. This script will display the list available Linux Kernels in that site, so you can pick one from the list.

Run the following command to list the available Kernel. You don't need to run these scripts as sudo or root user. You will be prompted to enter the root password or sudo password if necessary.

$ ./compile_linux_kernel.sh

Click OK to continue.

linux kernel utilities 1

The first time this script will install missing dependencies if there are any.

Next, select a Kernel from the list to download.

linux kernel utilities 2

Just follow the onscreen instructions to compile and install the selected Linux Kernel.

To compile and install the latest available Linux Kernel, run:

$ ./compile_linux_kernel.sh --latest

Also, you can compile and install a Kernel from local archive file.

$ ./compile_linux_kernel.sh --archive=linux-4.11.6.tar.xz

Download and install precompiled Linux Kernel

update_ubuntu_kernel.sh script will allow you to download and install or update the list of available Linux Kernels from https://kernel.ubuntu.com website.

To install precompiled Kernel from, run:

$ ./update_ubuntu_kernel.sh

It will list all available precombiled Linux Kernels from Kernel.ubuntu.com website. Just enter any number from the list to install the selected Kernel.

[+] Retrieving available kernel choices . . .
 \_ Precompiled kernels available from kernel.ubuntu.com:

 1) Linux v4.11 2) Linux v4.11.6 3) Linux v4.11.5 4) Linux v4.11.4 
 5) Linux v4.11.3 6) Linux v4.11.2 7) Linux v4.11.1 8) Linux v4.10 
 9) Linux v4.10.17 10) Linux v4.10.16 .
 253) Linux v4.0.9-wily 254) Linux v4.0.8-wily 255) Linux v4.0.7-wily 256) Linux v4.0.6-wily 
 257) Linux v4.0.5-wily 258) Linux v4.0.4-wily 259) Linux v4.0.3-wily 260) Linux v4.0.2-wily 
 261) Linux v4.0.1-wily 262) Linux v4.0-vivid

Select your desired kernel:1

After installing the new Kernel, reboot and log in to newly installed Kernel.

To install latest available Linux Kernel, run:

$ ./update_ubuntu_kernel.sh --latest

The above command directly pick the latest available from the Kernel.ubuntu.com website and install it.

Remove inactive Linux Kernels

remove_old_kernels.sh script will remove inactive and unused Kernels from your Ubuntu system. Please be careful while using this script. It will only leave the currently loaded Linux Kernel. All old Kernels will be removed. It is highly recommended that a reboot is required before executing this script.

$ ./remove_old_kernels.sh

Type 'y' and hit Enter to remove the old kernels. You'll be asked to enter your sudo user password to uninstall old kernels.

A reboot is recommended before running this script to ensure the current kernel tagged
as the boot kernel is indeed registered and old kernels properly marked for removal.
If you have just installed or modified your existing kernel and do not reboot before
running this script it may render you system INOPERABLE and that would indeed suck.

You have been warned.
~the Mgmt

[?]Continue to automatically remove ALL old kernels? (y/N)y

Now, the old kernels have been removed from your Ubuntu system.

Suggested read:

And, that's all. Hope this helps. If you find this guide useful, please share it on your social, professional networks and support OSTechNix. I will be soon here with another interesting guide. Till then, stay tuned!



Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like


Cof5 June 20, 2017 - 1:21 am

This should be done as ubuntu does it- on a central repo. Why replicate kernel compiling times a million because Debian is too lazy or too stupid to do it themselves.

Arnold July 1, 2018 - 12:41 pm

Thanks to the great manual


Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More