Discussion:
Question about system-update.target
(too old to reply)
Richard Hughes
2015-04-27 08:52:06 UTC
Permalink
At the moment the only user of system-update.target is PackageKit,
which does package updates offline in the special system-update boot
target. The other project that has just started using this mode is
fwupd, which is using it to update BIOS-based firmware (not UEFI
capsules) offline.

I've installed a symlink to system-update.target.wants so that the
fwupd process gets run, but I'm a little worried about what happens
when there are two optional services being run, both with
OnFailure=reboot.target

What return code I supposed to return if we launch
fwupd-offline-update.service and there are no BIOS updates to apply?
It seems to me that we want the behaviour of "OnFailure" to be "if
none of the *-offline-update.service files returned success" rather
than what happens now in that we launch pk-offline-update with no
package updates which returns failure, which reboots the machine
before the fwupd offline update process even gets a chance to properly
start.

Ideas welcome, thanks.

Richard
AbH Belxjander Draconis Serechai
2015-04-27 09:49:43 UTC
Permalink
This seems to putthe requirement of an If(a||b||c)==Failure Then
reboot.target

Where a b and c are ALL required to complete before rebooting occurs.

I would thing to specifically handle each tool as a process,

Would a specific script or tool already be available?

Is it possible to one-shot async run given services using systemctl then
afterwards pull status and log the individual failure before restarting as
a desired behavior here?

Personally I would make a custom service as the update target and
specifically have it failover to reboot once ALL depends have been run as
one-shot fire-until-finished-with-exit strategy.

Hopefully I am understanding the issue with a possible execution strategy
for this specific case?

Is it even practical with current tools in some way?
Post by Richard Hughes
At the moment the only user of system-update.target is PackageKit,
which does package updates offline in the special system-update boot
target. The other project that has just started using this mode is
fwupd, which is using it to update BIOS-based firmware (not UEFI
capsules) offline.
I've installed a symlink to system-update.target.wants so that the
fwupd process gets run, but I'm a little worried about what happens
when there are two optional services being run, both with
OnFailure=reboot.target
What return code I supposed to return if we launch
fwupd-offline-update.service and there are no BIOS updates to apply?
It seems to me that we want the behaviour of "OnFailure" to be "if
none of the *-offline-update.service files returned success" rather
than what happens now in that we launch pk-offline-update with no
package updates which returns failure, which reboots the machine
before the fwupd offline update process even gets a chance to properly
start.
Ideas welcome, thanks.
Richard
_______________________________________________
systemd-devel mailing list
http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Lennart Poettering
2015-04-27 14:18:04 UTC
Permalink
Post by Richard Hughes
At the moment the only user of system-update.target is PackageKit,
which does package updates offline in the special system-update boot
target. The other project that has just started using this mode is
fwupd, which is using it to update BIOS-based firmware (not UEFI
capsules) offline.
I've installed a symlink to system-update.target.wants so that the
fwupd process gets run, but I'm a little worried about what happens
when there are two optional services being run, both with
OnFailure=reboot.target
Well, thinking about this, maybe OnFailure=reboot.target is missing
the point for these services. After all, the system should reboot
regardless if the update fails or not...

So maybe add a service systemd-update-post.service or so, that uses:

[Service]
Type=oneshot
ExecStart=/bin/systemctl reboot --no-block

Then make sure that all your update services are of Type=oneshot
themselves and use Before=system-update-post.service and
Wants=system-update-post.service?

This would mean that any updating service would pull this in, and
order itself before it. Sicne this new service is hence ordered efter
each updating service it will only run after all of them finished,
regardless if failed or succeeded.

Does this make sense to you?

If so, we could probably add system-update-post.service as a standard
service to systemd itself.

