Do not add /boot twice for btrfs subvolumes

This commit is contained in:
Eduard Abdullin 2025-12-02 13:41:27 +00:00 committed by root
commit d1e492035b
4 changed files with 60 additions and 28 deletions

View File

@ -2,7 +2,7 @@
# set -x
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 || "$(uname -m)" == riscv64 ]]
then
COMMAND="$1"
KERNEL_VERSION="$2"

View File

@ -198,10 +198,14 @@ param_to_indexes() {
get_prefix() {
if [[ $bootloader = grub2 ]] && mountpoint -q /boot; then
echo "/boot"
prefix_kern="/boot"
else
echo ""
prefix_kern=""
fi
if [[ $(stat -f --format=%T /boot) = "btrfs" ]] && [[ $(stat --format=%i /boot) = "256" ]]; then
prefix_kern=""
fi
echo "$prefix_kern"
}
expand_var() {
@ -563,7 +567,7 @@ set_default_bls() {
echo "default=${default}" >> "${zipl_config}"
fi
fi
update_grubcfg
print_info "The default is ${bls_file[$index]} with index $index and kernel $(get_prefix)${bls_linux[$index]}"
}
@ -595,33 +599,29 @@ remove_var_prefix() {
update_grubcfg()
{
# Older ppc64le OPAL firmware (petitboot version < 1.8.0) don't have BLS support
# so grub2-mkconfig has to be run to generate a config with menuentry commands.
if [ "${arch}" = "ppc64le" ] && [ -d /sys/firmware/opal ]; then
# Turn on RUN_MKCONFIG on different archs/scenarios
if [[ "${arch}" = 's390' ]] || [[ "${arch}" = 's390x' ]]; then
# On s390/s390x systems, run mkconfig/zipl
RUN_MKCONFIG="true"
petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot"
if test -e ${petitboot_path}; then
read -r -d '' petitboot_version < ${petitboot_path}
petitboot_version="$(echo ${petitboot_version//v})"
if test -n ${petitboot_version}; then
major_version="$(echo ${petitboot_version} | cut -d . -f1)"
minor_version="$(echo ${petitboot_version} | cut -d . -f2)"
re='^[0-9]+$'
if [[ $major_version =~ $re ]] && [[ $minor_version =~ $re ]] &&
([[ ${major_version} -gt 1 ]] ||
[[ ${major_version} -eq 1 &&
${minor_version} -ge 8 ]]); then
RUN_MKCONFIG="false"
fi
fi
elif [[ "${arch}" = "ppc64le" ]] && [[ -d /sys/firmware/opal ]]; then
# Older ppc64le OPAL firmware don't have BLS support so grub2-mkconfig has to be run
# to generate a config with menuentry commands.
RUN_MKCONFIG="true"
elif [[ -e /sys/hypervisor/type ]] && grep -q "^xen$" /sys/hypervisor/type; then
if [ ! -e /sys/hypervisor/guest_type ] || ! grep -q "^HVM$" /sys/hypervisor/guest_type; then
# PV and PVH Xen DomU guests boot with pygrub that doesn't have BLS support,
# also Xen Dom0 use the menuentries from 20_linux_xen and not the ones from
# 10_linux. So grub2-mkconfig has to run for both Xen Dom0 and DomU.
RUN_MKCONFIG=true
fi
fi
if [[ $RUN_MKCONFIG = "true" ]]; then
grub2-mkconfig --no-grubenv-update -o "${grub_config}" >& /dev/null
if [[ $bootloader = "zipl" ]]; then
zipl
else
grub2-mkconfig --no-grubenv-update -o "${grub_config}" &> /dev/null
fi
fi
}

View File

@ -3,7 +3,7 @@
Name: grubby
Version: 8.40
Release: 76%{?dist}
Release: 83%{?dist}.alma.1
Summary: Command line tool for updating bootloader configs
License: GPL-2.0-or-later
Source1: grubby-bls
@ -21,7 +21,7 @@ BuildRequires: pkgconfig
BuildRequires: popt-devel
BuildRequires: rpm-devel
BuildRequires: sed
%ifarch aarch64 x86_64 %{power64}
%ifarch aarch64 x86_64 %{power64} riscv64
BuildRequires: grub2-tools-minimal
Requires: grub2-tools-minimal
Requires: grub2-tools
@ -74,6 +74,38 @@ fi
%{_mandir}/man8/grubby.8*
%changelog
* Tue Dec 02 2025 Eduard Abdullin <eabdullin@almalinux.org> - 8.40-83.alma.1
- Do not add /boot twice for btrfs subvolumes
* Wed Jul 30 2025 Leo Sandoval <lsandova@redhat.com> - 8.40-83
- Update cfg when setting a default kernel
Resolves:#RHEL-101784
* Wed Apr 16 2025 Andrea Bolognani <abologna@redhat.com> - 8.40-82
- Fix riscv64 build
Resolves: RHEL-85989
* Thu Mar 20 2025 Leo Sandoval <lsandova@redhat.com> - 8.40-81
- grubby-bls: in s390* systems, run zipl on grub cfg update event
Fixes previous commit and formats better the conditions that trigger grub cfg updates
Resolves: #RHEL-36092
* Fri Dec 06 2024 Leo Sandoval <lsandova@redhat.com> - 8.40-80
- grubby-bls: on PPC systems, remove petiboot's version checks
Resolves: #RHEL-70194
* Fri Dec 06 2024 Leo Sandoval <lsandova@redhat.com> - 8.40-79
- grubby-bls: in s390* systems, run zipl on grub cfg update event
Resolves: #RHEL-36092
* Thu Dec 05 2024 Leo Sandoval <lsandova@redhat.com> - 8.40-78
- On grub cfg updates, run grub2-mkconfig for Xen systems
Resolves: #RHEL-70200
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 8.40-77
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 8.40-76
- Bump release for June 2024 mass rebuild

View File