We have already written about a few applications, such as Linux Kernel Utilities, UKUU, Ubunsys, which can be used to upgrade Kernel to most recent stable version in Ubuntu. Some of these tools have been discontinued or not actively maintained or updated regularly or may not work for the new Ubuntu versions and its variants. No worries! I just stumbled upon a new utility named "UKTools" which is also used to upgrade latest Linux kernel or remove old and unused kernels in Ubuntu and its variants. The UKTools script fetches the latest stable Linux kernel from kernel.ubuntu.com and install it automatically on your Ubuntu-based systems. The UKTools application will only keep three Kernel versions: the first and the last two, others will be purged.
UKTools - Upgrade Latest Linux Kernel In Ubuntu And Derivatives
UKTools is beginner-friendly utility, so any novice user can easily upgrade latest Kernel.
UKTools can be used to in two ways.
Method - 1:
Download the latest UKTools tarball in any location of your choice.
$ cd /usr/src
$ sudo wget https://github.com/usbkey9/uktools/archive/master.tar.gz
Extract the downloaded archive:
$ sudo tar -xvf master.tar.gz
This extract all contents of the downloaded archive in a directory named uktools-master in your current directory. Cd to that directory:
$ cd uktools-master
And, run the following command to upgrade to latest Linux kernel.
$ ./ukupgrade -simple
This command will upgrade the currently installed Kernel to the latest available version. It will take few minutes. Once the upgrade process is completed, reboot your system to use the new Kernel.
Finally, delete the source tarball, be cause we don't need it anymore.
$ sudo rm -fr master.tar.gz
Method - 2:
Make sure you have installed Git. If it is not installed yet, run the following command to install it.
$ sudo apt-get install git
Git clone UKTools repoistory:
$ git clone https://github.com/usbkey9/uktools
This command clones all the contents of UKTools repository in a directory named "iktools".
Cd to that directory:
$ cd uktools
And, run the following command to upgrade Kernel:
$ sudo make
This command will install UKTools on your system and automatically upgrade your Kernel. Don't forget to reboot your system to use the newly installed kernel.
After that, You can call this utility at any time using the following commands:
To upgrade Kernel:
To remove old and unused kernels:
You can re-run setup script using command:
That's it. We have successfully upgraded the Linux Kernel in Ubuntu 16.04 LTS. You can check Linux kernel version using command:
$ uname -r
Sample output from my Ubuntu 16.04 LTS desktop:
To view all installed Linux kernels, run:
$ dpkg --list | grep linux-image
ii linux-image-4.16.0-041600-generic 4.16.0-041600.201804012230 amd64 Linux kernel image for version 4.16.0 on 64 bit x86 SMP rc linux-image-4.2.0-16-generic 4.2.0-16.19 amd64 Linux kernel image for version 4.2.0 on 64 bit x86 SMP rc linux-image-4.2.0-34-generic 4.2.0-34.39 amd64 Linux kernel image for version 4.2.0 on 64 bit x86 SMP ii linux-image-4.4.0-15-generic 4.4.0-15.31 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP ii linux-image-4.4.0-28-generic 4.4.0-28.47 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc linux-image-extra-4.2.0-16-generic 4.2.0-16.19 amd64 Linux kernel extra modules for version 4.2.0 on 64 bit x86 SMP rc linux-image-extra-4.2.0-34-generic 4.2.0-34.39 amd64 Linux kernel extra modules for version 4.2.0 on 64 bit x86 SMP ii linux-image-extra-4.4.0-15-generic 4.4.0-15.31 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP ii linux-image-extra-4.4.0-28-generic 4.4.0-28.47 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP ii linux-image-generic 22.214.171.124.30 amd64 Generic Linux kernel image
As you can see in the above output, my Ubuntu 16.04 LTS desktop has three Kernels versions such as 4.16, 4.4 and 4.2. Like I already mentioned, UKTools script will only keep three Kernels, everything else will be removed.
You know now how to upgrade to latest Linux kernel and how to remove unused and old kernels in Ubuntu-based systems. More good stuffs to come. Stay tuned!