Tag: software update

How to update the GRUB bootloader on Debian and derivative distributions (Kali Linux, Ubuntu, Linux Mint)

The GRUB operating system loader is installed and updated on Linux like any other software package. But the peculiarity of the bootloader is that even after updating the package, the actual working files of the bootloader, which are located on the partition mounted along the /boot/grub/ path, are not automatically updated.

That is, when new versions of GRUB are released, the package in your OS is updated automatically.

But the bootloader itself, which is installed on a separate disk partition and mounted along the /boot/grub/ path, is not updated.

To start using the new features that are added in new versions of GRUB, you need to manually update the bootloader.

When to update the GRUB bootloader in /boot/grub/

The signal that a new version of GRUB has been released is something like the following messages:

Setting up grub-common (2.06-8+kali1) ...
...........
Setting up grub2-common (2.06-8+kali1) ...
...........
Setting up grub-pc-bin (2.06-8+kali1) …

Another sign that the GRUB package has been updated is a request to update the default GRUB configuration file.

In order to use the new features introduced in this GRUB update, it is recommended to install it in MBR or UEFI. Due to potential configuration incompatibilities, it is recommended that you perform both installation and configuration creation.

That is, if you see this message, then you need to update the bootloader in /boot/grub/.

How to check if GRUB is being used on the operating system

On Arch Linux and derivative distributions, the GRUB package can be installed but is not used because the bootloader is systemd-boot.

To verify that GRUB is the bootloader, run the following command:

ls -l /boot/grub/grub.cfg

If the /boot/grub/grub.cfg file is found, then GRUB is being used, if the grub.cfg file is not found, then GRUB is not used and does not need to be updated. That is, you do not need to follow the steps shown in this article!

For details, see the article: How to check if a computer is using BIOS or UEFI; GRUB or systemd-boot bootloader; MBR or GPT partition table

How to update the GRUB bootloader in /boot/grub/

To update the bootloader, you need to run a command like:

grub-install --recheck /dev/DISK

Where /dev/DISK should be the name of your drive.

Drive names can be checked with the command:

fdisk -l

Example output:

Disk /dev/vda: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start       End   Sectors Size Id Type
/dev/vda1  *     2048 104857566 104855519  50G 83 Linux


Disk /dev/vdb: 450 KiB, 460800 bytes, 900 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

In this case, the drive name is /dev/vda. Note that /dev/vda is not a boot partition or some other partition – it's the entire drive.

So, the command to update GRUB in /boot/grub/ in my case is the following:

grub-install --recheck /dev/vda

Example output:

Installing for i386-pc platform.
Installation finished. No error reported.

You also need to create a new configuration file with the following command:

grub-mkconfig -o /boot/grub/grub.cfg

Example output:

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.0.0-kali6-cloud-amd64
Found initrd image: /boot/initrd.img-6.0.0-kali6-cloud-amd64
Found linux image: /boot/vmlinuz-6.0.0-kali5-cloud-amd64
Found initrd image: /boot/initrd.img-6.0.0-kali5-cloud-amd64
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
done

GRUB bootloader update and GRUB configuration update completed successfully. The next time you boot, your operating system will use the new features that were added by the GRUB update.

How to update the GRUB bootloader in Arch Linux and derivatives (Manjaro, BlackArch)

The GRUB operating system loader is installed and updated on Linux like any other software package. But the peculiarity of the bootloader is that even after updating the package, the actual working files of the bootloader, which are located on the partition mounted along the /boot/grub/ path, are not automatically updated.

That is, when new versions of GRUB are released, the package in your OS is updated automatically.

But the bootloader itself, which is installed on a separate disk partition and mounted along the /boot/grub/ path, is not updated.

To start using the new features that are added in new versions of GRUB, you need to manually update the bootloader.

When to update the GRUB bootloader in /boot/grub/

The signal that a new version of GRUB has been released is something like the following message:

