Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 913351 - app-admin/eclean-kernel: removes fresh kernel installed by sys-kernel/installkernel[systemd]
Summary: app-admin/eclean-kernel: removes fresh kernel installed by sys-kernel/install...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michał Górny
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-31 02:27 UTC by Nick Owens
Modified: 2024-03-16 16:13 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Owens 2023-08-31 02:27:51 UTC
i can build 6.5-rc7 and install it and it will be the default entry in systemd-boot, but running eclean-kernel will suggest to remove it. it shouldn't remove the default entry of systemd-boot.

beast /usr/src/linux # make install
  INSTALL /boot
dracut: Executing: /usr/bin/dracut -f /boot/8e9dce24dde354032c8d155363fd7c13/6.5.0-rc7/initrd 6.5.0-rc7
dracut: *** Including module: dm ***
dracut: Skipping udev rule: 64-device-mapper.rules
dracut: Skipping udev rule: 60-persistent-storage-dm.rules
dracut: Skipping udev rule: 55-dm.rules
dracut: *** Including module: lvm ***
dracut: Skipping udev rule: 64-device-mapper.rules
dracut: Skipping udev rule: 56-lvm.rules
dracut: Skipping udev rule: 60-persistent-storage-lvm.rules
dracut: *** Including module: rootfs-block ***
dracut: *** Including module: udev-rules ***
dracut: Skipping udev rule: 40-redhat.rules
dracut: Skipping udev rule: 50-firmware.rules
dracut: Skipping udev rule: 50-udev.rules
dracut: Skipping udev rule: 91-permissions.rules
dracut: Skipping udev rule: 80-drivers-modprobe.rules
dracut: *** Including module: base ***
dracut: *** Including module: fs-lib ***
dracut: *** Including modules done ***
dracut: *** Installing kernel module dependencies ***
dracut: *** Installing kernel module dependencies done ***
dracut: *** Resolving executable dependencies ***
dracut: *** Resolving executable dependencies done ***
dracut: *** Hardlinking files ***
dracut: Mode:                     real
dracut: Method:                   sha256
dracut: Files:                    189
dracut: Linked:                   0 files
dracut: Compared:                 0 xattrs
dracut: Compared:                 3 files
dracut: Saved:                    0 B
dracut: Duration:                 0.000949 seconds
dracut: *** Hardlinking files done ***
dracut: *** Generating early-microcode cpio image ***
dracut: *** Constructing AuthenticAMD.bin ***
dracut: *** Store current command line parameters ***
dracut: *** Stripping files ***
dracut: *** Stripping files done ***
dracut: *** Creating image file '/boot/8e9dce24dde354032c8d155363fd7c13/6.5.0-rc7/initrd' ***
dracut: *** Creating initramfs image file '/boot/8e9dce24dde354032c8d155363fd7c13/6.5.0-rc7/initrd' done ***
beast /usr/src/linux # bootctl
System:
      Firmware: UEFI 2.80 (American Megatrends 5.26)
 Firmware Arch: x64
   Secure Boot: disabled (disabled)
  TPM2 Support: firmware only, driver unavailable
  Boot into FW: supported

Current Boot Loader:
      Product: systemd-boot 252
     Features: ✓ Boot counting
               ✓ Menu timeout control
               ✓ One-shot menu timeout control
               ✓ Default entry control
               ✓ One-shot entry control
               ✓ Support for XBOOTLDR partition
               ✓ Support for passing random seed to OS
               ✓ Load drop-in drivers
               ✓ Support Type #1 sort-key field
               ✓ Support @saved pseudo-entry
               ✓ Support Type #1 devicetree field
               ✓ Boot loader sets ESP information
          ESP: /dev/disk/by-partuuid/2d72fad9-583b-4d9d-aedb-02a2771d9cd1
         File: └─/EFI/systemd/systemd-bootx64.efi

Random Seed:
 System Token: set
       Exists: yes

Available Boot Loaders on ESP:
          ESP: /boot (/dev/disk/by-partuuid/2d72fad9-583b-4d9d-aedb-02a2771d9cd1)
         File: ├─/EFI/systemd/systemd-bootx64.efi
               └─/EFI/BOOT/BOOTX64.EFI

Boot Loaders Listed in EFI Variables:
        Title: Linux Boot Manager
           ID: 0x0002
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/2d72fad9-583b-4d9d-aedb-02a2771d9cd1
         File: └─/EFI/systemd/systemd-bootx64.efi

        Title: Windows Boot Manager
           ID: 0x0001
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/a026f7e5-54e2-43e2-a458-4084006b6b1c
         File: └─/EFI/Microsoft/Boot/bootmgfw.efi

        Title: UEFI OS
...skipping...
               ✓ Boot loader sets ESP information
          ESP: /dev/disk/by-partuuid/2d72fad9-583b-4d9d-aedb-02a2771d9cd1
         File: └─/EFI/systemd/systemd-bootx64.efi

