Bug 1576093

Summary: After removing kernel with dnf the grub.cfg keeps the deleted kernel-entry
Product: [Fedora] Fedora Reporter: Stefan Gies <stefan998>
Component: grubbyAssignee: Peter Jones <pjones>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 28CC: dmach, packaging-team-maint, pjones, pmatilai, reavertm, rpm-software-management, vmukhame
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-28 22:39:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Stefan Gies 2018-05-08 19:33:19 UTC
Description of problem:
After deleting a kernel with dnf the kernel entry stays in the grub.cfg

Version-Release number of selected component (if applicable):


How reproducible:

Steps to Reproduce:
1.delete an old kernel with dnf (eg. dnf remove kernel-core-4.16.5 kernel-modules-4.16.5 kernel-4.16.5 kernel-modules-extra-4.16.5 -y
(optional make a reboot)

2. Then look into the /boot/grub2/grub.cfg
3. The entry of the deleted kernel is still there !!

Actual results:
The entry of the deleted kernel remains in the grub.cfg

Expected results:
The entry was deleted/removed.

Additional info:

Comment 1 Panu Matilainen 2018-05-09 04:45:58 UTC
dnf doesn't know anything about such matters, reassigning to grubby.

Comment 2 Maciej Mrozowski 2018-06-07 10:01:00 UTC
Some details:

in /etc/dnf/dnf.conf:
installonly_limit=2

in /vaar/log/dnf.log: dnf upgrade performed:
2018-06-07T09:16:39Z INFO 
Removed:
  kernel.x86_64 4.16.12-300.fc28                           kernel-core.x86_64 4.16.12-300.fc28                           kernel-modules.x86_64 4.16.12-300.fc28                           kernel-modules-extra.x86_64 4.16.12-300.fc28                          

Installed:
  kernel.x86_64 4.16.14-300.fc28                           kernel-core.x86_64 4.16.14-300.fc28                           kernel-modules.x86_64 4.16.14-300.fc28                           kernel-modules-extra.x86_64 4.16.14-300.fc28

After that operation, two latest kernels are installed, as expected:
[mrozowsk@cnu420dqzs ~]$ rpm -q kernel-core
kernel-core-4.16.13-300.fc28.x86_64
kernel-core-4.16.14-300.fc28.x86_64

But, as we see in /var/log/grubby: wrong kernel is being removed, kernel.x86_64 4.16.12-300.fc28 should have been then one being removed:

DBG: 3566: Thu Jun  7 11:15:43 2018: command line: --grub2 -c /boot/efi/EFI/fedora/grub.cfg --efi --add-kernel=/boot/vmlinuz-4.16.14-300.fc28.x86_64 --copy-default --title Fedora (4.16.14-300.fc28.x86_64) 28 (Twenty Eight) --args=root=LABEL=root  --remove-kernel=TITLE=Fedora (4.16.14-300.fc28.x86_64) 28 (Twenty Eight) --make-default
DBG: Image entry succeeded: 
DBG: menuentry 'Fedora (4.16.13-300.fc28.x86_64) 28 (Twenty Eight)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.16.13-300.fc28.x86_64-advanced-1e826ff2-8291-4679-ab35-75ae0c8338fc' { 
DBG:    load_video
DBG:    set gfxpayload=keep
DBG:    insmod gzio
DBG:    insmod part_gpt
DBG:    insmod btrfs
DBG:    set root='hd0,gpt2'
DBG:    if [ x$feature_platform_search_hint = xy ]; then
DBG:      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  1e826ff2-8291-4679-ab35-75ae0c8338fc
DBG:    else
DBG:      search --no-floppy --fs-uuid --set=root 1e826ff2-8291-4679-ab35-75ae0c8338fc
DBG:    fi
DBG:    linuxefi /boot/vmlinuz-4.16.13-300.fc28.x86_64 root=/dev/sda2 ro vconsole.font=ter-216b vconsole.keymap=pl2  rhgb net.ifnames=0
DBG:    initrdefi /boot/initramfs-4.16.13-300.fc28.x86_64.img
DBG: }

Why the heck grubby does that manually?
Why can't just grubby or whoever call grub2-mkconfig -o <path_to_grub.cfg>??
grub2-mkconfig already does the job _better_.

Comment 3 Ben Cotton 2019-05-02 19:16:44 UTC
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora 'version' of '28'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 28 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Ben Cotton 2019-05-02 20:47:33 UTC
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora 'version' of '28'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 28 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Ben Cotton 2019-05-28 22:39:55 UTC
Fedora 28 changed to end-of-life (EOL) status on 2019-05-28. Fedora 28 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.