(3/4) upgrading grub                               [######################] 100%
:: To use the new features provided in this GRUB update, it is recommended
   to install it to the MBR or UEFI. Due to potential configuration
   incompatibilities, it is advised to run both, installation and generation
   of configuration:
     $ grub-install ...
     $ grub-mkconfig -o /boot/grub/grub.cfg

This message says that in order to use the new features introduced in this GRUB update, it is recommended to install it in MBR or UEFI. Due to potential configuration incompatibilities, it is recommended that you perform both installation and configuration creation. And also given exemplary commands.

That is, if you see this message, then you need to update the bootloader in /boot/grub/.

How to check if GRUB is being used on the operating system

On Arch Linux and derivative distributions, the GRUB package can be installed but is not used because the bootloader is systemd-boot.

To verify that GRUB is the bootloader, run the following command:

ls -l /boot/grub/grub.cfg

If the /boot/grub/grub.cfg file is found, then GRUB is being used, if the grub.cfg file is not found, then GRUB is not used and does not need to be updated. That is, you do not need to follow the steps shown in this article!

For details, see the article: How to check if a computer is using BIOS or UEFI; GRUB or systemd-boot bootloader; MBR or GPT partition table

How to update the GRUB bootloader in /boot/grub/

To update the bootloader, you need to run a command like:

grub-install --recheck /dev/DISK

Where /dev/DISK should be the name of your drive.

Drive names can be checked with the command:

fdisk -l

Example output:

Disk /dev/vda: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4b23ea92

Device     Boot  Start      End  Sectors  Size Id Type
/dev/vda1  *      2048   411647   409600  200M 83 Linux
/dev/vda2       411648 62914559 62502912 29.8G 83 Linux

In this case, the drive name is /dev/vda. Note that /dev/vda is not a boot partition or some other partition – it's the entire drive.

So, the command to update GRUB in /boot/grub/ in my case is the following:

grub-install --recheck /dev/vda

You also need to create a new configuration file with the following command:

grub-mkconfig -o /boot/grub/grub.cfg

Example output:

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot:  initramfs-linux-fallback.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done

GRUB bootloader update and GRUB configuration update completed successfully. The next time you boot, your operating system will use the new features that were added by the GRUB update.

error: blackarch: signature from “Levon ‘noptrix’ Kayan (BlackArch Developer) ” is invalid (SOLVED)

When trying to update Arch Linux with BlackArch repositories with the command

sudo pacman -Syu

an error occurred:

error: blackarch: signature from "Levon 'noptrix' Kayan (BlackArch Developer) <noptrix@nullsecurity.net>" is invalid

The error message says that the signature of one of the BlackArch developers is not valid.

To solve this error, just delete the /var/lib/pacman/sync/blackarch.db.sig file:

sudo rm /var/lib/pacman/sync/blackarch.db.sig

Then run the update as usual:

sudo pacman -Syu

The error no longer occurs:

I don't know exactly what caused this problem, perhaps a file corruption due to a network problem during a system update.

After updating the information from the package repositories, the /var/lib/pacman/sync/blackarch.db.sig file was recreated and the error no longer occurred. That is, there is no need to worry that your Linux will lose any functionality.

How to uninstall and block updates and drivers from installing in Windows 11

Windows 11 automatically downloads and installs all updates. This includes security updates, feature updates, and driver updates provided through Windows Update. This is usually fine, but if a driver or update is causing problems, you can uninstall it and block it from being installed again.

Step One: See What Updates and Drivers Have Been Recently Installed

If you're not sure which device driver or Windows update you just installed might be causing problems, you can view the list of installed updates. If you need to, boot into safe mode, open Settings (Win+i) → Windows Update and click on Update history.

Here you will see a list of updates and their installation dates.

Step two: Uninstall the problematic update or driver

You then need to uninstall the buggy system or driver update, but this is done in different ways.

How to uninstall system update

The ability to uninstall Windows updates (not driver updates) is buried in the Settings app. Go to Settings (Win+i) → Windows Update → Update history. Click the “Uninstall updates” button here.

This link opens the Installed Updates dialog where you can uninstall an individual Windows update if it causes problems on your system.

This list only lists updates that have been installed since the last major update or “build” of Windows 11.

To roll back a build of Windows 11, select Settings (Win+i) → Windows Update → Advanced options

→ Recovery.

If it's been less than 10 days since you installed the build and you haven't deleted any files with Disk Cleanup, you'll see an option to “Go back to a previous version of Windows 11”. Click “Start” to return to a previous build of Windows 11.

How to roll back a driver

Drivers can be especially problematic. Whether you roll back a driver or install another one yourself, whenever it checks for updates, Windows Update will keep downloading and installing your driver over and over again, overwriting your preferred driver. We'll talk about how to stop this, but first let's talk about how to rollback a driver.

To roll back the driver, press Win+x and select “Device Manager” to launch Device Manager. Locate the device whose driver you want to uninstall, right-click it and select Properties.

Click the Driver tab and click Roll Back Driver.

Step Three: Prevent Driver Installation or Update from Windows Update

Simply removing drivers or updates won't prevent you from reinstalling them. There is no way to "hide" an update or block updates from within Windows itself, but Microsoft provides a tool to do this, which had to be downloaded from their website. Now this tool has been removed from the site, but its copy has been preserved, which you can download from this link: wushowhide.diagcab file. If you are concerned about security, then:

  • firstly, you can check the digital signature of the downloaded file;
  • secondly, you can unpack the file with an archiver and make sure that this file includes several .ps1 scripts, that is, small programs and functions written in PowerShell, that is, it is almost an open source tool

This tool is designed to temporarily hide problematic updates that do not work properly on your system.

You can download the “Show or hide updates troubleshooter” for Windows 11 from Microsoft.

When you run this troubleshooter, it will look for available updates and allow you to “hide” them, preventing Windows from automatically installing them.

Later, you will be able to run this troubleshooter again and show updates when you want to install them.

Do services need to be restarted when updating packages

Package configuration: whether to restart the service

During the installation of package updates and their configuration, the apt program may ask you to restart the service:

There are services installed on your system which need to be restarted when certain libraries, such as libpam, libc, and libssl, are upgraded. Since these restarts may cause interruptions of service for the system, you will normally be prompted on each upgrade for the list of services you wish to restart. You can choose this option to avoid being prompted; instead, all necessary restarts will be done for you automatically so you can avoid being asked questions on each library upgrade. Restart services during package upgrades without asking?

This message can be confusing, especially the phrase “cause interruptions of service for the system”. In fact, the essence is quite simple – the binaries have been updated and you need to restart the services that use them so that they start using the updated versions of the files.

The name of the package that requires the service to be restarted is in the upper left corner, in the screenshot it is libc6, i.e. “GNU C Library: Shared libraries”. It contains the standard libraries that are used by nearly all programs on the system. This package includes shared versions of the standard C library and the standard math library, as well as many others.

What kind of interruptions can a service restart cause?

Examples of the consequences of restarting services:

  • at the time of restarting the web server service, sites will be unavailable to users
  • when restarting the caching proxy server, the cache stored in RAM will be deleted
  • restarting network services can lead to connection drops (but in practice this does not always happen)

That is, the possible consequences of restarting services on the home computer are insignificant – you can safely restart.

As far as restarting services on a server, for example, restarting the SSH server usually doesn't break the connection. You need to evaluate the consequences of restarting other services based on your situation.

See also:

Do I need to restart the server after updating the Linux kernel (SOLVED)

Unlike Windows, in which a program must not be running to update this program, in Linux you can update running programs without any problems – this will not lead to any errors. In Linux, you can delete files in use (including executables) and while they are in use, they will be kept in the cache, and when the system stops using them, they will be truly deleted. That is, when updating a running program, the new version of the file will be used after you close and reopen this program.

Updating the Linux kernel is no exception – you can update the kernel on a running system and continue using it.

This raises the question, is a system reboot actually required after a Linux kernel update? This issue is especially relevant for web servers that become unavailable during the reboot period. It also matters when using caching (Varnish or NGINX), since the cache is usually stored in RAM and is lost on reboot, resulting in the need to refill the web page cache.

So is it necessary to restart the computer after updating the Linux kernel?

In short, yes, absolutely. For the system to start using the new kernel, the computer (server) needs to be rebooted.

After updating the kernel, you can continue to use the server without rebooting, but besides the fact that the benefits of the new kernel have not taken effect, there are a few more things to keep in mind.

1. Avoid subsequent package updates until reboot

Since the kernel header packages (linux-headers, kernel-headers) are updated along with the kernel, there may be a problem with building modules using dkms (Dynamic Kernel Modules System). A situation arises when an old kernel is used, for which the kernel header files (linux-headers) may have already been deleted, so the system cannot build the dkms modules normally.

And even if the kernel headers are saved and it was possible to build the kernel modules for the outdated kernel, then immediately after the reboot these modules will conflict with the new kernel and will not work due to the difference between the versions of the current kernel and the kernel for which they were built.

2. dkms modules may not work until kernel update

When updating the kernel, all kernel modules that use dkms are rebuilt. Examples of packages that use dkms kernel modules are Wi-Fi adapter drivers, VirtualBox guest additions, other drivers, and kernel modules.

So, new kernel modules are rebuilt when the kernel is updated, but cannot be used while the old kernel is in use. That is, in order for them to work, a reboot is required. In this case, old kernel modules in some distributions are immediately removed.

3. Unexpected reboot can lead to unexpected results

Remember that your system has not been tested with a new kernel. Therefore, if the server is restarted without your attention, then in case of problems, you will not be able to respond to them quickly.

How not to reboot Linux after a kernel update

1. Kexec

Kexec is a system call that enables you to load and boot into another kernel from the currently running kernel. This is useful for kernel developers or other people who need to reboot very quickly without waiting for the whole BIOS boot process to finish. Note that kexec may not work correctly for you due to devices not fully re-initializing when using this method, however this is rarely the case.

In short, Kexec is a reboot of the computer with skipping the hardware part (what you see starting from the start of the BIOS).

2. Does the Linux 4.0 kernel no longer require a computer restart?

In the Linux 4.0 changelog, it is said that starting with this version, a kernel reboot is no longer required. But either it doesn't or doesn't work out of the box. At a minimum, this requires additional steps to be implemented.

Summary

Rebooting the computer after updating the Linux kernel is required. It may be postponed, but in fact it is better to postpone the kernel update than to postpone reboot after the update.

As an option to reduce downtime due to reboots, you can reduce the number of updates by taking them only to fix vulnerabilities.

How to Install the Latest Linux Kernels on Debian and Debian Based Distributions

Recent versions of the Linux kernel have drivers for new devices and other innovations. Unfortunately, many popular Linux distributions are in no rush to update their kernel. This tutorial will show you how easy it is, without compiling, to install any version of the Linux kernel on Debian and derived distributions, for example, Kali Linux and LMDE (Linux Mint Debian Edition). You can choose to install either a newer kernel or an older one than your distribution's repository suggests.

If you wish, you can easily remove the installed Linux kernels and return to the kernel from the repository.

Note that there are separate instructions for Ubuntu and derivatives, as the process for updating kernels is different: “How to Install the Latest Linux Kernels on Ubuntu and Linux Mint”.

Kernel update warning

It should be remembered that due to the incompatibility of the kernel with programs (first of all, with proprietary GPU drivers), you may encounter problems, including a black screen during boot.

In most cases, the problems encountered can be resolved without reinstalling the distribution. Start by going to the advanced options in the boot menu and boot with the previous version of the kernel. When the computer boots up, remove the problematic kernel.

Proprietary graphics card drivers can cause problems, as older versions may not be compatible with the latest kernels without a patch. If you have proprietary video drivers installed, then seriously consider before following the instructions below. Also get ready, look for instructions on how to solve the problem when loading the distribution into a black screen.

Owners of old distributions should be especially careful – it is strongly recommended to update the kernel only on the latest OS versions.

Another very likely problem that you may encounter if you install the latest kernel is the problem with unresolved dependencies and, as a result, the inability to use the apt package manager to update and install programs. If you are faced with a situation where, after successfully installing a new kernel, you cannot update packages using apt, then try installing older versions of the kernel that suit you, and uninstall the versions that cause dependency problems. Remember that it is impossible to remove the kernel you booted with – boot your computer with any other version of the kernel before uninstalling.

Upgrading the Kernel to the Latest Version on Debian

This section should be suitable for all variations and derivatives of Debian, for example:

  • Debian stable
  • Debian testing
  • Kali Linux
  • Linux Mint Debian Edition (LMDE)
  • MX Linux
  • other

Let's check the current kernel version:

uname -a

In order not to compile the kernel from scratch, we will use the kernels of the XanMod Kernel project.

To install the latest kernel version, just run the following commands:

echo 'deb http://deb.xanmod.org releases main' | sudo tee /etc/apt/sources.list.d/xanmod-kernel.list
wget -qO - https://dl.xanmod.org/gpg.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/xanmod-kernel.gpg add -
sudo apt update && sudo apt install linux-xanmod

After the program has exited, a computer restart is required for the changes to take effect.

Let's check the kernel version again:

uname -a

Output example:

Linux HackWare-Kali 5.13.19-xanmod1 #0~git20210919.7960459 SMP PREEMPT Sun Sep 19 13:46:36 UTC 2021 x86_64 GNU/Linux

If for some reason the GRUB menu has not been updated, then run the command:

sudo update-grub

How to choose the XanMod kernel version

In total, the following metapackages are available – the kernel version at the time of writing is indicated in square brackets:

  • linux-xanmod [5.13]
  • linux-xanmod-edge [5.14]
  • linux-xanmod-lts [5.10]
  • linux-xanmod-cacule [5.14-cacule]
  • linux-xanmod-rt [5.10-rt]

You can check the kernel version in the linux-xanmod package with the following command:

apt show linux-xanmod

As you can see, this metapackage has in its dependencies (that is, it will actually install) the linux-image-5.13.19-xanmod1 and linux-headers-5.13.19-xanmod1 packages, hence the kernel version is currently 5.13.19.

Let's check the linux-xanmod-edge kernel version:

apt show linux-xanmod-edge

The current Linux kernel version in this package is 5.14.6.

The XanMod repository contains not only kernels that can be installed using metapackages, but also many other versions, you can find them with the command:

apt search linux-image-[0-9.]+-xanmod[0-9]+

When installing the kernel of the selected version, you need to install the corresponding headers files, both packages must have the name of the form linux-image-VERSION-xanmod1 and linux-headers-VERSION-xanmod1, and the VERSION number must be the same, for example:

sudo apt install linux-image-5.12.19-xanmod1 linux-headers-5.12.19-xanmod1

How to remove XanMod core

If you installed the kernel using the linux-xanmod metapackage, you can remove this metapackage with the command:

sudo apt remove linux-xanmod

However, this will not change anything, the installed kernels will remain on the system! To remove the kernels themselves, use a command like:

sudo apt remove `sudo apt show linux-xanmod | grep Depends | sed 's/,//' | awk '{print $2,$3}'`

If you installed the kernel without using the metapackage, then remove the kernel and the headers file specifying the names of the packages and their versions, for example:

sudo apt remove linux-image-5.12.19-xanmod1 linux-headers-5.12.19-xanmod1

How to recover Linux after installing the kernel

If your computer boots with a black screen, freezes, or something doesn't work after updating the kernel, reboot and select Advanced options for your distribution from the GRUB menu:

Then select the previous kernel version and press Enter:

Regardless of the reason, you need to boot with the previous version of the kernel if you want to remove the latest kernel. This is because you cannot remove the kernel that is currently in use.

If you do not see the GRUB2 menu, press and hold the Shift key or press the Esc key repeatedly (this may vary depending on BIOS or UEFI boot and the version of Ubuntu/Linux Mint you are using) while booting GRUB. The Grub menu should appear allowing you to select a previous kernel version.

After booting the previous kernel, you can remove the faulty kernel.

To remove the XanMod kernel in Debian and derivatives run the commands:

sudo apt remove linux-xanmod
sudo apt remove `sudo apt show linux-xanmod | grep Depends | sed 's/,//' | awk '{print $2,$3}'`

If this was not done automatically, then update your GRUB settings:

sudo update-grub

How to Install the Latest Linux Kernels on Ubuntu and Linux Mint

Recent versions of the Linux kernel have drivers for new devices and other innovations. Unfortunately, many popular Linux distributions are in no rush to update their kernel. This tutorial will show you how easy it is to install any version of the Linux kernel on Ubuntu and Linux Mint without compiling. You can choose to install either a newer kernel or an older one than your distribution's repository suggests.

If you wish, you can easily remove the installed Linux kernels and return to the kernel from the repository.

Since Linux Mint is based on Ubuntu, this instruction is fully applicable to Linux Mint distributions, except for LMDE. For LMDE (Linux Mint Debian Edition) see “How to Install the Latest Linux Kernels on Debian and Debian Based Distributions”.

Kernel update warning

It should be remembered that due to the incompatibility of the kernel with programs (first of all, with proprietary GPU drivers), you may encounter problems, including a black screen during boot.

In most cases, the problems encountered can be resolved without reinstalling the distribution. Start by going to the advanced options in the boot menu and boot with the previous version of the kernel. When the computer boots up, remove the problematic kernel.

Proprietary graphics card drivers can cause problems, as older versions may not be compatible with the latest kernels without a patch. If you have proprietary video drivers installed, then seriously consider before following the instructions below. Also get ready, look for instructions on how to solve the problem when loading the distribution into a black screen.

Owners of old distributions should be especially careful – it is strongly recommended to update the kernel only on the latest OS versions.

Another very likely problem that you may encounter if you install the latest kernel is the problem with unresolved dependencies and, as a result, the inability to use the apt package manager to update and install programs. If you are faced with a situation where, after successfully installing a new kernel, you cannot update packages using apt, then try installing older versions of the kernel that suit you, and uninstall the versions that cause dependency problems. Remember that it is impossible to remove the kernel you booted with – boot your computer with any other version of the kernel before uninstalling.

mainline – Ubuntu kernels repository

For Ubuntu, there is a repository of compiled mainline kernels of all versions, including the most recent, so installation is not too difficult – you do not need to compile the Linux kernel. Moreover, there are tools, including those with a graphical interface, to install any kernels.

In fact, if the kernels have already been compiled, then it is enough to download the following files from one folder from the server:

  • linux-headers-*-generic_*_amd64.deb
  • linux-headers-*_all.deb
  • linux-image-unsigned-*-generic_*_amd64.deb
  • linux-modules-*-generic_*_amd64.deb

And install them with the command:

sudo dpkg -i linux*.deb

But the process can be simplified even further by using utilities for working with kernels.

Mainline (a continuation of the free version of ukuu) – a program with a graphical and console interface for updating the kernel

If you prefer a graphical interface then use Mainline.

To install the program run the following commands:

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

To launch the graphical interface, run:

mainline-gtk

To run the console version, run:

mainline

Using the graphical version should be straightforward. At startup, you will receive information about the available kernels, you can select any kernel and install it by simply clicking on the “Install” button. Additionally, actions such as removing kernels and viewing the changelog for each kernel version are available.

Using the console version is as follows:

Syntax:

mainline COMMAND [OPTIONS]

Options and Commands Reference:

Commands:

  --check             Check for kernel updates
  --notify            Check for kernel updates and notify current user
  --list              List all available mainline kernels
  --list-installed    List installed kernels
  --install-latest    Install latest mainline kernel
  --install-point     Install latest point update for current series
  --install <name>    Install specified mainline kernel(1)
  --uninstall <name>  Uninstall specified kernel(2)
  --uninstall-old     Uninstall kernels older than the running kernel
  --download <name>   Download specified kernels(2)
  --clean-cache       Remove files from application cache

Options:

  --include-unstable  Include unstable and RC releases
  --hide-unstable     Hide unstable and RC releases
  --debug           Enable verbose debugging output
  --yes             Assume Yes for all prompts (non-interactive mode)
  --user            Override user

Notes:

(1) A version string taken from the output of --list

(2) One or more version strings (comma-separated) taken from the output of --list

Restart your computer to use the new kernel.

By default, your system will boot with the latest kernel, if you want to change this, then go to advanced boot options

and select the version you want from the installed kernels.

The ubuntu-mainline-kernel.sh utility

Installing ubuntu-mainline-kernel.sh

The latest kernel on Ubuntu and Linux Mint can also be installed using the ubuntu-mainline-kernel.sh command line utility.

Download and install the ubuntu-mainline-kernel.sh script:

wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh
sudo install ubuntu-mainline-kernel.sh /usr/local/bin/

ubuntu-mainline-kernel.sh help

Usage:

ubuntu-mainline-kernel.sh -c|-l|-r|-u

ubuntu-mainline-kernel.sh options:

Arguments:
  -c               Check if a newer kernel version is available
  -i [VERSION]     Install kernel VERSION, see -l for list. You don't have to prefix
                   with v. E.g. -i 4.9 is the same as -i v4.9. If version is
                   omitted the latest available version will be installed
  -l [SEARCH]      List locally installed kernel versions. If an argument to this
                   option is supplied it will search for that
  -r [SEARCH]      List available kernel versions. If an argument to this option
                   is supplied it will search for that
  -u [VERSION]     Uninstall the specified kernel version. If version is omitted,
                   a list of max 10 installed kernel versions is displayed
  -h               Show this message

Optional:
  -s, --signed         Only install signed kernel packages (not implemented)
  -p, --path DIR       The working directory, .deb files will be downloaded into
                       this folder. If omitted, the folder /tmp/ubuntu-mainline-kernel.sh/
                       is used. Path is relative from $PWD
  -ll, --low-latency   Use the low-latency version of the kernel, only for amd64 & i386
  -lpae, --lpae        Use the Large Physical Address Extension kernel, only for armhf
  --snapdragon         Use the Snapdragon kernel, only for arm64
  -do, --download-only Only download the deb files, do not install them
  -ns, --no-signature  Do not check the gpg signature of the checksums file
  -nc, --no-checksum   Do not check the sha checksums of the .deb files
  -d, --debug          Show debug information, all internal command's echo their output
  --rc                 Also include release candidates
  --yes                Assume yes on all questions (use with caution!)

Example of installing the latest kernel version

Checking the current kernel version:

uname -r
5.11.0-36-generic

The kernel is version 5.11.

We check which version of the kernel is the latest:

ubuntu-mainline-kernel.sh -c

To display a list of available kernels versions for installation, run the command:

sudo ubuntu-mainline-kernel.sh -r

For example, we want to install the kernel version v5.12.11, then the command is as follows (you do not need to specify the “v” prefix):

sudo ubuntu-mainline-kernel.sh -i 5.12.11

If you want to install the latest version at the moment, then run the following command:

sudo ubuntu-mainline-kernel.sh -i

You will be asked if you want to continue, enter “y”:

Latest version is: v5.14.6, continue? (y/N)

The program has exited – a restart is required for the changes to take effect.

Check the kernel version again:

How to recover Linux after installing the kernel

If your computer boots with a black screen, freezes, or something doesn't work after updating the kernel, reboot and select Advanced options for your distribution from the GRUB menu:

Then select the previous kernel version and press Enter:

Regardless of the reason, you need to boot with the previous version of the kernel if you want to remove the latest kernel. This is because you cannot remove the kernel that is currently in use.

If you do not see the GRUB2 menu, press and hold the Shift key or press the Esc key repeatedly (this may vary depending on BIOS or UEFI boot and the version of Ubuntu/Linux Mint you are using) while booting GRUB. The Grub menu should appear allowing you to select a previous kernel version.

After booting the previous kernel, you can remove the faulty kernel. ubuntu-mainline-kernel.sh allows you to remove kernels installed from the Ubuntu kernel PPA.

With ubuntu-mainline-kernel.sh you can remove the kernel version by running:

sudo ubuntu-mainline-kernel.sh -u VERSION

Where VERSION is the kernel version, for example 5.14. You can also use this utility with -u without specifying a version, in which case the tool will list up to 10 kernel versions and ask you which one you want to remove. It's worth noting that ubuntu-mainline-kernel.sh will not show official Ubuntu kernels in this list.

Update GRUB settings if not done automatically:

sudo update-grub
Loading...
X