Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Installed kernel cleanup tool

License

NotificationsYou must be signed in to change notification settings

gentoo/eclean-kernel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

270 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

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.

Usage

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.

Configuration file

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.

Fiding and mapping kernels

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.

Choosing kernels to remove

The kernel choice algorithm is quite simple:

  1. If the kernel is currently used, don't remove it;
  2. If the kernel is referenced by a bootloader, don't remove it(unless--destructive);
  3. If auxiliary files do not map to existing kernel, remove them;
  4. If--all is used, remove the kernel;
  5. 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.

Bootloader support

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):

  1. lilo,
  2. grub2,
  3. grub,
  4. 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.

Reporting bugs

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

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published

Contributors15

Languages


[8]ページ先頭

©2009-2026 Movatter.jp