Random Seed:
 System Token: set
       Exists: yes

Available Boot Loaders on ESP:
          ESP: /boot (/dev/disk/by-partuuid/2d72fad9-583b-4d9d-aedb-02a2771d9cd1)
         File: ├─/EFI/systemd/systemd-bootx64.efi
               └─/EFI/BOOT/BOOTX64.EFI

Boot Loaders Listed in EFI Variables:
        Title: Linux Boot Manager
           ID: 0x0002
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/2d72fad9-583b-4d9d-aedb-02a2771d9cd1
         File: └─/EFI/systemd/systemd-bootx64.efi

        Title: Windows Boot Manager
           ID: 0x0001
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/a026f7e5-54e2-43e2-a458-4084006b6b1c
         File: └─/EFI/Microsoft/Boot/bootmgfw.efi

        Title: UEFI OS
           ID: 0x0005
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/2d72fad9-583b-4d9d-aedb-02a2771d9cd1
         File: └─/EFI/BOOT/BOOTX64.EFI

Boot Loader Entries:
        $BOOT: /boot (/dev/disk/by-partuuid/2d72fad9-583b-4d9d-aedb-02a2771d9cd1)
        token: gentoo

Default Boot Loader Entry:
         type: Boot Loader Specification Type #1 (.conf)
        title: Gentoo Linux (6.5.0-rc7)
           id: 8e9dce24dde354032c8d155363fd7c13-6.5.0-rc7.conf
       source: /boot//loader/entries/8e9dce24dde354032c8d155363fd7c13-6.5.0-rc7.conf
     sort-key: gentoo
      version: 6.5.0-rc7
   machine-id: 8e9dce24dde354032c8d155363fd7c13
        linux: /boot//8e9dce24dde354032c8d155363fd7c13/6.5.0-rc7/linux
       initrd: /boot//8e9dce24dde354032c8d155363fd7c13/6.5.0-rc7/initrd
      options: root=UUID=11606a5d-b169-4d10-9520-039789a65607 rw systemd.machine_id=8e9dce24dde354032c8d155363fd7c13
beast /usr/src/linux # eclean-kernel -A
No outdated kernels found.
beast /usr/src/linux # eclean-kernel -a -A
Preserving currently running kernel (6.5.0-rc4)
Legend:
[-] file being removed
[x] file does not exist (anymore)
[+] file being kept (used by other kernels)

Remove bls 6.5.0-rc7 (not referenced by bootloader (symlinks))? [Yes/No]NO
beast /usr/src/linux #

