From Fedora Project Wiki

Revision as of 07:33, 18 November 2023 by Thl (talk | contribs)

Linux kernel vanilla repositories for Fedora Linux

The kernel vanilla repositories allow you to quickly, comfortably, and cleanly install the latest upstream Linux kernels on Fedora Linux. They provide various coprs with ready-to-use kernel packages built from upstream Linux series like ‘mainline’ and ‘stable’. The provided packages are ideal for both quick tests and regular day-to-day use.

To install the latest kernel version deemed for end users, follow the instructions in the first section below. For various other use cases, head over to the second section to choose which of the six coprs provides the Linux kernels you want; then enable the particular copr and update your system as explained in the third section. The fourth section explains how to remove the kernel vanilla repositories and everything installed from them.

Install the latest Linux version meant for end users

To install the latest Linux kernel meant for regular end users run the following commands:

sudo dnf -y copr enable @kernel-vanilla/stable
sudo dnf upgrade 'kernel*'
mokutil --sb-state

The first two commands enable the ‘stable’ copr, which then is used to install the latest mainline kernel (say 6.1) or the latest version from a stable series derived from it (e.g. 6.1.1, 6.1.2, …). The third command executed will tell you if UEFI Secure Boot is active on your system; if that's the case you have to either disable it in your system's BIOS Setup or through a process initiated through mokutil --disable-validation; that's needed, as your firmware will otherwise reject booting kernels installed from these repositories.

Linux kernels offered in the six kernel vanilla coprs

The kernel vanilla repositories for Fedora Linux provide six @kernel-vanilla coprs to serve different use-cases: ‘fedora’, ‘stable’, ‘stable-rc’, ‘mainline-wo-mergew’, ‘mainline’, and ‘next’). Use the following table to decide which of them you want to use:

@kernel-vanilla copr description example version sequence target users
fedora The latest kernel version from the stable series the newest Fedora Linux release currently uses. …, 6.0.18,
6.0.19,
6.1.5,
6.1.6, …
Anyone wanting to use the latest release from the kernel series Fedora Linux currently uses – for example to check if a bug that happens with Fedora's kernel occurs with the latest upstream version from the same kernel series.
stable The latest kernel version meant for regular end users, e.g. either the latest mainline release or the newest version from a stable series derived from it. …, 6.0.15,
6.1,
6.1.1,
6.1.2, …
Anyone who wants the latest and greatest kernel.
stable-rc Pre-releases of the next release from the latest stable series. …, 6.0.15-rc1,
6.0.15,
6.1,
6.1.1-rc1,
6.1.1, …
Anyone who wants to help testing Linux stable kernels about to be released.
mainline-wo-mergew The latest mainline kernel, either built from a proper release, a pre-release (aka "rc kernel"), or a git snapshot – albeit the latter only after -rc1 was released. …, 6.1-rc8-20221211,
6.1,
6.1.1-rc1,
6.1.1,
6.2-rc1,
6.2-rc1-20221226, …
Anyone who normally wants the latest mainline kernel, but wants to play it a bit safer by avoiding mainline during its 'merge windows' – that's the phase at the beginning of each development cycle where the bulk of changes including all riskier ones are merged for the next mainline release, before its first pre-release (e.g. "6.x-rc1") is published.
mainline Mainline kernels, either built from a proper release, a pre-release (aka "rc kernel"), or a git snapshot. …, 6.1-rc8-20221211,
6.1,
6.2-rc0-20221213,
6.2-rc0-20221214, …
Anyone who wants to run a kernel built from the latest Linux codebase.
next Linux-next kernels. …, 6.1-0.0.next.20221209,
6.2-0.0.next.20221212,
6.2-0.0.next.20221213, …
Anyone who wants to run linux-next or test if the changes slated for inclusion in the next mainline cycle fix a problem.

Note, only the next copr is stand-alone; all the others include coprs mentioned earlier in the table as a runtime dependency. Users of the ‘stable-rc’ copr thus will receive packages from the ‘stable’ or ‘fedora’ coprs when the latter contain kernel packages which package managers like dnf will considers newer. That way users of stable-rc copr won't be stuck on a -rc release with known problems that were fixed in the final release derived from it.

There is something else to note for users of Fedora versions in development, e.g rawhide and beta releases: be aware that these repositories will not provide kernel versions older than the one the particular Fedora release uses by default, as doing so could lead to problems. Rawhide for example regularly uses the latest mainline snapshots; that’s why rawhide users that have one of these repos enabled will receive vanilla mainline snapshots as well, even if they chose the ‘stable’ or ‘mainline-wo-mergew’ repos. Users of Fedora pre-releases (e.g. a beta version) might see similar effects, but once the Fedora version gets closer to its release date things will start to work as advertised.

