Unable to restart device after update from web page or REST API

266 views
Skip to first unread message

Maxwell Pung

unread,
Aug 27, 2024, 11:38:11 AM8/27/24
to swupdate
Hello,

I am using SWUpdate 2024.05 commit 3a333f4b4b1cec5e3cb1f2e3da41ad82735d0242. I am finding that after a doing an update (performed via web page or rest API), I am unable to restart the device.

When I click the Restart System button in the top right corner of the web page, a modal dialog box will pop up for a short while (10 seconds maybe) saying "The system will restart. Please be patient, as restarting takes about one minute." Then the dialog box disappears and the system does not restart.

When I issue a restart command via the REST API with command curl -X POST --data "" http://foobar:8080/restart I get the response Device will reboot now. But the system does not restart.

Any time I issue one of these commands or attempt to restart via web page the swupdate service prints a new line to it's log:

Aug 27 15:24:47 <machine> swupdate.sh[361]: [DEBUG] : SWUPDATE running :  [postupdate] : Running Post-update command

In the docs there is a snippet about the restart REST API endpoint:

"If configured (see post update command), this request will restart the device."

I take this to mean you need CONFIG_SCRIPTS=y, which I do have. My interpretation of this could very well be wrong. I will share my runtime cfg file as well in case the issue is there:

globals :
{
verbose = true;
loglevel = 5;
syslog = true;
public-key-file = "/etc/public-key-for-signed-updates.pem";
};

webserver :
{
document_root = "/www";
userid        = 0;
groupid       = 0;
};


What am I missing or not understanding?

~ Maxwell

Fabio Estevam

unread,
Aug 27, 2024, 12:55:19 PM8/27/24
to Maxwell Pung, swupdate
Hi Maxwell,

On Tue, Aug 27, 2024 at 12:38 PM Maxwell Pung <max....@lema.io> wrote:
>
> Hello,
>
> I am using SWUpdate 2024.05 commit 3a333f4b4b1cec5e3cb1f2e3da41ad82735d0242. I am finding that after a doing an update (performed via web page or rest API), I am unable to restart the device.

Does it help if you pass "-p /sbin/reboot" to SWUPDATE_ARGS?

Maxwell Pung

unread,
Aug 27, 2024, 1:24:41 PM8/27/24
to swupdate
If I extend my swupdate.cfg with postupdatecmd = "/usr/sbin/reboot"; in the globals sections then it will reboot automatically after an update is performed. Regardless of whether that update is performed via cli, REST API or web page.

This behavior does not fit my use case. It would be preferable to not reboot automatically after the update is finished but independently, at a later time, using something like curl -X POST --data "" http://foobar:8080/restart or the Restart System button on the web page.

~ Maxwell

Maxwell Pung

unread,
Aug 31, 2024, 11:10:51 AM8/31/24
to swupdate
I am able to get desired behavior by adding postupdatecmd = "/usr/sbin/reboot"; to the globals section of swupdate.cfg and adding run-postupdate = false; to the webserver section. Restarting system via REST API and web page work with this configuration.

~ Maxwell

Stefano Babic

unread,
Aug 31, 2024, 12:08:24 PM8/31/24
to Maxwell Pung, swupdate
Hi Maxwell,

On 31.08.24 17:10, Maxwell Pung wrote:
> I am able to get desired behavior**by adding *postupdatecmd =
> "/usr/sbin/reboot";* to the *globals* section of swupdate.cfg and adding
> *run-postupdate = false;* to the *webserver* section. Restarting system
> via REST API and web page work with this configuration.

Right, this is the correct configuration for your use case.

Best regards,
Stefano

>
> ~ Maxwell
>
> On Tuesday, August 27, 2024 at 12:24:41 PM UTC-5 Maxwell Pung wrote:
>
> If I extend my swupdate.cfg with *postupdatecmd =
> "/usr/sbin/reboot";* in the *globals *sections then it will reboot
> automatically after an update is performed. Regardless of whether
> that update is performed via cli, REST API or web page.
>
> This behavior does not fit my use case. It would be preferable to
> not reboot automatically after the update is finished but
> independently, at a later time, using something like *curl -X POST
> --data "" http://foobar:8080/restart <http://foobar:8080/restart>*
> or the *Restart System* button on the web page.
>
> ~ Maxwell
>
> On Tuesday, August 27, 2024 at 11:55:19 AM UTC-5 Fabio Estevam wrote:
>
> Hi Maxwell,
>
> On Tue, Aug 27, 2024 at 12:38 PM Maxwell Pung <max....@lema.io>
> wrote:
> >
> > Hello,
> >
> > I am using SWUpdate 2024.05 commit
> 3a333f4b4b1cec5e3cb1f2e3da41ad82735d0242. I am finding that
> after a doing an update (performed via web page or rest API), I
> am unable to restart the device.
>
> Does it help if you pass "-p /sbin/reboot" to SWUPDATE_ARGS?
>
> --
> 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/00e3705c-864b-4837-8739-bb4219c872a7n%40googlegroups.com <https://groups.google.com/d/msgid/swupdate/00e3705c-864b-4837-8739-bb4219c872a7n%40googlegroups.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages