How to Install Mainline Linux Kernel on Fedora

Vanilla kernels from the Kernel Vanilla COPR repositories let you run upstream Linux kernels on Fedora without Fedora-specific patches. This guide walks through enabling these repositories, installing a mainline or stable vanilla kernel, and reverting to Fedora’s default kernel when needed.

Running a vanilla kernel is useful when you need newer hardware support before Fedora’s kernel catches up, want to test upstream fixes for bugs you’ve encountered, or need to verify whether an issue exists in the upstream kernel or is specific to Fedora’s patches. The Kernel Vanilla project maintains several COPR repositories targeting different development stages, from stable releases to bleeding-edge linux-next builds.

By the end of this guide, you will have a working vanilla kernel installed alongside Fedora’s default kernel, with the ability to select either at boot time and cleanly remove the vanilla kernel if needed.

Choose Your Kernel Vanilla Repository

The @kernel-vanilla group maintains six COPR repositories, each serving different use cases. All repositories build kernels using Fedora’s build infrastructure, making them compatible with your existing system configuration.

RepositoryKernel SourceUpdate FrequencyBest For
@kernel-vanilla/mainline-wo-mergewMainline (paused during merge window)Daily buildsTracking mainline without merge-window instability
@kernel-vanilla/mainlineMainline (including merge window)Daily buildsDevelopers tracking all mainline changes
@kernel-vanilla/nextlinux-next treeDaily buildsDevelopers testing patches queued for future releases
@kernel-vanilla/fedoraLatest stable seriesWithin days of upstream releaseUsers wanting stable vanilla kernels
@kernel-vanilla/stable-rcStable release candidatesAs stable-rc updatesTesting upcoming stable releases
@kernel-vanilla/fedora-rcStable-rc for Fedora’s seriesAs stable-rc updatesTesting fixes for Fedora’s current kernel series

Choose @kernel-vanilla/mainline-wo-mergew to track upstream mainline development with daily builds that pause during the chaotic two-week merge window. For testing the absolute bleeding edge, @kernel-vanilla/mainline builds daily including merge-window commits. If you want upstream kernels without the development churn, @kernel-vanilla/fedora provides the latest stable release within days of upstream.

Secure Boot Considerations

Kernel Vanilla packages are not signed with Fedora’s Secure Boot keys. If Secure Boot is enabled, your system will refuse to boot these kernels. You have two options: disable Secure Boot in your UEFI firmware, or sign the kernel yourself using Machine Owner Keys (MOK).

Check Secure Boot Status

Verify whether Secure Boot is currently enabled using the mokutil utility. If the command is not found, install it first:

sudo dnf install mokutil

Check your Secure Boot status:

mokutil --sb-state

Expected output when Secure Boot is enabled:

SecureBoot enabled

If the output shows SecureBoot disabled, you can proceed directly to the installation steps.

Disable Secure Boot

To disable Secure Boot:

  1. Restart your computer and enter the UEFI firmware settings (typically by pressing F2, F12, Delete, or Esc during boot).
  2. Navigate to the Secure Boot settings. The exact location varies by manufacturer but is usually under Security, Boot, or Authentication menus.
  3. Set Secure Boot to Disabled.
  4. Save changes and exit. Your system will restart with Secure Boot disabled.

Disabling Secure Boot reduces protection against bootkit malware. If security is a priority, consider signing the kernel with your own MOK keys instead.

Install a Vanilla Kernel

Update Your System

Ensure your system is current before installing a new kernel:

sudo dnf upgrade --refresh

Reboot if any kernel updates were installed to ensure you’re running the latest Fedora kernel before adding the vanilla kernel.

Enable the Kernel Vanilla Repository

Enable your chosen repository. This example uses the recommended @kernel-vanilla/mainline-wo-mergew repository for mainline kernels:

sudo dnf copr enable @kernel-vanilla/mainline-wo-mergew

DNF displays a notice that COPR repositories are community-maintained and not officially supported by Fedora:

Enabling a Copr repository. Please note that this repository is not part
of the main distribution, and quality may vary.

The Fedora Project does not exercise any power over the contents of
this repository beyond the rules outlined in the Copr FAQ at
,
and packages are not held to any quality or security level.

Please do not file bug reports about these packages in Fedora
Bugzilla. In case of problems, contact the owner of this repository.

Type y to confirm when prompted. This warning is expected for all COPR repositories.

To enable a different repository, replace the repository name:

# For stable vanilla kernels (latest upstream stable release)
sudo dnf copr enable @kernel-vanilla/fedora

# For linux-next development kernels
sudo dnf copr enable @kernel-vanilla/next

Install the Vanilla Kernel

Upgrade all kernel packages to pull in the vanilla kernel from the enabled repository:

sudo dnf upgrade 'kernel*'

DNF prompts you to import the GPG key for the COPR repository on first use. Accept the key to continue.

Reboot to load the new kernel:

sudo reboot

Verify the Installation

Confirm the vanilla kernel is running:

uname -r

Vanilla kernels include .vanilla in the version string. Example output from the @kernel-vanilla/mainline-wo-mergew repository:

