archive handler ??

37 views
Skip to first unread message

esad ergül

unread,
Nov 30, 2022, 9:10:51 AM11/30/22
to swupdate
Hi Stefano,

when I use the archive handler to update the system, I always have to remove the content of the target partiton before. Otherwise I always get the error "ERROR : archive_write_data_block(), Write failed for ...".  Is there a property in SWUpdate that cleans the target partition before the installtion.

My sw-descripotion looks like this:
...
       rootfs: {
            copy1: {
                files: ({
                    filename = "root.tar.gz.enc";
                    type = "archive";
                    device = "/dev/update";
                    filesystem = "ext2";
                    path = "update_root";
                    preserve-attributes = true;
                    installed-directly = true;
                    compressed = "zlib";
                    encrypted = true;
                    ivt = "";
                    sha256 = @root.tar.gz.enc;
                    properties: {
                        create-destination = "true";
                    }
                });
...

My other question is, if the installation fails with the archive handler, I see the environment variable recovery_status=in_progress on the environment block (grubenv), as if the installation would be interrupted (e.g. because of a power interruption). Is this the correct behavior ? In my opinion this variable should be removed if the installation is successful or not. If the variable is present on the environment, I think that the last update attempt was interrupted (e.g. because of a power interruption).

Best regards,
Esad Ergül

Stefano Babic

unread,
Nov 30, 2022, 9:49:48 AM11/30/22
to esad ergül, swupdate
Hi Esad,

On 30.11.22 15:10, esad ergül wrote:
> Hi Stefano,
>
> when I use the archive handler to update the system, I always have to
> remove the content of the target partiton before.


More or less, the archive handler is thought to install in an empty
path, not to overwrite an existing one. In that case, it is difficult to
manage files to remove.


> Otherwise I always get
> the error "ERROR : archive_write_data_block(), Write failed for ...".
>  Is there a property in SWUpdate that cleans the target partition
> before the installtion.

Not yet, but I see the use case. We could add an additional flag (near
create-destination) to remove old data before installing.
This is wanted to still track that an update ran, but it was not
completed with success. Anyway, recovery_status is used in case of
single-copy: we should *never* start again the software if an update was
started and not completed, independently if it was interrupted or
failed. The SW on the device is partial, maybe broken, with unknown
side-effect.

In case of A/B, the variable to be checked is "ustate" (default). It
will be set to ok, running and failed, according to the status. After a
SWUpdate run, "in progress" (ustate == 7) is replaced by STATE_INSTALLED
(ok, 1) or STATE_FAILED (failed, 3). This should be evaluated by
bootloader and / or your startup scripts.

> In my opinion this variable should be removed if the
> installation is successful or not.

Not really. If you have a single-copy strategy, until the variable is
not dropped, we haven't a working production software. This variable is
reset *only* after a successful update.

> If the variable is present on the
> environment, I think that the last update attempt was interrupted (e.g.
> because of a power interruption).

If you have A/B, you should ignore recovery_status and check for ustate.

Best regards,
Stefano Babic

>
> Best regards,
> Esad Ergül
>
> --
> 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/da00c38b-b981-4b9f-8a0a-b166ad10d0bcn%40googlegroups.com <https://groups.google.com/d/msgid/swupdate/da00c38b-b981-4b9f-8a0a-b166ad10d0bcn%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=====================================================================

esad ergül

unread,
Dec 15, 2022, 4:54:58 AM12/15/22
to swupdate
Hi Stefano,

Thank you for your reply. I have another question. I have a use case where the user should be informed in web interface when the last update status (ustate=3) is failed (e.g. popups, alerts..) 
I have created an init script that generates a json file with system informations. This json file is parsed when the web page is loaded and the system informations is displayed.
If the system information changes, the json file has to be generated again, of course. I think that is not a good way because the json is not generated dynamically.
Is it possible to read the bootloader environment variable "ustate" in frontend (swupdate.js)? Is there any functionality in swupdate that I can use in frontend to get the ustate value? 
Thanks in advance.

Best regards,
Esad Ergül

Stefano Babic

unread,
Dec 15, 2022, 7:52:38 AM12/15/22
to esad ergül, swupdate
Hi Esad,

On 15.12.22 04:54, esad ergül wrote:
> Hi Stefano,
>
> Thank you for your reply. I have another question.

Please then do not steal a thread, and start simply a new thread. Users
are searching into mail archive and they cannot find what they search if
answers will be hidden inside other threads - thanks !

> I have a use case
> where the user should be informed in web interface when the last update
> status (ustate=3) is failed (e.g. popups, alerts..)

Well, this is just an information that can be passed when the Webserver
is started.

> I have created an init script that generates a json file with system
> informations. This json file is parsed when the web page is loaded and
> the system informations is displayed.
> If the system information changes, the json file has to be generated
> again, of course.

If the information changes, means that a new update successfully ran.
The web-app receives all messages from SWUpdate, and it already displays
that the update is successful. No need to access to ustate again IMHO.

> I think that is not a good way because the json is not
> generated dynamically.
> Is it possible to read the bootloader environment variable "ustate" in
> frontend (swupdate.js)? Is there any functionality in swupdate that I
> can use in frontend to get the ustate value?

This is unrelated to SWUpdate - access bootloader environment is done
via the libraries or tool for that bootloader (libubootenv for U-Boot,
grubenv as in your case for Grub).

Nevertheless, the (u)state variable is stored internally in SWUpdate,
too, so such information could be exported adding the right binding (to
nodejs here). But it is not yet supported.

Best regards,
Stefano Babic
> https://groups.google.com/d/msgid/swupdate/da00c38b-b981-4b9f-8a0a-b166ad10d0bcn%40googlegroups.com <https://groups.google.com/d/msgid/swupdate/da00c38b-b981-4b9f-8a0a-b166ad10d0bcn%40googlegroups.com> <https://groups.google.com/d/msgid/swupdate/da00c38b-b981-4b9f-8a0a-b166ad10d0bcn%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/swupdate/da00c38b-b981-4b9f-8a0a-b166ad10d0bcn%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> --
> =====================================================================
> DENX Software Engineering GmbH, Managing Director: Erika Unter
> HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
> Phone: +49-8142-66989-53 <tel:+49%208142%206698953> Fax:
> +49-8142-66989-80 <tel:+49%208142%206698980> Email: sba...@denx.de
> =====================================================================
>
> --
> 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/79c5dfee-fed2-405e-87ee-404b3f04e5dfn%40googlegroups.com <https://groups.google.com/d/msgid/swupdate/79c5dfee-fed2-405e-87ee-404b3f04e5dfn%40googlegroups.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages