This article describes a fix to the following problem: If you are running Fedora Linux on your PC with an Nvidia GPU, you likely use the akmod-nvidia package from rpmfusion. After each kernel update akmod will automatically rebuild the nvidia kernel module at the next boot. But what it does not do is to update the initramfs after compiling the kernel module. The result is an ugly distorted splash screen during the first boot phase.

What you need to fix this problem is some kind a hack to run “dracut -f” whenever a new kernel has been installed and a new Nvidia kernel module was compiled. In this article I will show how to create a custom service to do precisely this. Let’s call this service the “dracut-nvidia-update.service”.

To create the dracut-nvidia-update.service we need to do two things:

  1. Place a script in /usr/local/bin/
  2. Create a custom systemd service

To place the script, open a terminal and create and edit the file /usr/local/bin/

sudo nano /usr/local/bin/

Copy and paste this script into the editor window:


# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root" 1>&2
   exit 1

# Get the newest initramfsfile
declare -a initramfsfiles
initramfsfiles=( $( ls -At -1 /boot/initramfs-*) )

# File to compare with
comparewithfile="/lib/modules/$(uname -r)/extra/nvidia/nvidia.ko"

# Comparing $initramfsfile with $comparewithfile
if [ "$initramfsfile" -ot "$comparewithfile" ]; then
        plymouth update --status="Updating Dracut"
        /usr/bin/dracut -f

Make the script executable:

sudo chmod +x /usr/local/bin/

In the next step create the dracut-nvidia-update.service. Run this command to create and edit the service:

sudo systemctl edit --force --full dracut-nvidia-update.service

Copy this content into the editor window:

Description=Update Dracut after Kernel update to support newest nvidia drivers in plymouth



Try to run the new service:

sudo systemctl start dracut-nvidia-update.service

If it works, enable it:

sudo systemctl enable dracut-nvidia-update.service

You are done. After next kernel update you will see the distorted boot screen only once. After akmods.service has built the new kernel module our new service takes care of the initramfs.

Note: For this to work you need to add the nvidia drivers to dracut. If you have not already done this, edit /etc/dracut.conf.d/nvidia.conf

sudo nano /etc/dracut.conf.d/nvidia.conf

and add this content:

add_drivers+=" nvidia nvidia_modeset nvidia_uvm nvidia_drm "
install_items+=" /etc/modprobe.d/nvidia.conf "

Finish this by executing

sudo dracut -fvv

Further reading

Rendek, L. (2020, May 5). How to install the NVIDIA drivers on Fedora 32. Retrieved July 6, 2020, from

Photo by Caspar Camille Rubin on Unsplash


Leave a Reply

Your email address will not be published. Required fields are marked *