客户端连接aosc的nfs server出现“Connection refused”的错误

如题。在解这个问题时,执行了以下操作:
1、 关闭防火墙
sudo systemctl stop firewalld.service
2、安装nfs-server、nfs-utils,已确认nfs server服务已开启
● nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; preset: e[0;1;38:5:185mdisabled)
Drop-In: /run/systemd/generator/nfs-server.service.d
└─order-with-mounts.conf
Active: active (exited) since Thu 2024-11-14 14:47:37 CST; 53min ago
Invocation: 761ca469991343f183290d9bdb87aee3
Process: 1109 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Process: 1118 ExecStart=/usr/sbin/rpc.nfsd (code=exited, status=0/SUCCESS)
Main PID: 1118 (code=exited, status=0/SUCCESS)
Mem peak: 820K
CPU: 11ms

Nov 14 14:47:37 aosc-240916 systemd[1]: Starting nfs-server.service - NFS server and services…
Nov 14 14:47:37 aosc-240916 exportfs[1109]: exportfs: /etc/exports [2]: Neither ‘subtree_check’ or ‘no_subtree_check’ specified for export “*:/home/steven/temp”.
Nov 14 14:47:37 aosc-240916 exportfs[1109]: Assuming default behaviour (‘no_subtree_check’).
Nov 14 14:47:37 aosc-240916 exportfs[1109]: NOTE: this default has changed since nfs-utils version 1.0.x
Nov 14 14:47:37 aosc-240916 systemd[1]: Finished nfs-server.service - NFS server and services.
3、 nfs挂载目录已具备777权限
4、检查rpcbind的状态,出现了cannot get local address for udp: Servname not supported for ai_socktype等错误:
● rpcbind.service - RPC bind service
Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; indirect; preset: e[0;1;38:5:185mdisabled)
Active: active (running) since Thu 2024-11-14 14:47:36 CST; 1h 4min ago
Invocation: baaa38250aff4bd08be7a33e4a8bcfd9
TriggeredBy: ● rpcbind.socket
Process: 1072 ExecStart=/usr/bin/rpcbind -w ${RPCBIND_ARGS} (code=exited, status=0/SUCCESS)
Main PID: 1080 (rpcbind)
Tasks: 1 (limit: 1856)
Memory: 660K (peak: 920K)
CPU: 47ms
CGroup: /system.slice/rpcbind.service
└─1080 /usr/bin/rpcbind -w

Nov 14 14:47:36 aosc-240916 systemd[1]: Starting rpcbind.service - RPC bind service…
Nov 14 14:47:36 aosc-240916 rpcbind[1072]: cannot get local address for udp: Servname not supported for ai_socktype
Nov 14 14:47:36 aosc-240916 rpcbind[1072]: cannot get local address for tcp: Servname not supported for ai_socktype
Nov 14 14:47:36 aosc-240916 rpcbind[1072]: cannot get local address for udp6: Servname not supported for ai_socktype
Nov 14 14:47:36 aosc-240916 rpcbind[1072]: cannot get local address for tcp6: Servname not supported for ai_socktype
Nov 14 14:47:36 aosc-240916 systemd[1]: Started rpcbind.service - RPC bind service.
5、 运行“rpcinfo -p localhost”也有错误:
localhost: RPC: Remote system error - Connection refused

有挂载aosc nfs成功的案例吗?

您是否是要在本地(localhost)使用NFS客户端连接本地(localhost)启动的NFS服务器?

原文忘了交代背景了 :sweat_smile:,aosc是作为nfs服务器,另一块嵌入式的arm板子是nfs客户端。板端在mount aosc的nfs共享目录时,出现了连接被拒的错误。

这个问题可能是因为iana-etc数据登记的端口定义名字,和rpcbind里面的不匹配。您可以手动修改一下/etc/services文件,找到sunrpc那两行,在这两行后面加上 portmapper(注意空格)。再重启服务,客户端连接。

谢谢,按照上述方法修改/etc/services文件后,客户端nfs可以正常连接了。