Unable to start the nfs-server.service because unable to resolve hostname

Solution Unverified - Updated -

Environment

  • RHEL 7.2
  • libnfsidmap-0.25-12.el7.x86_64
  • nfs-utils-1.3.0-0.18.el7.x86_64

Issue

  • Starting the NFS service we get the following error message, when one of the client is down or DNS is unable to resolve a
    hostname
# systemctl restart nfs.service 
Job for nfs-server.service failed because the control process exited with error code. See "systemctl status nfs-server.service" and "journalctl -xe" for details.

Resolution

Diagnostic Steps

As shown below it is failing as it is unable to resolve foobar.com

# systemctl status nfs-server.service
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2015-12-04 09:56:08 IST; 8s ago
  Process: 21370 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)
  Process: 21366 ExecStopPost=/usr/sbin/exportfs -au (code=exited, status=0/SUCCESS)
  Process: 21362 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=0/SUCCESS)
  Process: 21273 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
  Process: 2714 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=1/FAILURE)
 Main PID: 21273 (code=exited, status=0/SUCCESS)

Dec 04 09:56:07 srv1-rhel7.example.com systemd[1]: Starting NFS server and services...
Dec 04 09:56:08 srv1-rhel7.example.com exportfs[2714]: exportfs: Failed to resolve foobar.com <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Dec 04 09:56:08 srv1-rhel7.example.com exportfs[2714]: exportfs: Failed to resolve foobar.com <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Dec 04 09:56:08 srv1-rhel7.example.com systemd[1]: nfs-server.service: control process exited, code=exited status=1
Dec 04 09:56:08 srv1-rhel7.example.com systemd[1]: Failed to start NFS server and services.
Dec 04 09:56:08 srv1-rhel7.example.com systemd[1]: Unit nfs-server.service entered failed state.
Dec 04 09:56:08 srv1-rhel7.example.com systemd[1]: nfs-server.service failed.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

2 Comments

I have same issue, but my pkg version is like nfs-utils-1.3.0-0.21.el7.x86_64 Can some one help me on this?

As a possible solution, one should check whether the NFS services are enabled or not, and perform the below steps.

systemctl enable nfs systemctl start nfs

service nfs status

Redirecting to /bin/systemctl status nfs.service ● nfs-server.service - NFS server and services Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled) Drop-In: /run/systemd/generator/nfs-server.service.d └─order-with-mounts.conf Active: failed (Result: exit-code) since Sat 2020-09-19 22:07:29 EAT; 6min ago Process: 3515 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=1/FAILURE) Process: 3513 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS) Main PID: 3515 (code=exited, status=1/FAILURE)

systemd[1]: Starting NFS server and services... rpc.nfsd[3515]: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused) rpc.nfsd[3515]: rpc.nfsd: unable to set any sockets for nfsd systemd[1]: nfs-server.service: main process exited, code=exited, status=1/FAILURE systemd[1]: Failed to start NFS server and services. systemd[1]: Unit nfs-server.service entered failed state. systemd[1]: nfs-server.service failed.

systemctl enable nfs systemctl start nfs

Redirecting to /bin/systemctl status nfs.service ● nfs-server.service - NFS server and services Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled) Active: active (exited) since2s ago Process: 9656 ExecStartPost=/bin/sh -c if systemctl -q is-active gssproxy; then systemctl restart gssproxy ; fi (code=exited, status=0/SUCCESS) Process: 9640 ExecStart=/usr/sbin/rpc.nfsd(code=exited, status=0/SUCCESS) Process: 9636 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS) Main PID: 9640 (code=exited, status=0/SUCCESS) Tasks: 0 Memory: 0B CGroup: /system.slice/nfs-server.service