How can I change the number of kernels retained when updating in Fedora?

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

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

Edit Dec. 2024: f41 ships dnf5, which makes use of drop-in repo directories. Using the old /etc/dnf/dnf.conf config file would still work, but you better place your config in /etc/dnf/libdnf5.conf.d/10-user-settings.conf. Put installonly_limit=<x> in the [Main] section of the config file

Using and configuring dnf is well described in DNF5 Configuration Reference — dnf5 documentation

9 Likes