19

When running 'dnf update' the system will only keep 3 of the previous kernel versions installed. Once I attempt to install the 4th update then dnf wants to remove the oldest installed kernel. How can I increase or decrease the number of available/installed kernels?

gronostaj
  • 58,482
Jeff
  • 809

2 Answers2

26

Edit the file '/etc/dnf/dnf.conf', changing the numeric value in installonly_limit=3 to a number of your choosing.

Be aware that if you increase the number too high then you run the risk of filling up the /boot partition.

Jeff
  • 809
1

Nowadays it is recommended to use the drop in directories which will reduce friction during upgrades.

Create a new file, for example /etc/dnf/libdnf5.conf.d/10-usersetting-twokernels.conf

Contents:

[main]
# free some space on /boot
installonly_limit=2

Adjust the filename, number and optional comments. I believe the filename needs to end in .conf and it is good practice to prefix it with a number in case you need to add more files with higher or lower precedence later.

The minimum value is 2, the default is 3, according to the dnf documentation.

dreua
  • 113