Skip to content

feat: force clean if /boot is empty #66

@LiviaMedeiros

Description

@LiviaMedeiros

eclean-kernel, even with -a and -d options, exits with SystemError: No vmlinuz found when doesn't see anything in /boot.

# eclean-kernel -adD
DEBUG:root:Sorter: <ecleankernel.sort.VersionSort object at 0x7f974be9cd70>
DEBUG:root:Layout failed: <class 'ecleankernel.layout.blspec.BlSpecLayout'>; exception: /boot/[EFI/]loader not found
DEBUG:root:Layout: <ecleankernel.layout.std.StdLayout object at 0x7f974be9d010>
DEBUG:root:Bootloader failed: <class 'ecleankernel.bootloader.lilo.LILO'>
DEBUG:root:Bootloader failed: <class 'ecleankernel.bootloader.grub2.GRUB2'>
DEBUG:root:Bootloader failed: <class 'ecleankernel.bootloader.grub.GRUB'>
DEBUG:root:Bootloader failed: <class 'ecleankernel.bootloader.yaboot.Yaboot'>
DEBUG:root:Bootloader: <ecleankernel.bootloader.symlinks.Symlinks object at 0x7f974be9d160>
DEBUG:root:in get_removal_list()
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.13/eclean-kernel", line 8, in <module>
    sys.exit(setuptools_main())
             ~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/ecleankernel/__main__.py", line 391, in setuptools_main
    sys.exit(main(sys.argv[1:]))
             ~~~~^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/ecleankernel/__main__.py", line 251, in main
    removals = get_removal_list(
        kernels,
    ...<2 lines>...
        bootloader=bootloader,
        destructive=args.destructive)
  File "/usr/lib/python3.13/site-packages/ecleankernel/process.py", line 81, in get_removal_list
    raise SystemError(
        "No vmlinuz found. This is a serious problem, and it would "
        "mean removing all remaining files. Aborting.")

Meanwhile, eclean-kernel --list-kernels works perfectly and locates both leftovers in /usr/src (from gentoo-sources) and /lib/modules (from make modules_install):

# eclean-kernel --list-kernels
### [skipped a lot of outdated entries]
other 6.19.6-gentoo-pinne [None]
- modules: /lib/modules/6.19.6-gentoo-pinne
- last modified: 2026-03-10 12:58:49
other 6.18.26-gentoo-pinne [None]
- modules: /lib/modules/6.18.26-gentoo-pinne
- build: /usr/src/linux-6.18.26-gentoo
- last modified: 2026-05-06 06:17:20
other 6.18.23-gentoo-pinne [None]
- modules: /lib/modules/6.18.23-gentoo-pinne
- last modified: 2026-05-06 00:13:01
other 6.18.20-gentoo-pinne [None]
- modules: /lib/modules/6.18.20-gentoo-pinne
- build: /usr/src/linux-6.18.20-gentoo
- last modified: 2026-03-26 13:26:31
other 6.18.19-gentoo-pinne [None]
- modules: /lib/modules/6.18.19-gentoo-pinne
- last modified: 2026-03-23 07:47:22
other 6.18.16-gentoo-pinne [None]
- modules: /lib/modules/6.18.16-gentoo-pinne
- last modified: 2026-03-11 13:30:21

I would like to be able to run something like eclean-kernel -adAM --no-bootloader-update, ignore the potential 'no vmlinuz&initramfs found' notices, and select which entries should stay and which should be purged.
However, eclean-kernel refuses to do so, because /boot is empty.
In my case, the system is located in zram, exported via NFS as read-only root for systems booted over PXE, and is currently accessed from host system via chroot. The kernels have CONFIG_BLOCK unset, the target systems do not have persistent storage, there is no bootloader; /boot is completely empty and populating it with any files would be a waste of RAM.

Of course on typical setups empty /boot is more likely to imply that it is simply not mounted, so override should be kept behind either prompt (explaining that if we proceed without access to bootloader's files, we might break everything), or behind some new --ignore-empty-boot option.
Alternatively this behaviour can be added to the existing --destructive option, since it's somewhat implied here anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions