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

I’ve updated the information provided in the solution to reflect the changes that came with the introduction of dnf5 in Fedora 41. I also added a link to the official dnf5 documentation, which is probably the most reliable and most up-to-date answer to the question.

3 Likes