diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-05-19 22:22:44 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-05-20 15:34:17 +0200 |
commit | 1b43f868934e971480249a6e0fa2f45da906ea2e (patch) | |
tree | 616f1b59d284a9251c6a87dd9190e988b379ddc8 /src/kernel-install | |
parent | kernel-install: fix detection of entry-token if $BOOT_ROOT is configured (diff) | |
download | systemd-1b43f868934e971480249a6e0fa2f45da906ea2e.tar.xz systemd-1b43f868934e971480249a6e0fa2f45da906ea2e.zip |
kernel-install: restore priority of check for /boot/loader/entries
Before 9e82a74cb0f08a288f9db228a0b5bec8a7188cdb, we had a check like the
following:
if [[ -d /efi/loader/entries ]] || [[ -d /efi/$MACHINE_ID ]]; then
ENTRY_DIR_ABS="/efi/$MACHINE_ID/$KERNEL_VERSION"
elif [[ -d /boot/loader/entries ]] || [[ -d /boot/$MACHINE_ID ]]; then
ENTRY_DIR_ABS="/boot/$MACHINE_ID/$KERNEL_VERSION"
elif [[ -d /boot/efi/loader/entries ]] || [[ -d /boot/efi/$MACHINE_ID ]]; then
ENTRY_DIR_ABS="/boot/efi/$MACHINE_ID/$KERNEL_VERSION"
…
In stock Fedora 34-, /efi isn't used, but grub creates /boot/loader/entries and
installs kernels and initrds directly in /boot. Thus the second arm of the
check wins, and we end up with BOOT_ROOT=/boot.
After 9e82a74cb0f08a288f9db228a0b5bec8a7188cdb, we iterate over the inner
directory first and over the second directory later:
[ -d /efi/<machine-id> ]
[ -d /boot/efi/<machine-id> ]
[ -d /boot/<machine-id> ]
[ -d /efi/Default ]
[ -d /boot/efi/Default ]
[ -d /boot/Default ]
[ -d /efi/loader/entries ]
[ -d /boot/efi/loader/entries ]
[ -d /boot/loader/entries ]
This was partially reverted by 447a822f8ee47b63a4cae00423c4d407bfa5e516 which
removed Default from the list, and a5307e173bf86d695fe85b8e15e91126e8618a14,
which moved checks for /boot up, so we ended up with:
[ -d /efi/<machine-id> ]
[ -d /boot/<machine-id> ]
[ -d /boot/efi/<machine-id> ]
[ -d /efi/loader/entries ]
[ -d /boot/loader/entries ]
[ -d /boot/efi/loader/entries ]
6637cf9db67237857279262d93ee0e39023c5b85 added autodetection of an entry
token, so we end up checking the following suffixes:
<machine-id>, $IMAGE_ID, $ID, Default
But the important unchanged characteristic is that we iterate over the suffix
first. Sadly this breaks Fedora, because we find /boot/efi/<machine-id> before
we could find /boot/loader/entries. It seems that every possible aspect of
behaviour matters for somebody, so we need to keep the original order of
detection.
With the patch:
[ -d /efi/<machine-id> ]
...
[ -d /efi/loader/entries ]
[ -d /boot/<machine-id> ]
...
[ -d /boot/loader/entries ]
[ -d /boot/efi/<machine-id> ]
...
[ -d /boot/efi/loader/entries ]
Note that we need to check for "loader/entries" too, even though it is not
an entry-token candidate, so that we get the same detection priority as
before.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2071034.
Diffstat (limited to 'src/kernel-install')
-rwxr-xr-x | src/kernel-install/kernel-install.in | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/kernel-install/kernel-install.in b/src/kernel-install/kernel-install.in index 9fa12f6fe8..f43c6b8b42 100755 --- a/src/kernel-install/kernel-install.in +++ b/src/kernel-install/kernel-install.in @@ -177,8 +177,8 @@ else BOOT_ROOT_SEARCH="/efi /boot /boot/efi" fi -for suff in $ENTRY_TOKEN_SEARCH; do - for pref in $BOOT_ROOT_SEARCH; do +for pref in $BOOT_ROOT_SEARCH; do + for suff in $ENTRY_TOKEN_SEARCH; do if [ -d "$pref/$suff" ]; then [ -z "$BOOT_ROOT" ] && BOOT_ROOT="$pref" [ -z "$ENTRY_TOKEN" ] && ENTRY_TOKEN="$suff" @@ -189,19 +189,16 @@ for suff in $ENTRY_TOKEN_SEARCH; do else [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "$pref/$suff not found…" fi - done -done - -[ -z "$BOOT_ROOT" ] && for pref in "/efi" "/boot" "/boot/efi"; do - if [ -d "$pref/loader/entries" ]; then - BOOT_ROOT="$pref" - [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \ - echo "$pref/loader/entries exists, using BOOT_ROOT=$BOOT_ROOT" - break - else - [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "$pref/loader/entries not found…" - fi + if [ -d "$pref/loader/entries" ]; then + [ -z "$BOOT_ROOT" ] && BOOT_ROOT="$pref" + [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \ + echo "$pref/loader/entries exists, using BOOT_ROOT=$BOOT_ROOT" + break 2 + else + [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && echo "$pref/loader/entries not found…" + fi + done done [ -z "$BOOT_ROOT" ] && for pref in "/efi" "/boot/efi"; do |