update grub bootloader environment not working

227 views
Skip to first unread message

esad ergül

unread,
Apr 26, 2022, 4:22:54 AM4/26/22
to swupdate
Hi all,

I build an efi based image with Elbe tool and use dual copy(A/B) approach to always have a running system on the device. The hard disk image (Buster) has 3 partitions (efi,root1,config). The other 2 partitions(root2,data) are created during the first init procedure. As updater client I want to use the SWUpdate (from the official Debian repository). For updating I created swu image file as described in the documentation (https://sbabic.github.io/swupdate/sw-description.html#software-collections-and-operation-modes). When I update the device, SWupdate says that the installation is successful and does not give an error message. But switching between root partitions does not happen because SWupdate somehow did not create the environment variables on the grub environment block. That's why the grub bootloader can't read a variable from the environment block and change the default menu entry in the grub configuration file. What I noticed is that the file structure of the Efi partition is different from standard Debian.  The Efi partition that the Elbe created has only BOOTX64.EFI (boot/efi/EFI/BOOT/BOOTX64.efi) file.
Standard Debian has here grubx64.efi and grub.cfg file which contains the partition UUID where the actual grub.cfg file with the menu entries is located.

My questions are;
1)Why SWupdate does not write the variables on the grub environment block ?
2)Is it possible that the path of the environment block file (/boot/grub/grubenv) is wrong ? If so, where should the grub directory be installed ?

--> I created the environment block file under efi partition with the following command and did updates again. But this did not help.
grub-editenv /boot/efi/EFI/BOOT/grubenv create

Can anyone please let me know how should I resolve it?

Best regards,
Esad Ergül


sw-description

