I see the discussion on removing old Kernels has been locked, so forgive this ‘new topic’.
I appreciate that is not considered good practice, but I would like to remove one of the three Kernels (two of which appear to be identical oddly??) I see when booting Fedora 32.
I would then like to keep just two Kernels, the current/new one and the previous/old one.
Can anyone explain how to do that? Everything I’ve googled and found so far (2 sites) have commands which are not recognised in Fedora 32.
Simply please: I’m a newbie to Fedora and only otherwise familiar with Ubuntu and Manjaro…
Sure, here are the steps:
You can list the currently installed kernels using rpm
:
$ rpm -q kernel-core
kernel-core-5.6.8-300.fc32.x86_64
kernel-core-5.6.10-300.fc32.x86_64
kernel-core-5.6.11-300.fc32.x86_64
Then, you can remove one (not the one currently in use which you can find by running uname -a
in a terminal) using dnf
:
$ sudo dnf remove kernel-core-5.6.8-300.fc32
Dependencies resolved.
==============================================================================================================================================================================================================================================
Package Architecture Version Repository Size
==============================================================================================================================================================================================================================================
Removing:
kernel-core x86_64 5.6.8-300.fc32 @updates-testing 72 M
Removing dependent packages:
kernel x86_64 5.6.8-300.fc32 @updates-testing 0
kernel-modules x86_64 5.6.8-300.fc32 @updates-testing 28 M
kernel-modules-extra x86_64 5.6.8-300.fc32 @updates-testing 1.9 M
Transaction Summary
==============================================================================================================================================================================================================================================
Remove 4 Packages
Freed space: 102 M
Is this ok [y/N]:
To only ever have two kernels installed, you need to change the value of installonly_limit
in /etc/dnf/dnf.conf
. It is 3 by default:
$ cat /etc/dnf/dnf.conf
[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
best=False
skip_if_unavailable=True
You can do this using a terminal editor: nano/peco/vi/vim/emacs or sed:
$ sudo sed -i 's/installonly_limit=3/installonly_limit=2/' /etc/dnf/dnf.conf
$ cat /etc/dnf/dnf.conf
[main]
gpgcheck=1
installonly_limit=2
clean_requirements_on_remove=True
best=False
skip_if_unavailable=True
or
sudo dnf config-manager --setopt=installonly_limit=2 --save
Thank you very much Francisco - that was exceptionally helpful. Worked beautifully to remove the one unwanted kernel I had…
I chose Youssef’s solution to set the future limit - so thank you very much Youssef!
Many thanks Youssef. I have employed your solution to modify the kernels limit to 2.
I look forward to seeing it work!
useful guide from you.
is necessary removing them? will it breaks something on system?
i ran that command and potput is:
rpm -q kernel-core
kernel-core-5.6.6-300.fc32.x86_64
kernel-core-5.6.8-300.fc32.x86_64
kernel-core-5.6.10-300.fc32.x86_64
No, there’s no need to remove them. People usually remove them if they are running short of space on the /
partition. Fedora keeps 3 kernels installed by default, in case a new kernel has a regression and breaks some hardware users can reboot into an older kernel that works. (I test kernels from the updates-testing
repository, so I sometimes even keep 5 kernels around)
thanks for your supporting and time
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.