0

I'm on Ubuntu 18.04 and I'm having problems with my iGPU hanging my system (this bug here: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1861395).

I'm currently on the 5.3 kernel, but I want to try changing kernels to fix the problem.

I don't really need super-cutting edge kernel features, I'm more interested in stability.

Should I upgrade to 5.6? or downgrade to 5.2 or 4.XX?

How should I do it so that I can safely go back to the official kernel from the repos if something goes wrong?

Edit: It has been drawn to my attention that this question is quite similar to mine: How to update kernel to the latest mainline version without any Distro-upgrade?.

However, it only covers how to upgrade kernels, not how to ensure that I can safely revert my system to its previous state using the package manager. With most packages you install through PPAs, apt will replace the old version with the new on. Is it the same for kernels?

2 Answers2

1

You can install mainline kernels from Ubuntu kernel PPA.

You can install as many as you like. The system will boot with the latest one by default, but you can select any kernel in grub menu.

To revert to the standard Ubuntu kernel, boot with it and remove all mainline kernels using e.g. synaptic.

Pilot6
  • 92,041
-1

Abstract

To upgrade to a kernel I would suggest going for a stable build. Also, as a rule of thumb, I recommend always upgrading your kernel and never downgrading because it can cause system flaws.

Required Installs for this Guide

sudo apt-get install -y gcc libncurses5-dev make wget flex bison vim libssl-dev libelf-dev

How To

In order to change your current kernel it takes some patience and caution, but there is definitely a way to do it while still having the ability to revert back to the original kernel. So let's get started, I recommend doing all of this with root so first do sudo -i and enter your password.

So let's go ahead and download the latest stable kernel as of now (2020-05-05).

wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.5.19.tar.xz

Note: You may need to install wget for this to work (apt-get install wget).

Now let's extract this archive and move it to a suitable directory.

tar -xvf linux-5.5.19.tar.xz -C ../usr/src/

Note: You may need to install tar for this to work (apt-get install tar).

This extracted the archive to a directory that contains all the other kernels. We're now going to cd into that directory to complete the next few steps.

cd ../usr/src/linux-5.5.19/

Now for the fun part :)

If you don't have a strong computer this part can easily take 2 hours to complete so please be warned if you are on battery life or on a time crunch. Also, be sure to read all the following directions before rebooting (it will be essential if anything goes wrong).

We are now going to compile the kernel, so just follow the following commands and please let all of them run to completion. This first command usually takes the longest for people. Also, I will be using the -j4 flag on these make commands in order to speed up the process. It basically utilizes 4 cores for the compilation instead of one (I'm assuming you have 4 cores, and if not you can just leave off the -j4).

make -j4

Note: You may need to install make for this to work (apt-get install make).

make modules -j4

make modules_install -j4

make install -j4

DON'T REBOOT YET

We will now be modifying grub to give you time to choose the kernel you want to use on startup.

cd ~/../etc/default/

vim grub

Note: You can use any text editor you're familiar with, another popular one is nano, but please be familiar with your choice and know how to edit and save. I have chosen vim for this guide and you may need to install vim for it to work (apt-get install vim).

Modify the following lines to this (in vim you press i to start editing and navigate with the arrow keys):

GRUB_DEFAULT=2
GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=25

To save the file, press ESC, then press :wq! and hit enter.

Now for your last and final step, you need to update grub.

update-grub2

Once that command finishes you may restart your system (reboot).

Once the system comes back you will notice that you are prompted at startup for some options. Select advanced options and then select your new linux-5.5.19 kernel.

If there are any issues with this guide please leave a comment and I will try to address the issue by editing this guide.

Hope it works!

VoidTwo
  • 469