Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork13
Installed kernel cleanup tool
License
gentoo/eclean-kernel
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
eclean-kernel is a small tool aimed at removing old and stale kernel files. Itdoes not only remove old kernels itself but also tries to remove all relatedfiles including auxiliary files in /boot, kernel modules and even the sourcetree.
The typical use is:
eclean-kernel -n 3 -p
where-n 3 is used to keep three newest kernels around, and-p makeseclean-kernel only print kernels which would be removed.
In case the results are satisfactory, use:
eclean-kernel -n 3
to actually remove the kernels.
If you are unsure whether kernel files are mapped correctly, you can uselist mode:
eclean-kernel -l
which just lists found kernels with file mappings.
Some default options can be specified ineclean-kernel.rc file in a locationmandated by the XDG configuration directory setting, e.g.~/.config/.
The file format is very simple -- additional command-line options are specifiedin shell style. For example, to keep three newest kernels and always preservekernel configs,~/.config/eclean-kernel.rc would contain:
-n 3 -x config
The options read from config files will be parsed before actual command-lineoptions, so the latter will override them.
eclean-kernel supports two distinct /boot layouts: the bootloader speclayout (gummiboot / systemd-boot) and the legacy /boot layout.The former is used if/boot/MACHINE-ID or/boot/EFI/MACHINE-IDare found, otherwise the latter is used.
The bootloader spec layout uses subdirectories of/boot/MACHINE-IDnamed after kernel versions. It expects the kernel to be namedlinux, and initramfs to be namedinitrd. However, it collectsarbitrary files in that directory as well.
The legacy layout scans all files directly in/boot directorythat are named asPREFIX-VERSION. Files recognized as bzImagescan have any prefix, other files use a predefined list of prefixes.
In both layouts, eclean-kernel looks for kernel modulesin/lib/modules/REALVERSION whereREALVERSION corresponds tothe actual kernel version string used by the kernel itself. It is readfrom kernel image and it is assumed to be equal toVERSION for libdirsunmatched to any kernel image.
In other words, genkernel-generatedkernel-genkernel-ARCH-X.Y.Z willmatchSystem.map-genkernel-ARCH-X.Y.Z and/lib/modules/X.Y.Z.
The kernel choice algorithm is quite simple:
- If the kernel is currently used, don't remove it;
- If the kernel is referenced by a bootloader, don't remove it(unless
--destructive); - If auxiliary files do not map to existing kernel, remove them;
- If
--allis used, remove the kernel; - If kernel is not withinN newest kernels (whereN is the argumentto
-n), remove it.
The program always derefences symlinks and counts real path references. Thus,a particular file will be removed only if all kernels referencing it are removedas well. This is especially important for shared kernel sources.
In order to determine kernels currently used, eclean-kernel is supposed to readconfiguration files used by the bootloader. Right now, the following bootloadersare supported (and looked up in the following order):
- lilo,
- grub2,
- grub,
- yaboot.
There is also a pseudo-bootloader module calledsymlinks which assumes filessymlinked to/boot/PREFIX and/boot/PREFIX.old are used.
By default, eclean-kernel uses the first bootloader from the above list forwhich a configuration file exists, and usessymlinks as a fallback. This canbe changed using--bootloader argument.
Please report bugs either tothe issue tracker orGentoo Bugzilla. Whenreporting a bug, please attach the outputs of:
eclean-kernel -lls -l /boot /lib/modules/*
If relevant, please attach bootloader configuration files as well.
About
Installed kernel cleanup tool
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors15
Uh oh!
There was an error while loading.Please reload this page.