[Libguestfs] [PATCH guestfs-tools] builder: templates: Enable Fedora image update again
Laszlo Ersek
lersek at redhat.com
Fri Apr 8 15:51:08 UTC 2022
On 04/08/22 17:43, Richard W.M. Jones wrote:
> On Fri, Apr 08, 2022 at 05:36:45PM +0200, Laszlo Ersek wrote:
>> On 04/08/22 16:59, Richard W.M. Jones wrote:
>>> Fixes: commit 3fe941767042bf83d9a252b0819fa6d5a48059d0
>>> ---
>>> builder/templates/make-template.ml | 6 ++++--
>>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/builder/templates/make-template.ml b/builder/templates/make-template.ml
>>> index fe3039aa06..51f72da969 100755
>>> --- a/builder/templates/make-template.ml
>>> +++ b/builder/templates/make-template.ml
>>> @@ -649,9 +649,11 @@ dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION
>>> bpf "%%post\n";
>>> bpf "\
>>> # Ensure the installation is up-to-date.
>>> -# This makes Fedora >= 33 unbootable, see:
>>> +dnf -y --best upgrade
>>> +# This required otherwise the kernel will not be bootable, see
>>> # https://bugzilla.redhat.com/show_bug.cgi?id=1911177
>>> -#dnf -y --best upgrade
>>> +# https://bugzilla.redhat.com/show_bug.cgi?id=1945835#c24
>>> +grub2-mkconfig -o /boot/grub2/grub.cfg
>>> ";
>>>
>>> let needs_regenerate_dracut = ref false in
>>>
>>
>> Still a fedora bug; after a kernel update, the grub config should be
>> refreshed automatically.
>>
>> Anyway, I guess my more important remark is: the grub.cfg location
>> depends on whether the system is UEFI-based or not. Normally,
>> grub2-mkconfig is invoked against "/etc/grub2.cfg" (on a BIOS system) or
>> "/etc/grub2-efi.cfg" (on a UEFI system). And those are symlinks:
>>
>> lrwxrwxrwx. 1 root root 31 2021-11-01 12:21:13 +0100 /etc/grub2-efi.cfg -> ../boot/efi/EFI/redhat/grub.cfg
>> lrwxrwxrwx. 1 root root 22 2021-11-01 12:21:07 +0100 /etc/grub2.cfg -> ../boot/grub2/grub.cfg
>>
>> The patch (effectively) assumes BIOS and resolves "/etc/grub2.cfg" to
>> "/boot/grub2/grub.cfg".
>>
>> So (I think) I would consult "needs_uefi" here, and direct the output to
>> "/etc/grub2-efi.cfg" vs. "/etc/grub2.cfg". I expect Fedora 33 is
>> available on aarch64 (which is UEFI only), and therefore this could make
>> an actual difference.
>
> I guess something like this (only compile tested):
>
> diff --git a/builder/templates/make-template.ml b/builder/templates/make-template.ml
> index 51f72da969..ef58708f2b 100755
> --- a/builder/templates/make-template.ml
> +++ b/builder/templates/make-template.ml
> @@ -646,6 +646,8 @@ dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION
>
> (match os with
> | Fedora _ ->
> + let uefi = needs_uefi os arch in
> +
> bpf "%%post\n";
> bpf "\
> # Ensure the installation is up-to-date.
> @@ -653,8 +655,8 @@ dnf -y --best upgrade
> # This required otherwise the kernel will not be bootable, see
> # https://bugzilla.redhat.com/show_bug.cgi?id=1911177
> # https://bugzilla.redhat.com/show_bug.cgi?id=1945835#c24
> -grub2-mkconfig -o /boot/grub2/grub.cfg
> -";
> +grub2-mkconfig -o %s
> +" (quote (if uefi then "/etc/grub2-efi.cfg" else "/etc/grub2.cfg"));
>
> let needs_regenerate_dracut = ref false in
> if arch = X86_64 then (
>
>
> Rich.
>
Yes, I think so!
Laszlo
More information about the Libguestfs
mailing list