Month: September 2021

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

Gmail does not receive forwarded emails (SOLVED)

Some Gmail users face the problem that the configured forwarding to the Google mailbox (Gmail) does not work, or is unstable.

I faced such a problem when trying to set up forwarding from mail.ru mail to @gmail.com mail. In my case, forwarding from mail.ru was configured correctly and enabled. Moreover, it even worked for some time.

Google has shown that the problem when forwarded emails are not being delivered is encountered by many users – there is no official solution to the problem from Google.

First of all, it is recommended to check the filters in Gmail – some of them can send mail to spam or delete emails without putting them in the Inbox. Instead of going into the filters and trying to figure them out, just send a letter from the mailbox from which you set up forwarding to the address where you want to forward – if the electronic letter has arrived, then it is not about filters.

Instead of trying to fix unstable forwarded emails, there is another, more reliable way out. You can set up Gmail to check and receive mail from other mailboxes.

How to set up Gmail to check mail from other mailboxes

Go to Gmail mailbox, click the gear in the upper right corner and select “See all settings”.

Go to the “Accounts and Import” tab. Find the “Check mail from other accounts” section and click “Add a mail account”.

Enter the email address from which you want to forward emails as soon as they arrive.

Select “Import emails from my other account (POP3)”.

Enter your mailbox password.

Next, you will be asked if you want to be able to send electronic letters from this account. If so, you just need to enter the password again.

This method turned out to be more reliable than forwarding emails. You need to remember that emails will stop being forwarded (coming to your Gmail mailbox) if you change the password for the forwarded mailbox, so when you change your password, do not forget to change it in the Gmail settings.

Error “trid: loadlocale.c:129: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed” (SOLVED)

When running this or that command, you may encounter an error in which the word “loadlocale.c” appears. You can report this bug to the author so that he can fix it, as it is more of a program bug. However, there are several ways to fix this error.

As you can tell from the “locale” string, the error is locale-related.

An example of an error:

trid: loadlocale.c:129: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
Aborted (core dumped)

The most common advice is to run before the command:

export LC_ALL=C

And then execute the command that caused the error – the error should disappear.

But this tip can break fonts in some other applications. Therefore, use this method with LC_ALL as a fallback if something is not set (as in the case above, this is LC_TIME).

Another tip is to do the following:

LANG=/usr/lib/locale/en_US

and then run the problematic command – that should work as well. This may have fewer side effects on fonts in other languages.

It also offers a way to fix this problem on a permanent basis – handy if you frequently run the command causing an error with loadlocale.c.

First, edit the /etc/locale.gen file and add the locales you want.

For example, in my case:

en_US.UTF-8 UTF-8
ru_RU.UTF-8 UTF-8

Now run as root:

sudo rm -f /usr/lib/locale/locale-archive
sudo locale-gen --no-archive
sudo locale-gen --no-archive en_US.UTF-8
sudo locale-gen --no-archive ru_RU.UTF-8

The --no-archive flag is important, use it as shown in the commands.

Error “cannot resolve dependency lib32 (32-bit library)” (SOLVED)

When installing a package on Arch Linux or a distro derived from it, for example, by running the following command:

sudo pacman -S trid

an error may occur stating that dependencies could not be resolved. The name of this dependency can contain the number “32” or the string “lib32”, that is, it is a 32-bit package, for example:

resolving dependencies...
warning: cannot resolve "lib32-ncurses", a dependency of "trid"
:: The following package cannot be upgraded due to unresolvable dependencies:
      trid

:: Do you want to skip the above package for this upgrade? [y/N]

To fix this error, multilib must be enabled.

The multilib repository is the official repository that allows the user to run and build 32-bit applications on 64-bit Arch Linux.

To enable multilib, open the text file /etc/pacman.conf:

sudo gedit /etc/pacman.conf

Find and uncomment the lines in it (make sure to uncomment both lines, otherwise the changes will not take effect):

[multilib]
Include = /etc/pacman.d/mirrorlist

Update package information:

sudo pacman -Sy

And re-run the package installer – this time all dependencies should be resolved.

Loading...
X