On Tue, 01.11.16 20:01, Andrei Borzenkov ([email protected]) wrote: > 01.11.2016 18:47, Lennart Poettering пишет: > > On Tue, 01.11.16 11:11, Steve Dickson ([email protected]) wrote: > > > >> > >> > >> On 10/31/2016 03:40 PM, Michael Biebl wrote: > >>> Why is it using /var/run (where /var could be on a separate partition) > >>> and not /run for the socket files? > >> > >> Historical reasons?? I guess that's way its always been > >> and never caused a problem... > > > > Yeah, it normally shouldn't create problems – however, you are setting > > DefaultDependencies=no now, which means you run in early boot, and > > then things become more complex, as /var is not around fully yet. > > Unit file had RequiresMountsFor=/var/run. If this is not enough to > ensure unit starts only after /var/run is mounted, then what exactly > RequiresMountsFor does?
RequiresMountsFor= orders your unit so that the mount points required to make the specified path available are mounted first. It thus guarantees successful read access at the least. If used for regular services (by which I mean: non-early-boot services) it also gaurantees successful write access to the directories in question. However, during early boot things are a bit different: the kernel/initrd might pre-mount a number of dirs, but generally only in a read-only mode. Typically the root partition (on which /var is more often than not located) is read-only this early. Now, "systemd-remount-fs.service" service is responsible to adjust the mount flags in a way that they match what /etc/fstab defines. Hence, to summarize this differently: 1) if you are in late boot and just want to pull in mounts for some dir and don't want to rely on it being listed as "auto" in fstab, then use RequiresMountsFor= on it and you are happy 2) if you are in early boot and need read-only access to something, then use RequiresMountsFor= on it and you are happy 3) if you are in early boot and need write access to something, then use RequiresMountsFor= in combination with an After=systemd-remount-fs.service and you should be happy. Hope this makes sense, Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/systemd-devel