Lennart
--
Lennart Poettering, Red Hat
Richard Hughes
2015-04-27 14:47:46 UTC
Permalink
Post by Lennart Poettering
Well, thinking about this, maybe OnFailure=reboot.target is missing
the point for these services. After all, the system should reboot
regardless if the update fails or not...
Not quite; PackageKit supports an update-offline-and-then-shutdown
mode at the request of the GNOME designers. If we can configure that
using systemd I'd gladly rip out the code in PackageKit and move it
down to systemd.
Post by Lennart Poettering
This would mean that any updating service would pull this in, and
order itself before it. Sicne this new service is hence ordered efter
each updating service it will only run after all of them finished,
regardless if failed or succeeded.
Does this make sense to you?
Sure, it does, modulo the feature above.

Richard.
Lennart Poettering
2015-04-27 15:42:03 UTC
Permalink
Post by Richard Hughes
Post by Lennart Poettering
Well, thinking about this, maybe OnFailure=reboot.target is missing
the point for these services. After all, the system should reboot
regardless if the update fails or not...
Not quite; PackageKit supports an update-offline-and-then-shutdown
mode at the request of the GNOME designers. If we can configure that
using systemd I'd gladly rip out the code in PackageKit and move it
down to systemd.
Hmm, in that case I think this is best done as part of PackageKit really...

Something like this:

- ship a service packagekit-reboot.service that contains:

[Service]
ExecStart=/bin/systemctl reboot --no-block
Type=oneshot

- ship a service packagekit-poweroff.service that contains:

[Service]
ExecStart=/bin/systemctl poweroff --no-block
Type=oneshot

Then, order both your update services
"Before=packagegit-reboot.service packagekit-poweroff.service", so
that they run before those services are started.

Finally, from packagekit, enqueue pretty early on, before you start
installation either one or the other of the two services, depending on
packagkit's configuration. This is easily done by issuing the
StartUnit() bus call on the systemd service file passing either
"packagekit-reboot.service" or "packagekit-poweroff.service" as first
parameter, and "replace" as second.

That way you can keep the setting hwether to reboot or poweroff in
packagekit. And make sure to enqueu the jobs really early on, so that
they are enqueued whatever happens. the deps will make sure that they
aren't run before your two updat services actually finish running.

I hope that makes sense?

Lennart
--
Lennart Poettering, Red Hat
Richard Hughes
2015-04-27 15:51:57 UTC
Permalink
Post by Lennart Poettering
[Service]
ExecStart=/bin/systemctl reboot --no-block
Type=oneshot
If that file was shipped in systemd, fwupd could use the same method
without having to ship the extra duplicated files. e.g.
system-update-post-reboot.service
Post by Lennart Poettering
Then, order both your update services
"Before=packagegit-reboot.service packagekit-poweroff.service", so
that they run before those services are started.
Makes sense so far.
Post by Lennart Poettering
Finally, from packagekit, enqueue pretty early on, before you start
installation either one or the other of the two services, depending on
packagkit's configuration. This is easily done by issuing the
StartUnit() bus call on the systemd service file passing either
"packagekit-reboot.service" or "packagekit-poweroff.service" as first
parameter, and "replace" as second.
Clever stuff.
Post by Lennart Poettering
I hope that makes sense?
and remove OnFailure=reboot.target, right?

Richard.
Mantas Mikulėnas
2015-04-27 16:53:40 UTC
Permalink
Post by Richard Hughes
What return code I supposed to return if we launch
fwupd-offline-update.service and there are no BIOS updates to apply?
In this case, failure doesn't make much sense, if you describe the task as
"ensuring that the BIOS is up-to-date".
--
Mantas Mikulėnas <***@gmail.com>
Richard Hughes
2015-04-27 17:11:24 UTC
Permalink
Post by Mantas Mikulėnas
In this case, failure doesn't make much sense, if you describe the task as
"ensuring that the BIOS is up-to-date".
In this case, the task is "upload firmware blob foo.bin in /var/cache
to the flash chip"

Richard.

Continue reading on narkive:
Loading...