On 11/6/24 10:15 PM, Jeffrey Walton wrote:
[snip]
`package-cleanup --oldkernels --count=2` might help with that. It
removes all old kernels except the current kernel and the one before
it.

-bash.6[~]: package-cleanup --oldkernels --count=2
package-cleanup has to be executed with one of the options: --dupes, --leaves, 
--orphans, --problems or --cleandupes
-bash.7[~]:

I read the man page.  None of the options suggested above or in the man page 
seem to fit what's needed here.

You can also manually do it. For each old kernel listed in
/lib/modules, do something like this:

     export kernel_ver=6.11.5-200.fc40.x86_64
     dnf remove \
        kernel-$(kernel_ver) \
        kernel-core-$(kernel_ver) \
        kernel-devel-$(kernel_ver) \
        kernel-modules-$(kernel_ver)

I had to remove the parentheses.  The result of one case:

-bash.8[~]: export kernel_ver=6.10.12-100.fc39.x86_64
-bash.9[~]: echo $kernel_ver
6.10.12-100.fc39.x86_64
-bash.10[~]: dnf remove    kernel-$kernel_ver    kernel-core-$kernel_ver    
kernel-devel-$kernel_ver    kernel-modules-$kernel_ver
No match for argument: kernel-6.10.12-100.fc39.x86_64
No match for argument: kernel-core-6.10.12-100.fc39.x86_64
No match for argument: kernel-devel-6.10.12-100.fc39.x86_64
No match for argument: kernel-modules-6.10.12-100.fc39.x86_64
No packages marked for removal.
Dependencies resolved.
Nothing to do.
Complete!
-bash.11[~]:

I still have old kernel files in /boot:

-bash.17[~]: cd /boot
-bash.18[boot]: ls *-6.10.*
config-6.10.12-100.fc39.x86_64         System.map-6.10.12-100.fc39.x86_64
initramfs-6.10.12-100.fc39.x86_64.img  vmlinuz-6.10.12-100.fc39.x86_64
symvers-6.10.12-100.fc39.x86_64.xz
-bash.19[boot]:

--
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to