Bug 1741340 - Boot menu entries are identical if /boot/$MACHINE_ID exists
Summary: Boot menu entries are identical if /boot/$MACHINE_ID exists
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: grub2
Version: 32
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Javier Martinez Canillas
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-08-14 20:06 UTC by Göran Uddeborg
Modified: 2021-05-25 15:03 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-25 15:03:28 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Göran Uddeborg 2019-08-14 20:06:44 UTC
Description of problem:
If the directory /boot/$MACINE_ID exists, /usr/lib/kernel/install.d/90-loaderentry.install will overwrite the BLS entry previously written by /usr/lib/kernel/install.d/20-grub.install.  These variants of the boot loader configuration differs in several ways.  In particular, the "title" entry from 20-grub contains the kernel version too, while the one from 90-loaderentry only contains the OS name (PRETTY_NAME from /etc/os-release).

The effect of this is that the grub boot menu have three identical lines, corresponding to the three kernels (typically) installed.

It might possibly also trigger bug 1731557. 


Version-Release number of selected component (if applicable):
systemd-udev-241-10.git511646b.fc30.x86_64


How reproducible:
Every time.


Steps to Reproduce:
1. mkdir /boot/$(cat /etc/machine-id)
2. dnf reinstall kernel-core
3. systemctl reboot
4. # Display the boot menu when restarting, if normally hidden


Actual results:
An entry that only says "Fedora 30 (Thirty)".


Expected results:
All three entries should include the corresponding kernel version.


Additional info:
See https://ask.fedoraproject.org/t/should-the-grub-menu-entries-look-all-alike/2866 for the discussion that led to this bugzilla.

The presence or absence of  the /boot/$MACHINE_ID directory seems to depend on the upgrade history of the machine.

The directory where the kernel and initrd images WOULD be stored IF the machine id directory exists, is passed to all scripts in /usr/lib/kernel/install.d.  this is done REGARDLESS if it actually exists or not.  That does look strange, and might be an indication this problem is caused by conflicting changes historically.  The overall design is not clear to me, and neither is what component is to blame.  I'm assigning to the owner of 90-loaderentry initially (systemd-udev), but will follow with interest any further discussion and/or reassignments!

Comment 1 Zbigniew Jędrzejewski-Szmek 2019-11-22 12:54:56 UTC
The original design of the BLS was that those are simple files with key=value pairs, and the
entire logic is in the consumers of those files. When sd-boot displays entries, it will
see that there are two entries with the same name, and suffix them with the kernel version.
And if there are two entries with the same name and the same kernel version, it'll
add suffixes until the entries can be distinguished. Thus, it is totally OK to have boot loader
entries with the same title. Trying to stuff everything and the kitchen sink into the title
to avoid ambiguity is not a solution.

(For example, on my machine I get the following:
$ bootctl list|grep title
        title: Fedora 31 (Workstation Edition) (5.3.7-301.fc31.x86_64)
        title: Fedora 31 (Workstation Edition) (5.3.8-300.fc31.x86_64)
        title: Fedora 31 (Workstation Edition) (5.3.9-300.fc31.x86_64) (default)
        title: Fedora 30 (Workstation Edition)
$ grep title /boot/efi/loader/entries/*conf
/boot/efi/loader/entries/08a5690a2eed47cf92ac0a5d2e3cf6b0-5.3.7-301.fc31.x86_64.conf:title      Fedora 31 (Workstation Edition)
/boot/efi/loader/entries/08a5690a2eed47cf92ac0a5d2e3cf6b0-5.3.8-300.fc31.x86_64.conf:title      Fedora 31 (Workstation Edition)
/boot/efi/loader/entries/08a5690a2eed47cf92ac0a5d2e3cf6b0-5.3.9-300.fc31.x86_64.conf:title      Fedora 31 (Workstation Edition)

As you can see, I have just one entry for the previous Fedora release, so no
suffix is necessary, but I have three entries for F31, so they get suffixed
with the kernel version automatically.)

I'll reassign this to grub, it needs to handle this better.

Comment 2 Ben Cotton 2020-04-30 20:13:36 UTC
This message is a reminder that Fedora 30 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 30 on 2020-05-26.
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 '30'.

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 30 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 3 Göran Uddeborg 2020-05-01 09:51:33 UTC
Seems to be the same way in Fedora 32.

Comment 4 Roberto Ragusa 2020-06-27 10:11:20 UTC
Confirmed on Fedora 32.
Very annoying.

Comment 5 Roberto Ragusa 2020-06-27 12:06:02 UTC
Since grub2 is bugged and I do not want to change the system file
/usr/lib/kernel/install.d/90-loaderentry.install,
I've added my workaround.

# cat >/etc/kernel/install.d/99-RR-fix-bls-titles.install <<"EOF"
#!/bin/bash

# workaround for grub2 not appending "version" to identical "title"s
# https://bugzilla.redhat.com/show_bug.cgi?id=1741340

for file in /boot/loader/entries/*conf; do
  ver="$(grep ^version "$file"|awk '{print $2}')"
  if grep -q -P '^title .*'"$ver" $file ; then
    echo 2>&1 "OK     $file"
  else
    sed -i -e 's/^\(title.*\)/\1 '"$ver"'/g' $file
    echo 2>&1 "FIXING $file"
  fi
done
EOF

Comment 6 Fedora Program Management 2021-04-29 15:56:43 UTC
This message is a reminder that Fedora 32 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 32 on 2021-05-25.
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 '32'.

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 32 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 7 Fedora Admin user for bugzilla script actions 2021-05-07 00:35:35 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.

Comment 8 Ben Cotton 2021-05-25 15:03:28 UTC
Fedora 32 changed to end-of-life (EOL) status on 2021-05-25. Fedora 32 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.


Note You need to log in before you can comment on or make changes to this bug.