On Wed Jan 25, 2023 at 11:31 PM UTC, Pascal Hambourg wrote:

> Maybe there is a more elegant way to stop ifup@*.service, e.g. using 
> systemd unit dependencies but I am not familiar enough with this topic.
>
> This setup causes no delay when (re)starting networking.service by hand 
> at boot time or by hand. However if an interface marked "allow-hotplug" 
> was manually stopped with ifdown without stopping the associated 
> ifup@.service, it is not restarted when restarting networking.service.
>
> Any thoughts ?
>

Pascal, thank you for ideas!

After some digging I think that there is more elegant way to stop
ifup@*.service when stopping (or restarting) networking.serivce, we just
need to add PartOf to /lib/systemd/system/ifup@.service:

  [Unit]
  ...
  PartOf=networking.service

And this ExecStart to /lib/systemd/system/networking.service, to make
networking.service restart workable for "allow-hotplug" interfaces (as
per your suggestion):

  [Service]
  ...
  ExecStart=/usr/bin/udevadm trigger --action=add --subsystem-match=net
  ...

This changes should be on top of *.service files, before any Bug#1029352
modifications, of course.

Seems like more clearer way, than to use /bin/sh invocation and flag file
for the non-first run condition check.

Any pitfalls for this approach?

Reply via email to