6.19.0-0.rc5.260115.944aacb6.339.vanilla.fc43.x86_64

Mainline kernels use version patterns like 6.19.0-0.rc5 indicating release candidates, while stable vanilla kernels show patterns like 6.18.5-300.vanilla for released stable versions.

Version numbers change frequently with daily builds. The key identifier is .vanilla. in the version string, which confirms you are running a Kernel Vanilla build rather than the standard Fedora kernel.

For detailed version information including the build date:

cat /proc/version
Linux version 6.19.0-0.rc5.260115.944aacb6.339.vanilla.fc43.x86_64 (mockbuild@fedora) (gcc (GCC) 15.x.x, GNU ld version 2.x) #1 SMP PREEMPT_DYNAMIC (build date varies)

Restore the Default Fedora Kernel

If you encounter issues with the vanilla kernel or no longer need it, you can restore Fedora’s default kernel and remove the COPR repository.

Remove the COPR Repository

Remove the Kernel Vanilla repository to prevent future vanilla kernel updates:

sudo dnf copr remove @kernel-vanilla/mainline-wo-mergew

Replace mainline-wo-mergew with whichever repository you enabled. To see all enabled COPR repositories:

dnf copr list

Synchronize to Fedora’s Kernel

Use distro-sync to downgrade kernel packages to Fedora’s official versions:

sudo dnf distro-sync 'kernel*' --refresh

The 'kernel*' wildcard ensures all kernel-related packages (kernel-core, kernel-modules, kernel-devel, etc.) are synchronized back to Fedora’s official versions. This command compares your installed kernel packages against Fedora’s repositories and downgrades them to match.

Reboot and Select the Default Kernel

Reboot your system:

sudo reboot

At the GRUB boot menu, select the Fedora kernel entry (it will not contain .vanilla in the version string). If GRUB automatically boots the vanilla kernel, press any key during boot to access the menu, or hold Shift on UEFI systems.

Remove Vanilla Kernel Packages

Once running the Fedora kernel, remove the vanilla kernel packages to free disk space:

rpm -qa 'kernel*' | grep '.vanilla' | xargs -r sudo dnf remove

Verify the vanilla kernel has been removed:

rpm -qa 'kernel*' | grep vanilla

No output indicates all vanilla kernel packages have been removed.

Manage Installed Kernels

Fedora keeps multiple kernel versions installed by default, allowing you to boot an older kernel if problems occur.

List Installed Kernels

View all installed kernel packages:

rpm -qa 'kernel-core*' | sort

Example output showing both Fedora and vanilla kernels:

kernel-core-6.18.5-200.fc43.x86_64
kernel-core-6.19.0-0.rc5.260115.944aacb6.339.vanilla.fc43.x86_64

Remove Old Kernels

To remove all kernels except the one currently running, use this command that lists all kernel-core packages, filters out the running kernel, and removes the rest:

sudo dnf remove $(rpm -qa 'kernel-core*' | grep -v "$(uname -r | sed 's/\.x86_64$//')")

This one-liner works by first querying all installed kernel-core packages, then using grep -v to exclude the version matching your running kernel (uname -r), and finally passing the remaining package names to dnf remove.

Always keep at least one known-working kernel installed. Removing all kernels except an untested one risks leaving your system unbootable if the remaining kernel fails.

Troubleshooting

System Fails to Boot with Vanilla Kernel

If your system does not boot after installing a vanilla kernel:

  1. Restart your computer and access the GRUB menu by pressing Esc or holding Shift during boot.
  2. Select a Fedora kernel entry (without .vanilla in the name) using the arrow keys.
  3. Press Enter to boot the selected kernel.
  4. Once booted, remove the problematic vanilla kernel and COPR repository as described in the restoration section above.

GRUB Does Not Show Kernel Options

If GRUB boots directly without showing a menu, edit the GRUB configuration to display the menu:

sudo grub2-editenv - unset menu_auto_hide

On the next boot, GRUB displays the kernel selection menu.

Secure Boot Prevents Booting

If you see a Secure Boot violation error, the vanilla kernel’s unsigned modules are being blocked. Either disable Secure Boot as described earlier, or sign the kernel with MOK keys.

Third-Party Kernel Modules Missing

DKMS modules (NVIDIA drivers, VirtualBox, etc.) need to rebuild against the new kernel. If modules are missing after booting the vanilla kernel:

sudo dkms autoinstall

This rebuilds all registered DKMS modules for the running kernel. You may need the kernel headers package installed for compilation:

sudo dnf install kernel-devel-$(uname -r)

Conclusion

You now have the tools to install, manage, and remove mainline and vanilla kernels on Fedora using the Kernel Vanilla COPR repositories. The @kernel-vanilla/mainline-wo-mergew repository provides daily mainline builds suitable for tracking upstream development, while @kernel-vanilla/fedora offers the latest stable release for users who want upstream kernels without the development churn. Keep at least one working kernel installed as a fallback, and test new kernels thoroughly before removing older ones.

Leave a Comment

Let us know you are human: