[systemd-devel] rpcbind.socket failing

Lennart Poettering lennart at poettering.net
Tue Nov 1 13:31:01 UTC 2016


On Mon, 31.10.16 13:19, Steve Dickson (SteveD at redhat.com) wrote:

> [Unit]
> Description=RPCbind Server Activation Socket
> DefaultDependencies=no
> RequiresMountsFor=/var/run /run
> Wants=rpcbind.target
> Before=rpcbind.target
> 
> [Socket]
> ListenStream=/var/run/rpcbind.sock

So you turned off the default dependencies, which means your socket
unit will be started during earliest boot, at a time where /var is
usually not writable yet. (You then try to fix this up via the
RequiresMountsFor= thing, but that will only ensure that /var is
mounted, it does not require it to actually be writable, or that the
/var/run → /run symlink was created)

So, most importantly: please drop all references to /var/run
here. That's just a legacy alias to /run, implemented via a
symlink. All distributions, regardless if they adopted systemd or not,
have switched to making /run a tmpfs and /var/run a symlink to
it. There's really no point at all in ever referring to /var/run
again.

By dropping any reference to /var/run and replacing it by a reference
directly to /run you make the entire problem set go away: /run is
guaranteed to always exist on systemd systems, it's always writable,
and always a tmpfs. PID 1 mounts in in its earliest initialization
phase, right at the same time it mounts /proc and /sys too.

Summary:

a) drop the entire RequiresMountsFor= line, it's useless. /run is
   mounted anyway, and depending on /var/run doesn't do what people
   might think, and you don't need it anway.

b) Change the ListenStream directive to reference /run/rpcbind.sock
   directly, avoid the indirection via /var/run/rpcbind.sock

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list