Re: [systemd-devel] Ensuring that a unit starts before any networking

2020-07-14 Thread Lennart Poettering
On Di, 30.06.20 11:45, Mark Rogers (m...@more-solutions.co.uk) wrote: > >From that, is it reasonable to conclude that this is just an omission that > has no potential negative effects from being fixed? I can't see any reason > why adding After=network-pre.target would have direct a negative

Re: [systemd-devel] Ensuring that a unit starts before any networking

2020-06-30 Thread Reindl Harald
Am 30.06.20 um 14:55 schrieb Simon McVittie: > Adding After=network-pre.target to dhcpcd.service is probably also not > a bad idea. It isn't clear to me whether dhcpcd brings up interfaces of > its own accord just because you start it as a systemd unit it just fails when like in the example

Re: [systemd-devel] Ensuring that a unit starts before any networking

2020-06-30 Thread Simon McVittie
On Tue, 30 Jun 2020 at 12:59:54 +0100, Mark Rogers wrote: > On Tue, 30 Jun 2020 at 12:13, Simon McVittie wrote: > > > > I would have expected this to be done in some "larger" network management > > component that is responsible for bringing up network interfaces according > > to your

Re: [systemd-devel] Ensuring that a unit starts before any networking

2020-06-30 Thread Mark Rogers
On Tue, 30 Jun 2020 at 12:13, Simon McVittie wrote: > > I would have expected this to be done in some "larger" network management > component that is responsible for bringing up network interfaces according > to your configuration, rather than necessarily dhcpcd.service itself. In which case one

Re: [systemd-devel] Ensuring that a unit starts before any networking

2020-06-30 Thread Simon McVittie
On Tue, 30 Jun 2020 at 11:27:30 +0200, Lennart Poettering wrote: > On Sa, 27.06.20 15:54, Mark Rogers (m...@more-solutions.co.uk) wrote: > > Adding After=network-pre.target to dhcpcd.service seems to have > > resolved it, and taught me a lesson in the process. > > > > Is there an obvious reason

Re: [systemd-devel] Ensuring that a unit starts before any networking

2020-06-30 Thread Mark Rogers
On Tue, 30 Jun 2020 at 10:27, Lennart Poettering wrote: > Yes, this is a bug in the the distro packaging. Please file a bug > against your distro, so that they add After=network-pre.target. > Will do. > My educated guess is that, it's not trvial to get this right: we > document what

Re: [systemd-devel] Ensuring that a unit starts before any networking

2020-06-30 Thread Lennart Poettering
On Sa, 27.06.20 15:54, Mark Rogers (m...@more-solutions.co.uk) wrote: > > It could very well be because of the dhcpcd.service you're using. > > > > I don't know what it's like on Raspbian, but on Debian this unit appears > > to have no ordering with respect to network.target or network-pre.target

Re: [systemd-devel] Ensuring that a unit starts before any networking

2020-06-27 Thread Reindl Harald
Am 27.06.20 um 16:54 schrieb Mark Rogers: > Ah, therein lies my failing - I assumed OS supplied units wouldn't > need adapting... > > Adding After=network-pre.target to dhcpcd.service seems to have > resolved it, and taught me a lesson in the process. as often it depends - on machines with

Re: [systemd-devel] Ensuring that a unit starts before any networking

2020-06-27 Thread Mark Rogers
On Sat, 27 Jun 2020 at 13:04, Andrei Borzenkov wrote: > All other units that implement networking must have > After=network-pre.target for the above to do anything. Do they? .. and .. On Sat, 27 Jun 2020 at 13:08, Michael Chapman wrote: > It could very well be because of the dhcpcd.service

Re: [systemd-devel] Ensuring that a unit starts before any networking

2020-06-27 Thread Michael Chapman
On Sat, 27 Jun 2020, Mark Rogers wrote: > On Sat, 27 Jun 2020 at 11:06, Zbigniew Jędrzejewski-Szmek > wrote: > > You should use Before=network-pre.target, Wants=network-pre.target. > > Thanks, tried that but still not working: It could very well be because of the dhcpcd.service you're using. I

Re: [systemd-devel] Ensuring that a unit starts before any networking

2020-06-27 Thread Zbigniew Jędrzejewski-Szmek
On Sat, Jun 27, 2020 at 11:42:00AM +0100, Mark Rogers wrote: > On Sat, 27 Jun 2020 at 11:06, Zbigniew Jędrzejewski-Szmek > wrote: > > You should use Before=network-pre.target, Wants=network-pre.target. > > Thanks, tried that but still not working: > > $ journalctl -b | grep -Ei

Re: [systemd-devel] Ensuring that a unit starts before any networking

2020-06-27 Thread Andrei Borzenkov
27.06.2020 13:42, Mark Rogers пишет: > On Sat, 27 Jun 2020 at 11:06, Zbigniew Jędrzejewski-Szmek > wrote: >> You should use Before=network-pre.target, Wants=network-pre.target. > > Thanks, tried that but still not working: > All other units that implement networking must have

Re: [systemd-devel] Ensuring that a unit starts before any networking

2020-06-27 Thread Ede Wolf
Just a wild guess, but I'd start with a combination of one of those: # - [Unit] Description=my service Before=network.target Before=systemd-networkd.service Before=network-online.target Before=systemd-networkd-wait-online.service ... [Install] WantedBy=Basic.target # - Probably

Re: [systemd-devel] Ensuring that a unit starts before any networking

2020-06-27 Thread Mark Rogers
On Sat, 27 Jun 2020 at 11:51, Dave Howorth wrote: > A Pi doesn't normally have an RTC, so the mixup usually takes place > when the time is updated via NTP I believe. Do you have an RTC? Yes I do have an RTC. At that point in the logs dhcpcd hasn't started so it must be from the RTC (although

Re: [systemd-devel] Ensuring that a unit starts before any networking

2020-06-27 Thread Dave Howorth
On Sat, 27 Jun 2020 11:42:00 +0100 Mark Rogers wrote: > On Sat, 27 Jun 2020 at 11:06, Zbigniew Jędrzejewski-Szmek > wrote: > > You should use Before=network-pre.target, > > Wants=network-pre.target. > > Thanks, tried that but still not working: > > $ journalctl -b | grep -Ei

Re: [systemd-devel] Ensuring that a unit starts before any networking

2020-06-27 Thread Mark Rogers
On Sat, 27 Jun 2020 at 11:06, Zbigniew Jędrzejewski-Szmek wrote: > You should use Before=network-pre.target, Wants=network-pre.target. Thanks, tried that but still not working: $ journalctl -b | grep -Ei '(db2config|dhcpcd)' Feb 14 10:12:03 localhost systemd[1]: Starting dhcpcd on all

Re: [systemd-devel] Ensuring that a unit starts before any networking

2020-06-27 Thread Zbigniew Jędrzejewski-Szmek
On Sat, Jun 27, 2020 at 09:34:00AM +0100, Mark Rogers wrote: > I have tried multiple approaches so far but by current service file > looks like this: > > [Unit] > Description=Config generation from DB > Before=networking.service You should use Before=network-pre.target, Wants=network-pre.target.

[systemd-devel] Ensuring that a unit starts before any networking

2020-06-27 Thread Mark Rogers
This feels like something I should be easily able to answer from documentation/Google, and failing that from somewhere like StackOverflow, without troubling systemd-devel, but all my efforts have thus far failed [1] What is the correct way to ensure a script runs to completion before any