[systemd-devel] [PATCH 1/1] Ensure that /run/systemd/network exists
Lennart Poettering
lennart at poettering.net
Wed May 27 08:46:17 PDT 2015
On Wed, 27.05.15 15:40, Lukáš Nykrýn (lnykryn at redhat.com) wrote:
> Lennart Poettering píše v St 27. 05. 2015 v 15:01 +0200:
> > On Wed, 27.05.15 14:34, Martin Pitt (martin.pitt at ubuntu.com) wrote:
> >
> > > Hey Peter,
> > >
> > > Peter Lemenkov [2015-05-27 15:30 +0300]:
> > > > This directory is used for storing transient/generated network service
> > > > files. Unfortunately it doesn't generated during systemd-networkd
> > > > startup. Let's fix that.
> > > > ---
> > > > src/network/networkd.c | 3 +++
> > > > 1 file changed, 3 insertions(+)
> > > >
> > > > diff --git a/src/network/networkd.c b/src/network/networkd.c
> > > > index 543a4e4..a98855f 100644
> > > > --- a/src/network/networkd.c
> > > > +++ b/src/network/networkd.c
> > > > @@ -67,6 +67,9 @@ int main(int argc, char *argv[]) {
> > > > if (r < 0)
> > > > log_warning_errno(r, "Could not create runtime directory 'lldp': %m");
> > > >
> > > > + /* Create a directory for the generated transient network services */
> > > > + mkdir_p("/run/systemd/network", 0755);
> > >
> > > Should that perhaps go into /usr/lib/tmpfiles.d/systemd.conf instead,
> > > together with the related
> > >
> > > d /run/systemd/netif 0755 systemd-network systemd-network -
> > > d /run/systemd/netif/links 0755 systemd-network systemd-network -
> > > d /run/systemd/netif/leases 0755 systemd-network systemd-network -
> > >
> > > ?
> >
> > This would not suffice, as networkd can run in early-boot, but
> > tmpfiles only runs after /var and friends have been mounted.
>
> For some cases we need that directory really soon. For example for a
> generator which creates a .link file that renames a device.
Nah, systemd generators should only generate unit files, and nothing
else, and do so in the directories that are passed to it on the
command line arguments.
tools that generate .link/.network/.netdev files should probably live
in their own mini-service that is ordered before networkd and
udev. And those tools should probably just create the dirs on their
own if they are missing to make this race-free.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list