public inbox for location@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH] systemd: Standartize on Wants=/After= for network
@ 2026-10-29 12:11 Valters Jansons
  2026-10-29 15:49 ` Michael Tremer
  0 siblings, 1 reply; 3+ messages in thread
From: Valters Jansons @ 2026-10-29 12:11 UTC (permalink / raw)
  To: location

Current Requires=network.target is very strict. Standard practice is to
set it as Wants= instead as a lighter "should". The application can
then see what is actually going on.

Furthermore, an After= should be in place so that Systemd properly stops
the updater prior to bringing the network stack offline.

Signed-off-by: Valters Jansons <valter.jansons@gmail.com>
---
 src/systemd/location-update.service.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/systemd/location-update.service.in b/src/systemd/location-update.service.in
index 50ba01f..b491a12 100644
--- a/src/systemd/location-update.service.in
+++ b/src/systemd/location-update.service.in
@@ -1,7 +1,8 @@
 [Unit]
 Description=Automatic Location Database Updater
 Documentation=man:location(1) https://man-pages.ipfire.org/libloc/location.html
-Requires=network.target
+Wants=network.target
+After=network-online.target
 
 [Service]
 Type=oneshot
-- 
2.56.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] systemd: Standartize on Wants=/After= for network
  2026-10-29 12:11 [PATCH] systemd: Standartize on Wants=/After= for network Valters Jansons
@ 2026-10-29 15:49 ` Michael Tremer
  2026-10-29 16:19   ` [PATCH v2] systemd: Depend on network using Wants=/After= Valters Jansons
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Tremer @ 2026-10-29 15:49 UTC (permalink / raw)
  To: Valters Jansons; +Cc: location, Stefan Schantl

Hi Valters,

Thanks for the patches. I applied the two Debian ones (psycopg3 and docbook-xml), but I have held back the systemd one.

It sets Wants=network.target together with After=network-online.target. That doesn't work as intended: After= only orders the unit relative to network-online.target if something else pulls it in, and nothing does. So the updater can still start before the network is up. Your commit message says the aim is for the updater to be stopped before the network goes down, which is a shutdown-ordering goal. That is already covered by ordering against the target.

For a service that needs the network, the usual pair is:

  Wants=network-online.target
  After=network-online.target
 
I checked this with systemd-analyze verify and it passes cleanly. Could you resubmit it that way, with the commit message adjusted? Or tell me if you'd rather I apply it with that change myself.

Best,
Michael

> On 29 Oct 2026, at 12:11, Valters Jansons <valter.jansons@gmail.com> wrote:
> 
> Current Requires=network.target is very strict. Standard practice is to
> set it as Wants= instead as a lighter "should". The application can
> then see what is actually going on.
> 
> Furthermore, an After= should be in place so that Systemd properly stops
> the updater prior to bringing the network stack offline.
> 
> Signed-off-by: Valters Jansons <valter.jansons@gmail.com>
> ---
> src/systemd/location-update.service.in | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/systemd/location-update.service.in b/src/systemd/location-update.service.in
> index 50ba01f..b491a12 100644
> --- a/src/systemd/location-update.service.in
> +++ b/src/systemd/location-update.service.in
> @@ -1,7 +1,8 @@
> [Unit]
> Description=Automatic Location Database Updater
> Documentation=man:location(1) https://man-pages.ipfire.org/libloc/location.html
> -Requires=network.target
> +Wants=network.target
> +After=network-online.target
> 
> [Service]
> Type=oneshot
> -- 
> 2.56.0
> 
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] systemd: Depend on network using Wants=/After=
  2026-10-29 15:49 ` Michael Tremer
@ 2026-10-29 16:19   ` Valters Jansons
  0 siblings, 0 replies; 3+ messages in thread
From: Valters Jansons @ 2026-10-29 16:19 UTC (permalink / raw)
  To: Michael Tremer; +Cc: location, Stefan Schantl

Wants= is the recommended way to hook the start-up of one unit to the
start-up of another unit. We do not directly benefit from the stricter
Requires=.

Furthermore, we should be explicit and define an After= instead of
assuming the default dependencies ordering will be added.

Signed-off-by: Valters Jansons <valter.jansons@gmail.com>
---
Michael, thank you for the investigation.
Resubmitting the systemd change as suggested.

 src/systemd/location-update.service.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/systemd/location-update.service.in b/src/systemd/location-update.service.in
index 50ba01f..e1b8b39 100644
--- a/src/systemd/location-update.service.in
+++ b/src/systemd/location-update.service.in
@@ -1,7 +1,8 @@
 [Unit]
 Description=Automatic Location Database Updater
 Documentation=man:location(1) https://man-pages.ipfire.org/libloc/location.html
-Requires=network.target
+Wants=network-online.target
+After=network-online.target
 
 [Service]
 Type=oneshot
-- 
2.56.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-29 16:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-29 12:11 [PATCH] systemd: Standartize on Wants=/After= for network Valters Jansons
2026-10-29 15:49 ` Michael Tremer
2026-10-29 16:19   ` [PATCH v2] systemd: Depend on network using Wants=/After= Valters Jansons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox