Can't start NFS server

Tried on both Centos7 and ubuntu 18 lxd contaienrs.

root@ubu:~# systemctl start nfs-kernel-server
A dependency job for nfs-server.service failed. See 'journalctl -xe' for details.

root@ubu:~# journalctl -xn | grep failed
May 14 03:43:47 ubu systemd[1]: nfs-mountd.service: Job nfs-mountd.service/start failed with result 'dependency'.
May 14 03:43:47 ubu systemd[1]: nfs-server.service: Job nfs-server.service/start failed with result 'dependency'.
-- Subject: Unit run-rpc_pipefs.mount has failed
-- Unit run-rpc_pipefs.mount has failed.
May 14 03:43:47 ubu systemd[1]: Dependency failed for RPC security service for NFS client and server.
-- Subject: Unit rpc-gssd.service has failed
-- Unit rpc-gssd.service has failed.
May 14 03:43:47 ubu systemd[1]: rpc-gssd.service: Job rpc-gssd.service/start failed with result 'dependency'.
May 14 03:43:47 ubu systemd[1]: Dependency failed for RPC security service for NFS server.
-- Subject: Unit rpc-svcgssd.service has failed
-- Unit rpc-svcgssd.service has failed.
May 14 03:43:47 ubu systemd[1]: rpc-svcgssd.service: Job rpc-svcgssd.service/start failed with result 'dependency'.

Looks like its LXD issues. Any thoughts on how to get this working?

Here is output of /var/log/syslog

May 14 03:48:22 ubu systemd[1]: run-rpc_pipefs.mount: Failed to reset devices.list: Operation not permitted
May 14 03:48:22 ubu systemd[1]: Mounting RPC Pipe File System…
May 14 03:48:22 ubu systemd[1]: proc-fs-nfsd.mount: Failed to reset devices.list: Operation not permitted
May 14 03:48:22 ubu mount[455]: mount: /run/rpc_pipefs: permission denied.
May 14 03:48:22 ubu systemd[1]: Mounting NFSD configuration filesystem…
May 14 03:48:22 ubu mount[456]: mount: /proc/fs/nfsd: permission denied.
May 14 03:48:22 ubu systemd[1]: nfs-config.service: Failed to reset devices.list: Operation not permitted
May 14 03:48:22 ubu systemd[1]: Starting Preprocess NFS configuration…
May 14 03:48:22 ubu systemd[1]: run-rpc_pipefs.mount: Mount process exited, code=exited status=32
May 14 03:48:22 ubu systemd[1]: run-rpc_pipefs.mount: Failed with result ‘exit-code’.
May 14 03:48:22 ubu systemd[1]: Failed to mount RPC Pipe File System.
May 14 03:48:22 ubu systemd[1]: Dependency failed for RPC security service for NFS client and server.
May 14 03:48:22 ubu systemd[1]: rpc-gssd.service: Job rpc-gssd.service/start failed with result ‘dependency’.
May 14 03:48:22 ubu systemd[1]: Dependency failed for NFSv4 ID-name mapping service.
May 14 03:48:22 ubu systemd[1]: nfs-idmapd.service: Job nfs-idmapd.service/start failed with result ‘dependency’.
May 14 03:48:22 ubu systemd[1]: Dependency failed for RPC security service for NFS server.
May 14 03:48:22 ubu systemd[1]: rpc-svcgssd.service: Job rpc-svcgssd.service/start failed with result ‘dependency’.
May 14 03:48:22 ubu systemd[1]: proc-fs-nfsd.mount: Mount process exited, code=exited status=32
May 14 03:48:22 ubu systemd[1]: proc-fs-nfsd.mount: Failed with result ‘exit-code’.
May 14 03:48:22 ubu systemd[1]: Failed to mount NFSD configuration filesystem.
May 14 03:48:22 ubu systemd[1]: Dependency failed for NFS server and services.
May 14 03:48:22 ubu systemd[1]: Dependency failed for NFS Mount Daemon.
May 14 03:48:22 ubu systemd[1]: nfs-mountd.service: Job nfs-mountd.service/start failed with result ‘dependency’.
May 14 03:48:22 ubu systemd[1]: nfs-server.service: Job nfs-server.service/start failed with result ‘dependency’.
May 14 03:48:22 ubu systemd[1]: Started Preprocess NFS configuration.

Programs(or Application) that run on containers, must run in user space.
However, in the case of nfs server, it was implemented in kernel space.

For the above reasons, the nfs server does not run on the container.

If my answer is wrong, please give me the correct answer

1 Like

So nfs server can’t be used inside LXD containers? Is that it?

@lbg74

Hi.

First, the answer I posted earlier was not objectively proved, so I deleted it.

@tomp and @stgraber container run kernel space based nfs servers?

To run nfs server in lxd container, use unfs3(user-space nfs server version 3).

Please refer to the two URLs below.

  1. https://github.com/unfs3/unfs3
  2. https://www.looklinux.com/how-to-install-unfs3-on-centos-6-x/

The unfs3 was tested in ubunt 20.04 container and centos 7.8 container.
It compiles on ubuntu but fails with a compile error on centos.

show the below picture.

I hope it help for you. Thank you @Makrand

1 Like

Below is the official redhat answer.

Q: Is the nfs-server on a container supported by Red Hat (2019.03.30)

A: Currently this is not a supported configuration to have NFS server in a container environment

Root cause

The NFS server in a container is operating within a seperate network name-space and is within a chrooted containerized environment.
Therefore it is unable to use the nfs client tracking mechanism to record and track the clients which use this server. The base of this points to the key that a container is built as a set of name space isolation primitives, one of which is the network name-space isolation