software = {
    version = "0.1.0";
    hardware-compatibility = ["Test","1.0"];

    rootfs: {
        copy1: {
            images: (
                {
                    filename = "root.img.gz.enc";
                    device = "/dev/sda2";
                    compressed = "zlib";
                    encrypted = true;
                    ivt = "";
                    installed-directly = true;
                    type = "raw";
                    sha256 = "1213213123***";
                }
            );
            bootenv: (
                {
                    name = "boot_entry";
                    value = "0";
                }
            );
            scripts: (
                {
                    filename = "update.sh";
                    type = "shellscript";
                    sha256 = "1213213123***";
                }
            );
        };
        copy2: {
            images: (
                {
                    filename = "root.img.gz.enc";
                    device = "/dev/sda4";
                    compressed = "zlib";
                    encrypted = true;
                    ivt = "";
                    installed-directly = true;
                    type = "raw";
                    sha256 = "1213213123***";
                }
            );
            bootenv: (
                {
                    name = "boot_entry";
                    value = "1";
                }
            );
            scripts: (
                {
                    filename = "update.sh";
                    type = "shellscript";
                    sha256 = "1213213123***";
                }
            );
        };
    };
};



Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [network_thread] : Incoming network request: processing...
Apr 25 16:25:26 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [swupdate_verify_file] : Verified OK
Apr 25 16:25:26 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [get_common_fields] : Version 0.1.0
Apr 25 16:25:26 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [parse_hw_compatibility] : Accepted Hw Revision : Touch-it-XELO
Apr 25 16:25:26 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [parse_hw_compatibility] : Accepted Hw Revision : 1.0
Apr 25 16:25:26 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [_parse_images] : Found compressed Image: root.img.gz.enc in device : /dev/sda4 for handler raw (installed from stream)
Apr 25 16:25:26 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [_parse_scripts] : Found Script: update.sh
Apr 25 16:25:26 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [_parse_bootloader] : Bootloader var: boot_entry = 1
Apr 25 16:25:26 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [check_hw_compatibility] : Hardware Touch-it-XELO Revision: 1.0
Apr 25 16:25:26 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [check_hw_compatibility] : Hardware compatibility verified
Apr 25 16:25:26 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [extract_files] : Found file
Apr 25 16:25:26 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [extract_files] :         filename root.img.gz.enc
Apr 25 16:25:26 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [extract_files] :         size 1354798528 required
Apr 25 16:25:26 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [extract_files] : Installing STREAM root.img.gz.enc, 1354798528 bytes
Apr 25 16:25:26 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [install_single_image] : Found installer for stream root.img.gz.enc raw
Apr 25 16:25:26 PanelComputer swupdate[860]: START Software Update started !
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [network_initializer] : Software update started
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [extract_file_to_tmp] : Found file
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [extract_file_to_tmp] :         filename sw-description
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [extract_file_to_tmp] :         size 1946
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [extract_file_to_tmp] : Found file
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [extract_file_to_tmp] :         filename sw-description.sig
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [extract_file_to_tmp] :         size 2088
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [swupdate_verify_file] : Verified OK
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [get_common_fields] : Version 0.1.0
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [parse_hw_compatibility] : Accepted Hw Revision : Touch-it-XELO
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [parse_hw_compatibility] : Accepted Hw Revision : 1.0
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [_parse_images] : Found compressed Image: root.img.gz.enc in device : /dev/sda4 for handler raw (installed from stream)
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [_parse_scripts] : Found Script: update.sh
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [_parse_bootloader] : Bootloader var: boot_entry = 1
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [check_hw_compatibility] : Hardware Touch-it-XELO Revision: 1.0
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [check_hw_compatibility] : Hardware compatibility verified
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [extract_files] : Found file
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [extract_files] :         filename root.img.gz.enc
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [extract_files] :         size 1354798528 required
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [extract_files] : Installing STREAM root.img.gz.enc, 1354798528 bytes
Apr 25 16:25:26 PanelComputer swupdate[860]: RUN [install_single_image] : Found installer for stream root.img.gz.enc raw
Apr 25 16:27:59 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [extract_files] : END INSTALLING STREAMING
Apr 25 16:27:59 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [extract_files] : Found file
Apr 25 16:27:59 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [extract_files] :         filename update.sh
Apr 25 16:27:59 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [extract_files] :         size 1902 required
Apr 25 16:27:59 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [extract_padding] : Expecting 20 padding bytes at end-of-file
Apr 25 16:27:59 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [network_initializer] : Valid image found: copying to FLASH
Apr 25 16:27:59 PanelComputer swupdate.sh[860]: [INFO ] : SWUPDATE running :  Installation in progress
Apr 25 16:27:59 PanelComputer swupdate[860]: RUN [extract_files] : END INSTALLING STREAMING
Apr 25 16:27:59 PanelComputer swupdate[860]: RUN [extract_files] : Found file
Apr 25 16:27:59 PanelComputer swupdate[860]: RUN [extract_files] :         filename update.sh
Apr 25 16:27:59 PanelComputer swupdate[860]: RUN [extract_files] :         size 1902 required
Apr 25 16:27:59 PanelComputer swupdate[860]: RUN [extract_padding] : Expecting 20 padding bytes at end-of-file
Apr 25 16:27:59 PanelComputer swupdate[860]: RUN [network_initializer] : Valid image found: copying to FLASH
Apr 25 16:27:59 PanelComputer swupdate[860]: RUN Installation in progress
Apr 25 16:27:59 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [read_lines_notify] : call do_preinst
Apr 25 16:27:59 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [read_lines_notify] : do_preinst
Apr 25 16:27:59 PanelComputer swupdate[860]: RUN [read_lines_notify] : call do_preinst
Apr 25 16:27:59 PanelComputer swupdate[860]: RUN [read_lines_notify] : do_preinst
Apr 25 16:27:59 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [run_system_cmd] : /tmp/scripts/update.sh preinst  command returned 0
Apr 25 16:27:59 PanelComputer swupdate[860]: RUN [run_system_cmd] : /tmp/scripts/update.sh preinst  command returned 0
Apr 25 16:27:59 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [read_lines_notify] : call do_postinst
Apr 25 16:27:59 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [read_lines_notify] : do_postinst
Apr 25 16:27:59 PanelComputer swupdate[860]: RUN [read_lines_notify] : call do_postinst
Apr 25 16:27:59 PanelComputer swupdate[860]: RUN [read_lines_notify] : do_postinst
Apr 25 16:28:00 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [run_system_cmd] : /tmp/scripts/update.sh postinst  command returned 0
Apr 25 16:28:00 PanelComputer swupdate[860]: RUN [run_system_cmd] : /tmp/scripts/update.sh postinst  command returned 0
Apr 25 16:28:00 PanelComputer swupdate.sh[860]: [INFO ] : SWUPDATE successful ! SWUPDATE successful !
Apr 25 16:28:00 PanelComputer swupdate.sh[860]: [TRACE] : SWUPDATE running :  [network_initializer] : Main thread sleep again !
Apr 25 16:28:00 PanelComputer swupdate.sh[860]: [INFO ] : No SWUPDATE running :  Waiting for requests...
Apr 25 16:28:00 PanelComputer swupdate[860]: SUCCESS SWUPDATE successful !
Apr 25 16:28:00 PanelComputer swupdate[860]: RUN [network_initializer] : Main thread sleep again !
Apr 25 16:28:00 PanelComputer swupdate[860]: IDLE Waiting for requests...

