New linux kernel is automatically added when Launching an ubuntu 18.04 VM on azure from an image

New Contributor

Hello, I am new at working with azure.

I am seeing a behaviour which I do not understand.

 

By default this is the kernel version of a market place ubuntu 1804 VM :

 

uname -mr
5.4.0-1039-azure x86_64

 

The available kernel packages are :

dpkg --list | grep linux-image
ii linux-image-5.4.0-1039-azure 5.4.0-1039.41~18.04.1 amd64 Signed kernel image azure
ii linux-image-azure 5.4.0.1039.19 amd64 Linux kernel image for Azure systems.

 

For my use case, I download this VHD and covert it to qcow2 and perform some operations on this image. I launch this modified qcow2 as a VM and I see the same kernel versions are available. I convert this back to VHD and upload to azure as a custom image.

Now when I launch a VM using this custom image I see more options:

 

 dpkg --list | grep linux-image
ii linux-image-5.4.0-1039-azure 5.4.0-1039.41~18.04.1 amd64 Signed kernel image azure
iF linux-image-5.4.0-1040-azure 5.4.0-1040.42~18.04.1 amd64 Signed kernel image azure
ii linux-image-azure 5.4.0.1040.20 amd64 Linux kernel image for Azure systems.

 

Somehow this new kernel image is injected - linux-image-5.4.0-1040-azure. However the VM still boots up with the older kernel version i.e. 5.4.0-1039-azure.

Now, I would not have an issue with this but I see that I need some KOs which I need for my software (e.g - netns-vrf.ko) are compatible with 5.4.0-1040-azure and not with 5.4.0-1039-azure. This becomes a problem for me.

Now if I create a menu entry for this new kernel version in grub and change the grub config to load with this kernel version, things work fine for me. But as you can see, a lot of manual steps involved.

 

I want to understand how this new kernel version is injected ? Can anyone point me in the right direction ? Any help will be much appreciated.

1 Reply

I narrowed down pn the cause of the issue and it seems that just by enabling an overlay file system, azure VMs end up with the new kernel. Not sure why.