When dnf update kernel failed to generate initramfs
This sometimes happen when the automatic nvidia kernel module installation fails.
The workaround is:
- Boot into an older kernel;
- ls /boot/ and find the kernel name of the vmlinuz without corresponding initramfs. For example, it could be vmlinuz-6.14.3-300.fc42.x86_64. Your kernel version will be 6.14.3-300.fc42.x86_64, in the form of major.mid,minor-nnn.osver.arch. Let’s call it $KVER
- Check the existence of /lib/modules/$KVER/ by ls it. If exists, do “depmod -v $KVER”. This will create modules.dep in the folder /lib/modules/$KVER/.
- Do dracut –force –kver $KVER. If not working, use a lower version of gcc like “CC=gcc-14 dracut –force –kver $KVER”.
- Reboot into the newest kernel. Usually this will not contail nvidia driver kernel module.
- Run the nvidia driver installation downloaded from NVidia driver site, like NVIDIA-Linux-x86_64-570.144.run. This will install the NVidia driver kernel module into the kernel. If not working, use a lower version of gcc, like “CC=gcc-14 ./NVIDIA-Linux-x86_64-570.144.run”
- Now you have a good kernel with proper graphic driver kernel module.