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

%3CLINGO-SUB%20id%3D%22lingo-sub-2170919%22%20slang%3D%22en-US%22%3ENew%20linux%20kernel%20is%20automatically%20added%20when%20Launching%20an%20ubuntu%2018.04%20VM%20on%20azure%20from%20an%20image%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2170919%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%20I%20am%20new%20at%20working%20with%20azure.%3C%2FP%3E%3CP%3EI%20am%20seeing%20a%20behaviour%20which%20I%20do%20not%20understand.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBy%20default%20this%20is%20the%20kernel%20version%20of%20a%20market%20place%20ubuntu%201804%20VM%20%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Euname%20-mr%3CBR%20%2F%3E5.4.0-1039-azure%20x86_64%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20available%20kernel%20packages%20are%20%3A%3C%2FP%3E%3CP%3Edpkg%20--list%20%7C%20grep%20linux-image%3CBR%20%2F%3Eii%20linux-image-5.4.0-1039-azure%205.4.0-1039.41~18.04.1%20amd64%20Signed%20kernel%20image%20azure%3CBR%20%2F%3Eii%20linux-image-azure%205.4.0.1039.19%20amd64%20Linux%20kernel%20image%20for%20Azure%20systems.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20my%20use%20case%2C%20I%20download%20this%20VHD%20and%20covert%20it%20to%20qcow2%20and%20perform%20some%20operations%20on%20this%20image.%20I%20launch%20this%20modified%20qcow2%20as%20a%20VM%20and%20I%20see%20the%20same%20kernel%20versions%20are%20available.%20I%20convert%20this%20back%20to%20VHD%20and%20upload%20to%20azure%20as%20a%20custom%20image.%3C%2FP%3E%3CP%3ENow%20when%20I%20launch%20a%20VM%20using%20this%20custom%20image%20I%20see%20more%20options%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3Bdpkg%20--list%20%7C%20grep%20linux-image%3CBR%20%2F%3Eii%20linux-image-5.4.0-1039-azure%205.4.0-1039.41~18.04.1%20amd64%20Signed%20kernel%20image%20azure%3CBR%20%2F%3EiF%20linux-image-5.4.0-1040-azure%205.4.0-1040.42~18.04.1%20amd64%20Signed%20kernel%20image%20azure%3CBR%20%2F%3Eii%20linux-image-azure%205.4.0.1040.20%20amd64%20Linux%20kernel%20image%20for%20Azure%20systems.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESomehow%20this%20new%20kernel%20image%20is%20injected%20-%20linux-image-5.4.0-1040-azure.%20However%20the%20VM%20still%20boots%20up%20with%20the%20older%20kernel%20version%20i.e.%205.4.0-1039-azure.%3C%2FP%3E%3CP%3ENow%2C%20I%20would%20not%20have%20an%20issue%20with%20this%20but%20I%20see%20that%20I%20need%20some%20KOs%20which%20I%20need%20for%20my%20software%20(e.g%20-%20netns-vrf.ko)%20are%20compatible%20with%205.4.0-1040-azure%20and%20not%20with%205.4.0-1039-azure.%20This%20becomes%20a%20problem%20for%20me.%3C%2FP%3E%3CP%3ENow%20if%20I%20create%20a%20menu%20entry%20for%20this%20new%20kernel%20version%20in%20grub%20and%20change%20the%20grub%20config%20to%20load%20with%20this%20kernel%20version%2C%20things%20work%20fine%20for%20me.%20But%20as%20you%20can%20see%2C%20a%20lot%20of%20manual%20steps%20involved.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20want%20to%20understand%20how%20this%20new%20kernel%20version%20is%20injected%20%3F%20Can%20anyone%20point%20me%20in%20the%20right%20direction%20%3F%20Any%20help%20will%20be%20much%20appreciated.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2181830%22%20slang%3D%22en-US%22%3ERe%3A%20New%20linux%20kernel%20is%20automatically%20added%20when%20Launching%20an%20ubuntu%2018.04%20VM%20on%20azure%20from%20an%20image%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2181830%22%20slang%3D%22en-US%22%3E%3CP%3EI%20narrowed%20down%20pn%20the%20cause%20of%20the%20issue%20and%20it%20seems%20that%20just%20by%20enabling%20an%20overlay%20file%20system%2C%20azure%20VMs%20end%20up%20with%20the%20new%20kernel.%20Not%20sure%20why.%3C%2FP%3E%3C%2FLINGO-BODY%3E
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.