Updating the kernel in an image
A new kernel in an image is two changes, not one: the package inside the image, and Luna's
record of which kernel the image boots. The second is the one that gets missed. Luna packs the
kernel and initramfs it is told about, so an image whose kernelversion still names the old
kernel boots the old kernel, however many times the new one is installed.
1. Work on a copy
# luna osimage clone compute compute-new
The original stays a bootable rollback; the group is moved to the clone at the end.
2. Install the kernel
Enter the image and install the kernel the way the distribution does it:
# lchroot compute-new
chroot [root@compute-new /]$ dnf -y update kernel # EL
chroot [root@compute-new /]$ apt-get install linux-image-generic # Ubuntu
chroot [root@compute-new /]$ ls /lib/modules
5.14.0-503.14.1.el9_5.x86_64 5.14.0-570.12.1.el9_6.x86_64
chroot [root@compute-new /]$ exit
/lib/modules inside the image lists the kernels; the new one is the version Luna has to be
told about.
A directory there is not by itself proof that the kernel is installed. Removing a kernel takes
away only the files its package owns, so the index files depmod generated and the extra/
directories belonging to out-of-tree drivers stay behind. Converted images in particular can
carry a dozen of these. A version is really installed when it also has a kernel image:
chroot [root@compute-new /]$ ls /boot/vmlinuz-*
3. Tell Luna, and pack
# luna osimage kernel -k 5.14.0-570.12.1.el9_6.x86_64 compute-new
sets the kernel version and packs the image in one go (-b sets it without packing). The
same in two steps:
# luna osimage change --kernelversion 5.14.0-570.12.1.el9_6.x86_64 compute-new
# luna osimage pack compute-new
The pack builds the initramfs for that kernel with the image's kernelmodules — the
drivers dracut (or initramfs-tools on Ubuntu) includes beyond what it detects. A new kernel
needs the same drivers as the old one, so leave the list as it is unless the hardware changed.
4. Check what Luna will boot
# luna osimage show compute-new
kernelversion, kernelfile and initrdfile must all name the new kernel. A pack that could
not find the kernel it was told about fails with a message naming the version; a typo in
--kernelversion is the usual cause.
Keeping more than one kernel in the image
An image may keep the old kernel alongside the new one, and nodes install from it normally: the node boots the kernel Luna names, and its initramfs is rebuilt for that same kernel.
The boot loader is the part that does not follow. It orders its entries by version, so if
kernelversion names a kernel that is not the newest one installed in the image, the node can
start the newer kernel instead — with an initramfs that was not rebuilt. The install says so:
the initramfs was built for kernel <A>, but <B> is also installed and is newer
Either set kernelversion to the newest kernel in the image, or remove the kernels the image
does not need. Leaving one kernel in an image avoids the question entirely, and for a converted
image it is usually what is wanted anyway.
5. Move the nodes
# luna group change --osimage compute-new compute
then reboot the nodes. A node with its own --osimage set keeps it until that is changed
too — see changing the image for a group or node.