How to remove old kernels

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

How to remove old kernels

Postby nigelc » May 19th, '21, 07:35

My system has lots of old kernels.
I tried to remove them using MCC, but it said the following cannot be selected.

cheers.
nigelc
 
Posts: 266
Joined: Aug 28th, '11, 09:35

Re: How to remove old kernels

Postby sturmvogel » May 19th, '21, 11:00

Filter: Installed
Search term: Kernel
Select all installed Kernels except the last two actual Kernels. This should work.
sturmvogel
 
Posts: 678
Joined: Jul 30th, '12, 00:39

Re: How to remove old kernels

Postby denisbr » May 19th, '21, 21:56

Hi, I recommend this tip viewtopic.php?f=7&t=7517#p47881
User avatar
denisbr
 
Posts: 13
Joined: Oct 23rd, '18, 15:57

Re: How to remove old kernels

Postby doktor5000 » May 19th, '21, 22:41

FWIW, I've also got a one-liner to remove all but the currently booted kernel, can post that if someone is interested.

Also FWIW, one *could* use urpme --auto-orphans if it's on a system where there aren't any other orphan packages, as the orphans function will also cleanup unused kernels, it keeps the most recent one and the currently running one.
Although I'd not recommend it in general for that, and will point to the warnings / explanations at https://wiki.mageia.org/en/Removing_packages
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17630
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: How to remove old kernels

Postby morgano » May 20th, '21, 07:41

@doktor, that one liner would be good to have in a sub chapter at https://wiki.mageia.org/en/Removing_packages
- If you post it here i can add it there.

We also have Bug 24403 - Feature request : tool to remove old kernels

And it is now and then discussed to have it automated somehow.
Mandriva since 2006, Mageia 2011 at home & work. Thinkpad T40, T43, T400, T510, Dell M4400, M6300, Acer Aspire 7. Workstation using LVM, LUKS, VirtualBox, BOINC
morgano
 
Posts: 1306
Joined: Jun 15th, '11, 17:51
Location: Kivik, Sweden

Re: How to remove old kernels

Postby doktor5000 » May 20th, '21, 17:42

Well, reading that - there are already several shell scripts attached to that bugreport that are more , you can link those from the wiki.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17630
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: How to remove old kernels

Postby nigelc » May 21st, '21, 02:33

Thanks for all suggestions. The question is, which one to use.
Or wait and see.

Cheers
Nigel.
nigelc
 
Posts: 266
Joined: Aug 28th, '11, 09:35

Re: How to remove old kernels

Postby morgano » May 21st, '21, 15:29

Added section https://wiki.mageia.org/en/Removing_pac ... ld_kernels with links here and to that bug.
Mandriva since 2006, Mageia 2011 at home & work. Thinkpad T40, T43, T400, T510, Dell M4400, M6300, Acer Aspire 7. Workstation using LVM, LUKS, VirtualBox, BOINC
morgano
 
Posts: 1306
Joined: Jun 15th, '11, 17:51
Location: Kivik, Sweden

Re: How to remove old kernels

Postby epp » Dec 15th, '21, 21:41

My apologies for reviving an old thread.

I am using dnf for package management (updates, etc.) When I previously used Fedora, once a kernel was updated, dnf kept the new/current kernel and the previous two. Does dnf with Mageia, do the same?

I found a forum thread viewtopic.php?f=7&t=7517#p47881, the Wiki https://wiki.mageia.org/en/Removing_pac ... ld_kernels and Bug 24403 https://bugs.mageia.org/show_bug.cgi?id=24403, but prefer an easier option to remove any old kernels.

There is also a package urpme_old-kernels that removes old kernels that I was recently made aware of, but it is not currently in core (8).

Would I need to switch to using urpmi (or the graphical interface) for package management/installation/updates in order to remove the older kernels, or stick with dnf? I recently installed Mageia and am only aware of two kernels installed: the current 5.15.6-2 and 5.15.4-1.

Thank you.
Mageia 8 x86_64 - Xfce, LXDE (VirtualBox)
Mageia Cauldron x86_64 - Xfce, MATE, LXDE (VirtualBoxes)
epp
 
Posts: 88
Joined: Nov 1st, '21, 18:44
Location: Boston, U.S.A.

Re: How to remove old kernels

Postby doktor5000 » Dec 15th, '21, 23:50

epp wrote:When I previously used Fedora, once a kernel was updated, dnf kept the new/current kernel and the previous two. Does dnf with Mageia, do the same?

AFAIR dnf under Mageia doesn't have that install_only functionality which was used to implement this initially back when yum was still around.

Apart from that, also urpmi doesn't have such functionality currently only for kernels. If you use the --auto-orphan function it will remove every old kernel except the currently booted one but the orphans handling in general can be pretty dangerous.
There has been some discussion in the bugreport you linked, currently you only have the option to run the mentioned script (which has recently been packaged as urpme_old-kernels for cauldron but this should also be installable for 8 as it's only a script)
or run urpmq --auto-orphans and see what it will remove and later remove that.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17630
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: How to remove old kernels

Postby epp » Dec 29th, '21, 23:05

I received the fourth kernel today (the third installed after the initial Mageia installation). Used dnf to install.

Code: Select all
Last metadata expiration check: 0:07:20 ago on Wed 29 Dec 2021 03:43:52 PM EST.
Package kernel-desktop-5.15.10-1.mga8-1-1.mga8.x86_64 is already installed.
Package kernel-desktop-5.15.11-3.mga8-1-1.mga8.x86_64 is already installed.
Package kernel-desktop-5.15.4-1.mga8-1-1.mga8.x86_64 is already installed.
Package kernel-desktop-5.15.6-2.mga8-1-1.mga8.x86_64 is already installed.


In /etc/dnf/dnf.conf, there is a line
Code: Select all
installonly_limit=3

Through a search, I found a web page showing this same line and its description. It should have dnf keep the current/new kernel and the two previous kernels. Since all four are showing as installed, it must be a bug in dnf, because the line limiting the install to 3 is present in the dnf.conf file.
Mageia 8 x86_64 - Xfce, LXDE (VirtualBox)
Mageia Cauldron x86_64 - Xfce, MATE, LXDE (VirtualBoxes)
epp
 
Posts: 88
Joined: Nov 1st, '21, 18:44
Location: Boston, U.S.A.

Re: How to remove old kernels

Postby sturmvogel » Dec 30th, '21, 01:18

No, it's not a bug in dnf. The information why it is not working was already provided here in this thread by linking to the bug report
https://bugs.mageia.org/show_bug.cgi?id=24403
It is related to how the Kernel versioning is done in Mageia.
sturmvogel
 
Posts: 678
Joined: Jul 30th, '12, 00:39

Re: How to remove old kernels

Postby epp » Dec 30th, '21, 01:36

I've added myself to the cc list of that bug report. I'll have to manually uninstall the oldest kernel each time, until a solution (perhaps the result of the bug report) is in the distro.
Mageia 8 x86_64 - Xfce, LXDE (VirtualBox)
Mageia Cauldron x86_64 - Xfce, MATE, LXDE (VirtualBoxes)
epp
 
Posts: 88
Joined: Nov 1st, '21, 18:44
Location: Boston, U.S.A.


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest

cron