启动nfs服务时报错 systemd: rpcbind.socket failed to listen on sockets: Address family not supported by pro
Posted kongxx
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了启动nfs服务时报错 systemd: rpcbind.socket failed to listen on sockets: Address family not supported by pro相关的知识,希望对你有一定的参考价值。
问题描述
在使用 “sudo systemctl restart nfs” 命令启动 nfs 服务时报错,/var/log/message 文件中有如下错误
Sep 29 09:39:47 myhost systemd: Starting Preprocess NFS configuration...
Sep 29 09:39:47 myhost systemd: rpcbind.socket failed to listen on sockets: Address family not supported by protocol
Sep 29 09:39:47 myhost systemd: Failed to listen on RPCbind Server Activation Socket.
解决办法
-
修改 /etc/sysctl.conf 文件
添加如下两行
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1
-
修改 rpcbind.socket 文件
首先查找 rpcbind.socket 文件路径
$ sudo find /etc/ -name '*rpcbind.socket*' /etc/systemd/system/sockets.target.wants/rpcbind.socket
编辑 /etc/systemd/system/sockets.target.wants/rpcbind.socket 文件,将其中 ListenStream 关于IPv6的部分注释掉,如下:
[Unit] Description=RPCbind Server Activation Socket [Socket] ListenStream=/var/run/rpcbind.sock #ListenStream=[::]:111 ListenStream=0.0.0.0:111 BindIPv6Only=ipv6-only [Install] WantedBy=sockets.target
-
重新启动 nfs 服务
$ sudo systemctl daemon-reload $ sudo systemctl restart nfs
以上是关于启动nfs服务时报错 systemd: rpcbind.socket failed to listen on sockets: Address family not supported by pro的主要内容,如果未能解决你的问题,请参考以下文章
添加tomcat开机启动服务时报错:Neither the JAVA_HOME nor the JRE_HOME enviromment variable is defined