[systemd-devel] systemd automounts

Lennart Poettering mzerqung at 0pointer.de
Mon Aug 1 14:43:54 PDT 2011


On Fri, 29.07.11 11:16, Steve Dickson (SteveD at redhat.com) wrote:

> I'm trying to automount /var/lib/nfs/rpc_pipefs
> for the nfs-idmap.service
> 
> var-lib-nfs-rpc_pipefs.mount is:
> [Unit]
> Description=RPC Pipe File System
> DefaultDependencies=no
> 
> [Mount]
> What=sunrpc
> Where=/var/lib/nfs/rpc_pipefs
> Type=rpc_pipefs

Looks good.

> 
> var-lib-nfs-rpc_pipefs.automount is:
> [Unit]
> Description=RPC Pipe File System
> DefaultDependencies=no
> 
> [Automount]
> Where=/var/lib/nfs/rpc_pipefs

Looks good, too. But I'd recommend adding After=local-fs.target here, to
ensure your automount unit is established after /var is, if that's on a
separate partition.

> and the nfs-idmap.service is:
> [Unit]
> Description=Name to UID/GID mapping for NFSv4.
> After=syslog.target network.target var-lib-nfs-rpc_pipefs.automount
> ConditionPathIsDirectory=/sys/module/sunrpc

Is this really dependent on the network? If not I'd recommend to
ordering this after network.target.

Also, in F16 we will no longer support non-socket-activated syslogs (all
existing implementations have support for socket actviation upstream),
so the After=syslog.target is not necessary anymore.

> [Service]
> Type=forking
> EnvironmentFile=-/etc/sysconfig/nfs
> ExecStart=/usr/sbin/rpc.idmapd $RPCIDMAPDARGS
> 
> [Install]
> WantedBy=multi-user.target
> 
> Now I know for a fact that /var/lib/nfs/rpc_pipefs
> is being mount *after* the nfs-idmap.service 
> is run, because:

being mounted?

You mean the automount point being established, not the backing mount, right?

> rpc.idmapd is failing because 
>      rpc.idmapd[819]: main: open(/var/lib/nfs/rpc_pipefs//nfs): No such file or
> directory
> 
> and the startup message clearly show the service is being
> run before the mount:
> 
> Starting Name to UID/GID mapping for NFSv4....
> Starting OpenSSH server daemon....
> Started OpenSSH server daemon..
> Starting RPC bind service...
> Starting Sendmail Mail Transport Agent...
> Started LSB: Mount and unmount network filesystems..
> [   25.803165] RPC: Registered named UNIX socket transport module.
> [   25.804236] RPC: Registered udp transport module.
> [   25.805327] RPC: Registered tcp transport module.
> [   25.806283] RPC: Registered tcp NFSv4.1 backchannel transport module.
> [   25.889822] SELinux: initialized (dev rpc_pipefs, type rpc_pipefs), uses genfs_contexts
> 
> So any idea what on what I'm doing wrong? Is this how autmounts are
> suppose be used?

Yes, this looks like a good usecase.

Hmm, does the automount point work after boot?

How does the output of "systemctl list-units" look like for the
automount and mount unit?

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list