beast /usr/src/linux # eclean-kernel -l
ls -l /boot /lib/modules/*
bls 6.5.0-rc7 [6.5.0-rc7]
- emptydir: /boot/8e9dce24dde354032c8d155363fd7c13/6.5.0-rc7
- initramfs: /boot/8e9dce24dde354032c8d155363fd7c13/6.5.0-rc7/initrd
- vmlinuz: /boot/8e9dce24dde354032c8d155363fd7c13/6.5.0-rc7/linux
- modules: /lib/modules/6.5.0-rc7
- build: /usr/src/linux-6.5-rc7
- last modified: 2023-08-31 02:18:05
bls 6.5.0-rc4 [6.5.0-rc4]
- emptydir: /boot/8e9dce24dde354032c8d155363fd7c13/6.5.0-rc4
- initramfs: /boot/8e9dce24dde354032c8d155363fd7c13/6.5.0-rc4/initrd
- vmlinuz: /boot/8e9dce24dde354032c8d155363fd7c13/6.5.0-rc4/linux
- modules: /lib/modules/6.5.0-rc4
- build: /usr/src/linux-6.5-rc4
- last modified: 2023-08-03 08:06:31
/boot:
total 24
drwxr-xr-x 4 root root 4096 Aug 30 19:18  8e9dce24dde354032c8d155363fd7c13
drwxr-xr-x 2 root root 4096 Mar 17 18:06  bios
drwxr-xr-x 5 root root 4096 Mar 17 16:32  EFI
drwxr-xr-x 3 root root 4096 Aug 27 14:16  loader
drwxr-xr-x 2 root root 4096 Jul 16 21:27  memtest86plus
drwxr-xr-x 2 root root 4096 Mar 13 10:11 'System Volume Information'

/lib/modules/6.5.0-rc4:
total 1296
lrwxrwxrwx  1 root root     22 Aug  3 01:06 build -> /usr/src/linux-6.5-rc4
drwxr-xr-x 10 root root   4096 Aug  3 01:06 kernel
-rw-r--r--  1 root root 279645 Aug  3 01:06 modules.alias
-rw-r--r--  1 root root 286154 Aug  3 01:06 modules.alias.bin
-rw-r--r--  1 root root   6225 Aug  3 01:06 modules.builtin
-rw-r--r--  1 root root   6102 Aug  3 01:06 modules.builtin.alias.bin
-rw-r--r--  1 root root   8719 Aug  3 01:06 modules.builtin.bin
-rw-r--r--  1 root root  56755 Aug  3 01:06 modules.builtin.modinfo
-rw-r--r--  1 root root  46923 Aug  3 01:06 modules.dep
-rw-r--r--  1 root root  72251 Aug  3 01:06 modules.dep.bin
-rw-r--r--  1 root root    314 Aug  3 01:06 modules.devname
-rw-r--r--  1 root root  21496 Aug  3 01:06 modules.order
-rw-r--r--  1 root root    592 Aug  3 01:06 modules.softdep
-rw-r--r--  1 root root 234961 Aug  3 01:06 modules.symbols
-rw-r--r--  1 root root 270826 Aug  3 01:06 modules.symbols.bin
lrwxrwxrwx  1 root root     22 Aug  3 01:06 source -> /usr/src/linux-6.5-rc4

/lib/modules/6.5.0-rc7:
total 1296
lrwxrwxrwx  1 root root     22 Aug 30 19:18 build -> /usr/src/linux-6.5-rc7
drwxr-xr-x 10 root root   4096 Aug 30 19:18 kernel
-rw-r--r--  1 root root 279883 Aug 30 19:18 modules.alias
-rw-r--r--  1 root root 286463 Aug 30 19:18 modules.alias.bin
-rw-r--r--  1 root root   6225 Aug 30 19:18 modules.builtin
-rw-r--r--  1 root root   6102 Aug 30 19:18 modules.builtin.alias.bin
-rw-r--r--  1 root root   8719 Aug 30 19:18 modules.builtin.bin
-rw-r--r--  1 root root  56755 Aug 30 19:18 modules.builtin.modinfo
-rw-r--r--  1 root root  46923 Aug 30 19:18 modules.dep
-rw-r--r--  1 root root  72251 Aug 30 19:18 modules.dep.bin
-rw-r--r--  1 root root    314 Aug 30 19:18 modules.devname
-rw-r--r--  1 root root  21496 Aug 30 19:18 modules.order
-rw-r--r--  1 root root    592 Aug 30 19:18 modules.softdep
-rw-r--r--  1 root root 234961 Aug 30 19:18 modules.symbols
-rw-r--r--  1 root root 270826 Aug 30 19:18 modules.symbols.bin
lrwxrwxrwx  1 root root     22 Aug 30 19:18 source -> /usr/src/linux-6.5-rc7
beast /usr/src/linux #

Reproducible: Always

Steps to Reproduce:
1. install kernel (make install)
2. eclean-kernel
3.
Actual Results:  
removes new kernel

Expected Results:  
dont remove new kernel
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-08-31 02:29:19 UTC
ccing andrew in case it's caused by recent changes
Comment 2 Andrew Ammerlaan gentoo-dev 2023-08-31 04:56:35 UTC
(In reply to Sam James from comment #1)
> ccing andrew in case it's caused by recent changes

This was always the behaviour of eclean-kernel with systemd-boot.

I think the problem is that there is no good way for eclean-kernel to know which entry is the default systemd-boot entry. If it is not configured otherwise, the default entry is implicitly the newest.
Comment 3 Nick Owens 2023-08-31 05:32:11 UTC
does this not work?

beast /usr/src/linux # bootctl list --json=pretty | jq '.[] | select( .isDefault == true )'
{
  "id": "8e9dce24dde354032c8d155363fd7c13-6.5.0-rc7.conf",
  "path": "/boot/loader/entries/8e9dce24dde354032c8d155363fd7c13-6.5.0-rc7.conf",
  "root": "/boot",
  "title": "Gentoo Linux",
  "showTitle": "Gentoo Linux (6.5.0-rc7)",
  "sortKey": "gentoo",
  "version": "6.5.0-rc7",
  "machineId": "8e9dce24dde354032c8d155363fd7c13",
  "options": "root=UUID=11606a5d-b169-4d10-9520-039789a65607 rw systemd.machine_id=8e9dce24dde354032c8d155363fd7c13",
  "linux": "/8e9dce24dde354032c8d155363fd7c13/6.5.0-rc7/linux",
  "initrd": [
    "/8e9dce24dde354032c8d155363fd7c13/6.5.0-rc7/initrd"
  ],
  "isDefault": true,
  "isSelected": false
}
Comment 4 Andrew Ammerlaan gentoo-dev 2023-08-31 06:58:16 UTC
(In reply to Nick Owens from comment #3)
> does this not work?

Probably,

As a temporary workaround you can call eclean-kernel with the "--num 1" argument which should leave the latest kernel.