How can I downgrade the kernel version of ubuntu on azure VM?

Khushi Gupta 6 Reputation points
2022-07-07T13:13:53.84+00:00

I need to downgrade the kernel version of ubuntu azure vm.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,044 questions
{count} votes

1 answer

Sort by: Most helpful
  1. kobulloc-MSFT 26,811 Reputation points Microsoft Employee Moderator
    2022-07-07T20:41:51.927+00:00

    Hello, @Khushi Gupta !

    How do I downgrade or roll back the kernel version of Ubuntu on an Azure VM?
    Adding to what @Andriy Bilous has said, the instructions from danielstechblog.io have worked for other people in an answer from @Andriy Bilous on another thread:

    https://learn.microsoft.com/en-us/answers/questions/633577/azure-site-recovery-unsupported-ubuntu-kernel.html

    You may try to downgrade kernel. Here is an example for Ubuntu 20.04
    Identify actual kernel with command:
    sudo uname -a

    Linux test 5.11.0-1021-azure #22~20.04.1-Ubuntu SMP Fri Oct 29 01:11:25 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

    First step is to identify the necessary packages that you need to install. This is done by executing the following command.
    sudo apt search linux-azure | grep 5.4.0-1062

    Afterwards you know which package needs to be installed.
    sudo apt install linux-image-5.4.0-1062-azure

    In the next step the actual kernel gets removed.
    sudo apt remove linux-image-5.11.0-1021-azure

    During the process you confirm with <No> that you do not want to abort the removal process.
    151106-image.png

    Kernel removal confirmation window

    As the last step you initiate a reboot with sudo reboot

    The welcome screen should now state the target kernel version.
    Check the kernel version
    sudo uname -a
    Linux test 5.4.0-1062-azure #65-Ubuntu SMP Sun Oct 10 02:30:34 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

    https://www.danielstechblog.io/downgrade-the-linux-kernel-on-an-azure-ubuntu-vm/

    Other options
    If you are rolling back the kernel to address VM issues after applying kernel changes, the recommendation is to delete the affected Linux VM and keep the operating system disk which is then attached to a new VM with the same version and running one of the following repair options:

    https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/kernel-related-boot-issues

    1. Roll back the kernel and start from a previous working setup by editing the configuration file.
    2. Install or reinstall a kernel by attaching the affected VM operating system disk to a temporary new VM and running a tool like apt-get, Yellowdog Updater Modified (YUM), or Zypper. See Linux Recovery: Using CHROOT steps to recover VMs that are not accessible.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.