Ubuntu

For Ubuntu,

  1. dpkg-reconfigure the relevant linux-image package.
    1. This runs depmod if dkms has a module to install.
    2. This always runs update-initramfs and update-grub.
  2. Use the following commands as needed.
depmod -a $(uname -r) # if this kernel's modules changed
update-initramfs -u -k all # updates existing kernels' initramfs
update-grub # only if have made changes to /etc/default/grub as well

References

  • /var/lib/dpkg/info/linux-image-$(uname -r).postinst
  • /etc/kernel/postinst.d/*

RHEL 10

depmod -a $(uname -r) # if this kernel's modules changed
dracut -fv /boot/initramfs-$(uname -r).img $(uname -r)