Stefano Babic

unread,
Apr 26, 2022, 4:51:43 AM4/26/22
to esad ergül, swupdate
Hi Esad,

On 26.04.22 10:22, esad ergül wrote:
> Hi all,
>
> I build an efi based image with Elbe tool and use dual copy(A/B)
> approach to always have a running system on the device. The hard disk
> image (Buster) has 3 partitions (efi,root1,config). The other 2
> partitions(root2,data) are created during the first init procedure. As
> updater client I want to use the SWUpdate (from the official Debian
> repository). For updating I created swu image file as described in the
> documentation
> (https://sbabic.github.io/swupdate/sw-description.html#software-collections-and-operation-modes).
> When I update the device, SWupdate says that the installation is
> successful and does not give an error message. But switching between
> root partitions does not happen because SWupdate somehow did not create
> the environment variables on the grub environment block. That's why the
> grub bootloader can't read a variable from the environment block and
> change the default menu entry in the grub configuration file. What I
> noticed is that the file structure of the Efi partition is different
> from standard Debian.  The Efi partition that the Elbe created has only
> BOOTX64.EFI (boot/efi/EFI/BOOT/BOOTX64.efi) file.

BOOTX64.efi is the UEFI bootloader - it is ok. Anyway, you need to add
your *own* grub.cfg, else grub does not know what to do.

You should see :

√ ~ # ls /boot/EFI/BOOT
bootx64.efi grub.cfg grubenv

Not required to create grubenv - if not provided, SWUpdate will raises a
warning, but then it will create the file.

If you do not see it, there is something wrong in your configuration or
ELBE setup. Please note that SWUpdate has a configuration file and this
activateswhich bootloader is selected. If the Debian package has not
activated GRUB support, of course it cannot work.

> Standard Debian has here grubx64.efi and grub.cfg file which contains
> the partition UUID where the actual grub.cfg file with the menu entries
> is located.
>
> My questions are;
> 1)Why SWupdate does not write the variables on the grub environment block ?

You have something wrong in SWUpdate configuration or Elbe setup.

> 2)Is it possible that the path of the environment block file
> (/boot/grub/grubenv) is wrong ?

/boot/efi/EFI/BOOT/grub/grubenv is the default path, and you can change
it by reconfiguring SWUpdate.
> --
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+u...@googlegroups.com
> <mailto:swupdate+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/swupdate/7488d166-48ae-45fc-982d-ac1e3ac69fffn%40googlegroups.com
> <https://groups.google.com/d/msgid/swupdate/7488d166-48ae-45fc-982d-ac1e3ac69fffn%40googlegroups.com?utm_medium=email&utm_source=footer>.

Best regards,
Stefano Babic

--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=====================================================================
Reply all
Reply to author
Forward
0 new messages