Page 1 of 1

Mount NFS failed with "Connection refused"

Posted: 2024-08-09 6:46
by Rick
Hi,

Board: luckfox_pico_plus
Build: buildroot, SPI

I tried to mount nfs but always return "Connection refused"

from luckfox board I run:
mount -t nfs 192.168.1.162:/mnt/exports ./nfs
mount: mounting 192.168.1.162:/mnt/exports on ./nfs failed: Connection refused

I can mount this nfs from another Linux box without problem.
Here is my server /etc/exports:
/mnt/exports 192.168.1.0/24(rw,sync,all_squash,no_subtree_check)

Attached is the tcpdump capture file, it looks normal but the mount just not continue and give "Connection refused" error.

I use strace to see which function call give this error, here is the log:

[root@luckfox mnt]# strace mount -t nfs 192.168.1.162:/mnt/exports ./nfs
execve("/bin/mount", ["mount", "-t", "nfs", "192.168.1.162:/mnt/exports", "./nfs"], 0xaeee6d40 /* 16 vars */) = 0
readlinkat(AT_FDCWD, "/proc/self/exe", "/bin/busybox", 4096) = 12
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xa6fd5000
open("/oem/usr/lib/libtirpc.so.3", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/oem/lib/libtirpc.so.3", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/libtirpc.so.3", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/libtirpc.so.3", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/libtirpc.so.3", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=132372, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xa6fd4000
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\4\\\0\0004\0\0\0"..., 4096) = 4096
mmap2(NULL, 200704, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xa6f8f000
mmap2(0xa6f8f000, 127964, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xa6f8f000
mmap2(0xa6fbe000, 4184, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x1f000) = 0xa6fbe000
close(3) = 0
munmap(0xa6fd4000, 4096) = 0
open("/oem/usr/lib/libc.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/oem/lib/libc.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/libc.so.0", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=427896, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xa6fd4000
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0@\36\1\0004\0\0\0"..., 4096) = 4096
mmap2(NULL, 585728, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xa6f00000
mmap2(0xa6f00000, 420480, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xa6f00000
mmap2(0xa6f77000, 4852, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x67000) = 0xa6f77000
mmap2(0xa6f79000, 88080, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xa6f79000
close(3) = 0
munmap(0xa6fd4000, 4096) = 0
stat("/lib/ld-uClibc.so.0", {st_mode=S_IFREG|0755, st_size=32608, ...}) = 0
open("/oem/usr/lib/libc.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/oem/lib/libc.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/libc.so.0", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=427896, ...}) = 0
close(3) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xa6fd4000
set_tls(0xa6fd4490) = 0
open("/dev/urandom", O_RDONLY) = 3
read(3, "\341\362\256J", 4) = 4
close(3) = 0
mprotect(0x4ef000, 8192, PROT_READ) = 0
mprotect(0xa6fbe000, 4096, PROT_READ) = 0
mprotect(0xa6f77000, 4096, PROT_READ) = 0
mprotect(0xa6fd6000, 4096, PROT_READ) = 0
set_tid_address(0xa6fd4068) = 924
set_robust_list(0xa6fd406c, 12) = 0
rt_sigaction(SIGRTMIN, {sa_handler=0xa6f5b288, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0xa6f126bc}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0xa6f5b34c, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0xa6f126bc}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
ugetrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
ioctl(0, TCGETS, {B9600 opost isig icanon echo ...}) = 0
ioctl(1, TCGETS, {B9600 opost isig icanon echo ...}) = 0
getuid32() = 0
brk(NULL) = 0x4f2000
brk(0x4f3000) = 0x4f3000
getuid32() = 0
geteuid32() = 0
brk(0x4f4000) = 0x4f4000
mount("192.168.1.162:/mnt/exports", "./nfs", "nfs", MS_SILENT, "addr=192.168.1.162") = -1 ECONNREFUSED (Connection refused)
write(2, "mount: mounting 192.168.1.162:/m"..., 79mount: mounting 192.168.1.162:/mnt/exports on ./nfs failed: Connection refused
) = 79
exit_group(255) = ?
+++ exited with 255 +++
[root@luckfox mnt]#

Any idea to solve this problem?

Re: Mount NFS failed with "Connection refused"

Posted: 2024-08-10 2:38
by Crocodile
Hello, we have only tested mounting Luckfox Pico's NFS on a PC, but we haven't tested mounting an NFS service on the Luckfox Pico. Based on the logs you provided, it seems that the corresponding library is missing. Please start by addressing this issue.

Re: Mount NFS failed with "Connection refused"

Posted: 2024-08-10 14:11
by Rick
Crocodile wrote: 2024-08-10 2:38 Hello, we have only tested mounting Luckfox Pico's NFS on a PC, but we haven't tested mounting an NFS service on the Luckfox Pico. Based on the logs you provided, it seems that the corresponding library is missing. Please start by addressing this issue.
Do you mean Luckfox Pico as a NFS server?

What I'm trying to do is Luckfox Pico as NFS client, I have a PC Linux server running NFS server, and I have another NAS running NFS server. I want to mount the PC Linux Server's folder to my Luckfox Pico so that I can store files on the server.

Also I want to boot Luckfox from NFS, does the Luckfox u-boot support boot from NFS root? That would be very convience for development if we can do that.

I don't see any missing library, and there is no error message imply that. I also checked the kernel configuration, the NFS is enabled from kernel.

Re: Mount NFS failed with "Connection refused"

Posted: 2024-08-12 3:20
by Crocodile
Sorry for not reviewing your previous log information carefully. You indeed do not lack the corresponding libraries. I have just verified that using the Luckfox Pico as an NFS client is feasible. Make sure the NFS server has nfs-kernel-server installed and that the shared folder is set up correctly (e.g., by adding the line echo "<your nfs dir> *(rw,sync,root_squash,no_subtree_check)" >> /etc/exports).

Implementing NFS in U-Boot has not been tested yet.