How to install a kernel from the vanilla repositories

First enable the kernel vanilla copr you want to use – for example the one shipping a kernel built from the latest mainline code:

sudo dnf -y copr enable @kernel-vanilla/mainline

Now update your system to install the latest package from the copr:

sudo dnf upgrade 'kernel*'

If you’re on a x86-64 (aka AMD64) system execute the following command as well:

mokutil --sb-state

It it tells you ‘SecureBoot enabled’ you will have to turn it off either in your BIOS Setup or through a process initiated with sudo mokutil --disable-validation. That sadly is needed, as your system otherwise will not boot any kernels from these repositories: it's technically impossible for copr to sign the kernels with a key typical x86-64 systems trust.

Once you booted your vanilla kernel you have two options:

  • In case you want to use the chosen copr regularly, consider advising dnf to check the packages repositories more often than usual to retrieve new kernels faster. You can do this by running the following commands:
sudo sed -i 's!baseurl=https://download.copr.fedorainfracloud.org/results/@kernel-vanilla/\(mainline\|stable-rc\|next\).*!&\nmetadata_expire=1h!g; s!baseurl=https://download.copr.fedorainfracloud.org/results/@kernel-vanilla/\(stable\|fedora\)/.*!&\nmetadata_expire=4h!g;' /etc/yum.repos.d/_copr:copr.fedorainfracloud.org:group_kernel-vanilla:*.repo
  • In case you installed the vanilla kernel just for a quick test, consider removing the just configured copr immediately as explained in the next section; once you finish your tests you furthermore want to uninstall the vanilla kernel to retrieve newly released kernel packages from Fedora again.

How to remove the kernel vanilla repositories and uninstall kernels installed from them

Disable any kernel vanilla copr you enabled:

dnf copr list | grep 'group_kernel-vanilla' | xargs -r sudo dnf copr remove

Now ensure you have the latest official kernel installed Fedora offers

sudo dnf --refresh distrosync kernel

At this step it is highly recommended to boot into the latest official Fedora kernel; to do so, reboot and choose the top-most one from the boot menu that does not have 'vanilla' in the name.

Now remove all kernels installed from the kernel vanilla coprs:

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

If you disabled UEFI Secure Boot, you might want to turn it on again using the path you took to disable it, e.g. either through your BIOS Setup or a a process initiated with sudo mokutil --enable-validation.

From now on your system will behave like one that never had these repositories enabled or kernels installed from it.

How vanilla kernels compare to Fedora’s

Most of the time these kernels will work roundabout as well and secure as Fedora’s. Sometimes though the kernels from these repositories will work better, as they contain drivers or security fixes that haven’t reached the kernel used by Fedora Linux yet; other times it's the other way around, as Fedora sometimes includes fixes that upstream hasn't picked up yet. But those differences rarely matter much.

Apparently coprs are normal

Please be aware that at least one and up to three out of the six kernel vanilla coprs will always look empty or outdated when you check copr’s web interface or look straight at the package repositories. That is totally normal, as it will look like that when the most recent build suitable for users of that copr is found in one of the other copr included as a runtime dependency. The note below the table above explains this in more detail.

Linux kernel versions currently offered

A repostatus file shows what the repositories currently provide. Alternatively, execute the following script to query the latest packages locally:

dists=(37 38 39 rawhide)
dnf clean all > /dev/null
for repo in fedora stable{,-rc} mainline{-wo-mergew,} next; do
	[[ ${repo} =~ (fedora|next) ]] && unset repostring
	repostring="${repostring} --repofrompath=kvr-${repo},https://download.copr.fedorainfracloud.org/results/@kernel-vanilla/${repo}/fedora-\${distro}-x86_64/"
	for distro in ${dists[*]} ; do
  	  queryresult="$(eval dnf repoquery ${repostring} --disablerepo=* --enablerepo=kvr-* --latest-limit=1 -q kernel --arch x86_64 --qf '%{version}-%{release}')"
		  printf '%-20s %-10s %s\n' "${repo}" "${distro}" "${queryresult:-lookup failed}"
	done
done

Developers behind the effort and point of contact

The Linux kernel vanilla repositories for Fedora are maintained by Thorsten Leemhuis (aka "knurd") since late 2012. The packages they provide are build using a RPM spec file that is nearly identical to the one used to build Fedora’s kernel. Note though that none of the maintainers of the the official Fedora Linux kernel are involved in the maintenance of these repositories.

For any feedback or questions regarding the kernel vanilla repositories contact Thorsten Leemhuis (aka "knurd").

What’s the goal of these repositories? And are these kernels as good as Fedora’s?

These and many other questions are answered in the FAQ about the Linux kernel vanilla repositories for Fedora Linux.