Thursday, October 17, 2019

Limiting Number of Old Kernels in Fedora Linux

As we upgrade/update Linux systems, such as, Fedora Linux, we will see the old kernels accumulate in the system. Since these kernel images are in the Boot partition that is often small, the Boot partition can run out of space. We may remove these old kernel images if we are certain the new kernel installed via the upgrade/update process works fine. In the past, I did it manually (since I didn't know better). In fact, we can do it automatically by configuring the system to allow a number of kernels in the system.

For this, in Fedora Linux, we can add a line to /etc/dnf.conf, such as,

installonly_limit=2

which limits the number of installed kernels to 2. When we perform a dnf upgrade, the system shall remove the old kernel images exceeding the limit. By the way, for a Linux distribution utilizing YUM, adding the same line to /etc/yum.conf will have the same effect.

No comments:

Post a Comment