jjm2473 / rtd1295-openwrt18-porting

porting openwrt 19.07+ to rtd1295/rtd1296 devices (android + openwrt dual os) (移植新版OpenWrt到RTD1295(如Zidoo Z9S))
https://github.com/jjm2473/openwrt/wiki/RTD129X-Openwrt-18.06
MIT License
40 stars 11 forks source link

[SOLVED]nfs server on rtd1295 #22

Open davicom88 opened 4 years ago

davicom88 commented 4 years ago

as previously said privately, in my opinion you did a great job: but I can't get NFS server working, any help should be really appreciated:

Ip of my nfs server "X10 rtd1295" is 192.168.1.125 i set my export on Luci: /mnt/sda1 192.168.1.28/24(rw,sync,root_squash,all_squash,insecure,no_subtree_check)

then I try to mount it from my linux host 192.168.1.28

sudo mount -t nfs 192.168.1.125:/mnt/sda1 /home/user/Desktop/NFS_shares/x10
[sudo] password for user: 
**mount.nfs: requested NFS version or transport protocol is not supported**

As you suggested me, I put exportfs -a on cli on openwrt but I get nothing return

davicom88 commented 4 years ago

update: if I did command: sudo mount -o rw,vers=2 192.168.1.125:/mnt/sda1 /home/user/Desktop/NFS_shares/x10 -vv returns

mount.nfs: timeout set for Wed Sep  2 13:12:20 2020
mount.nfs: trying text-based options 'vers=2,addr=192.168.1.125'
mount.nfs: prog 100003, trying vers=2, prot=6
mount.nfs: portmap query retrying: RPC: Program not registered
mount.nfs: prog 100003, trying vers=2, prot=17
mount.nfs: portmap query failed: RPC: Program not registered
mount.nfs: requested NFS version or transport protocol is not supported

It's like nfs isn't start correctly, in fact from "netstat -a" I can see a process running only on port tcp 32778

jjm2473 commented 4 years ago

Can you check is portmap running?

PS: I recommend you to install my new firmware

davicom88 commented 4 years ago

yes I have just your last firmware

davicom88 commented 4 years ago

portmap isn't install by default, I tried to install it but without any results, I re-try to install it. Could you suggest me if I need to configure something manually after installing portmap?

jjm2473 commented 4 years ago

Oh, which version are you using?

We don't need portmap in new firmware.

I thought you are using old firmware, because this issue is in my old project.

jjm2473 commented 4 years ago

portmap was replaced by rpcbind in new firmware

jjm2473 commented 4 years ago
root@Z9S:~# netstat -anp|grep 111
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      347/rpcbind
tcp        0      0 :::111                  :::*                    LISTEN      347/rpcbind
udp        0      0 0.0.0.0:111             0.0.0.0:*                           347/rpcbind
udp        0      0 :::111                  :::*                                347/rpcbind
unix  2      [ ACC ]     SEQPACKET  LISTENING      11192 -                   /dev/socket/lmkd
unix  2      [ ]         DGRAM                     11130 -                   
unix  2      [ ]         DGRAM                     11180 -                   
davicom88 commented 4 years ago

Ah ok, but the problem remain:

root@OpenWrt:~# showmount -e localhost Export list for localhost: /mnt/sda1 192.168.1.55/24 but

root@OpenWrt:~# showmount -e
clnt_create: RPC: Unknown hos
root@OpenWrt:~# netstat -anp|grep 111
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      324/rpcbind
tcp        0      0 192.168.1.125:445       192.168.1.55:59526      ESTABLISHED 2368/smbd
tcp        0    144 192.168.1.125:22        192.168.1.55:58968      ESTABLISHED 2276/dropbear
tcp        0      0 :::111                  :::*                    LISTEN      324/rpcbind
tcp        1      0 ::ffff:192.168.1.125:36052 ::ffff:103.14.35.46:80  CLOSE_WAIT  -
tcp        0      0 ::ffff:192.168.1.125:54395 ::ffff:172.253.122.188:5228 ESTABLISHED -
tcp        1      0 ::ffff:192.168.1.125:43791 ::ffff:103.14.35.46:80  CLOSE_WAIT  -
udp        0      0 0.0.0.0:111             0.0.0.0:*                           324/rpcbind
udp        0      0 192.168.1.125:137       0.0.0.0:*                           1291/nmbd
udp        0      0 192.168.1.125:138       0.0.0.0:*                           1291/nmbd
udp        0      0 192.168.1.125:50405     0.0.0.0:*                           541/minidlna
udp        0      0 :::111                  :::*                                324/rpcbind
davicom88 commented 4 years ago

Wich command do you use to connect to Z9S on linux client?

jjm2473 commented 4 years ago

I never test NFS in linux client, but Mac OS client works fine.

I checked these commands on my Z9S:

root@Z9S:~# showmount -e localhost
Export list for localhost:
/mnt/sataa2 *
root@Z9S:~# showmount -e 127.0.0.1
Export list for 127.0.0.1:
/mnt/sataa2 *
root@Z9S:~# showmount -e 
Export list for Z9S:
/mnt/sataa2 *
davicom88 commented 4 years ago

following the guide on official openwrt site https://openwrt.org/docs/guide-user/services/nas/nfs.server

I obtain error when I start nfs daemon, could this help you to check what my problem is?

root@OpenWrt:~# /etc/init.d/rpcbind disable
root@OpenWrt:~# /etc/init.d/nfsd disable
root@OpenWrt:~# /etc/init.d/rpcbind enable
root@OpenWrt:~# /etc/init.d/nfsd enable
root@OpenWrt:~# /etc/init.d/rpcbind start
root@OpenWrt:~# /etc/init.d/nfsd start
mount: /proc/fs/nfsd: unknown filesystem type 'nfsd'.
rpc.nfsd: Unable to access /proc/fs/nfsd errno 2 (No such file or directory).
Please try, as root, 'mount -t nfsd nfsd /proc/fs/nfsd' and then restart rpc.nfsd to correct the problem
davicom88 commented 4 years ago

From client linux:

user@server:~$ showmount -e 192.168.1.125
Export list for 192.168.1.125:
/mnt/sda1 192.168.1.55/24
user@server:~$ rpcinfo -p 192.168.1.125
   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
    100005    1   udp  32780  mountd
    100005    1   tcp  32780  mountd
    100005    2   udp  32780  mountd
    100005    2   tcp  32780  mountd
    100005    3   udp  32780  mountd
    100005    3   tcp  32780  mountd
    100024    1   udp  32778  status
    100024    1   tcp  32778  status
davicom88 commented 4 years ago

I didnt' mean you have to help me. What you have done it's yet amazing. Sorry for my little english anyway... :)

davicom88 commented 4 years ago

In meantime I also tried to mount different path: /tmp with same result And also to mount from another Linux client obtaining: permission denied

jjm2473 commented 4 years ago

can you run lsmod in Openwrt?

davicom88 commented 4 years ago
user@OpenWrt:/tmp# lsmod
ahci                   26415  0 
async_memcpy            1961  1 raid456
async_pq                5947  1 raid456
async_raid6_recov       2228  1 raid456
async_tx                2849  5 raid456,async_raid6_recov,async_pq,async_xor,async_memcpy
async_xor               4407  2 raid456,async_pq
crc_ccitt               1297  1 ppp_async
dm_log                  9874  2 dm_mirror,dm_region_hash
dm_mirror              14510  0 
dm_region_hash          7997  1 dm_mirror
gre                     4441  2 pptp,ip_gre
ip_gre                  8982  0 
ip_tunnel              14210  1 ip_gre
ip6_udp_tunnel          1725  1 l2tp_core
jnl                    35828  1 ufsd
l2tp_core              23429  2 l2tp_ppp,l2tp_netlink
l2tp_netlink            8561  1 l2tp_ppp
l2tp_ppp               19267  0 
linear                  4035  0 
mali_kbase            324526 17 
md_mod                125231  6 multipath,raid456,raid10,raid1,raid0,linear
multipath               6906  0 
ppp_async               8039  0 
pppoe                  12428  0 
pptp                   15154  0 
r8168                 472958  0 
raid0                  10990  0 
raid1                  28787  0 
raid10                 38600  0 
raid456                86763  0 
rtk_btusb              50013  0 
udp_tunnel              1842  1 l2tp_core
ufsd                  698755  0 
davicom88 commented 4 years ago

could be a firewall issue?

jjm2473 commented 4 years ago

In Z9S:

root@Z9S:~# lsmod
8822bs               3366638  0 
ahci                   27791  0 
async_memcpy            1961  1 raid456
async_pq                5931  1 raid456
async_raid6_recov       2236  1 raid456
async_tx                2841  5 raid456,async_raid6_recov,async_pq,async_xor,async_memcpy
async_xor               4439  2 raid456,async_pq
crc_ccitt               1289  1 ppp_async
cryptodev              41014  0 
dm_log                  9866  2 dm_mirror,dm_region_hash
dm_mirror              14502  0 
dm_region_hash          7989  1 dm_mirror
gre                     4433  2 pptp,ip_gre
ip_gre                  8982  0 
ip_tunnel              14194  1 ip_gre
ip6_udp_tunnel          1709  1 l2tp_core
jnl                    35868  1 ufsd
l2tp_core              23477  2 l2tp_ppp,l2tp_netlink
l2tp_netlink            8601  1 l2tp_ppp
l2tp_ppp               19203  0 
linear                  4027  0 
mali_kbase            347132 25 
md_mod                125319  6 multipath,raid456,raid10,raid1,raid0,linear
multipath               6930  0 
nfsd                   99743 11 
ppp_async               7983  0 
pppoe                  12420  0 
pptp                   15202  0 
r8168                 474146  0 
raid0                  10982  0 
raid1                  28787  0 
raid10                 38648  0 
raid456                87082  0 
raid6_pq               88197  3 raid456,async_raid6_recov,async_pq
rtk_btusb              51331  0 
rtk_sdmmc              34379  0 
udp_tunnel              1842  1 l2tp_core
ufsd                  698683  1 
xor                     7236  1 async_xor

It has a module named nfsd.

run modprobe /lib/modules/4.1.35-04005-g6c2818e-dirty/nfsd.ko in openwrt and see what happen

davicom88 commented 4 years ago
root@OpenWrt:~# modprobe /lib/modules/4.1.35-04005-g6c2818e-dirty/nfsd.ko
failed to find a module named nfsd

so it's a damned missing module

davicom88 commented 4 years ago

what can I do? or maybe is there nothing I can do :) :) ?

jjm2473 commented 4 years ago

try insmod /lib/modules/4.1.35-04005-g6c2818e-dirty/nfsd.ko

davicom88 commented 4 years ago
root@OpenWrt:~# insmod /lib/modules/4.1.35-04005-g6c2818e-dirty/nfsd.ko
Failed to find nfsd. Maybe it is a built in module ?
jjm2473 commented 4 years ago

Is /lib/modules/4.1.35-04005-g6c2818e-dirty exists? run ls -l /lib/modules/

davicom88 commented 4 years ago
root@OpenWrt:~# ls -l /lib/modules/
drwxr-xr-x    2 root     root           921 Aug 29 04:14 4.1.17-g9100299-dirty
davicom88 commented 4 years ago
root@OpenWrt:/lib/modules/4.1.17-g9100299-dirty# ls
ahci.ko                   crc-ccitt.ko              ip_gre.ko                 l2tp_ppp.ko               modules.builtin.bin       modules.symbols.bin       raid0.ko                  ufsd.ko
async_memcpy.ko           dm-log.ko                 ip_tunnel.ko              linear.ko                 modules.dep               multipath.ko              raid1.ko                  ump.ko
async_pq.ko               dm-mirror.ko              jnl.ko                    mali_kbase.ko             modules.dep.bin           ppp_async.ko              raid10.ko                 ump_kernel_import_ion.ko
async_raid6_recov.ko      dm-region-hash.ko         kds.ko                    md-mod.ko                 modules.devname           pppoe.ko                  raid456.ko
async_tx.ko               gre.ko                    l2tp_core.ko              modules.alias             modules.softdep           pptp.ko                   rtk_btusb.ko
async_xor.ko              ip6_udp_tunnel.ko         l2tp_netlink.ko           modules.alias.bin         modules.symbols           r8168.ko                  udp_tunnel.ko
jjm2473 commented 4 years ago

Is your device Z10? What android version it running?

davicom88 commented 4 years ago

no mine is x10 rtd1295 android 6

jjm2473 commented 4 years ago

oh, maybe x10 doesn't have nfsd. try to run ls -l /proc/fs/ to see if it has nfsd

davicom88 commented 4 years ago
root@OpenWrt:~# ls -l /proc/fs
dr-xr-xr-x    2 root     root             0 Sep  2 15:52 cifs
dr-xr-xr-x    7 root     root             0 Sep  2 15:52 ext4
dr-xr-xr-x    2 root     root             0 Sep  2 15:52 fscache
dr-xr-xr-x    7 root     root             0 Sep  2 15:52 jbd2
dr-xr-xr-x    2 root     root             0 Sep  2 15:52 lockd
dr-xr-xr-x    2 root     root             0 Sep  2 15:52 nfsd
dr-xr-xr-x    2 root     root             0 Sep  2 15:52 nfsfs
dr-xr-xr-x    2 root     root             0 Sep  2 15:52 ufsd
dr-xr-xr-x    2 root     root             0 Sep  2 15:52 ufsd_jnl

nfsd there's

jjm2473 commented 4 years ago

That it should support nfsd.

davicom88 commented 4 years ago

Do I can install the missing module? sorry if this is a stupid question

jjm2473 commented 4 years ago

I try to mount NFS in docker with debian:

root@2bb956bb8fed:/# mount.nfs 192.168.31.250:/mnt/sataa2 /mnt -v 
mount.nfs: timeout set for Wed Sep  2 14:00:30 2020
mount.nfs: trying text-based options 'vers=4.2,addr=192.168.31.250,clientaddr=172.17.0.4'
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'vers=4.1,addr=192.168.31.250,clientaddr=172.17.0.4'
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'vers=4.0,addr=192.168.31.250,clientaddr=172.17.0.4'
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'addr=192.168.31.250'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.31.250 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.31.250 prog 100005 vers 3 prot UDP port 32780
mount.nfs: Protocol not supported

It failed.

I am not sure if the docker behind the NAT cause this error.

jjm2473 commented 4 years ago

The nfsd already built in kernel in x10, we don't need to install it.

davicom88 commented 4 years ago

but is it normal that I haven't active process on port 2049 that should be the nfs port?

user@server:~$ rpcinfo -p 192.168.1.125
   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
    100005    1   udp  32780  mountd
    100005    1   tcp  32780  mountd
    100005    2   udp  32780  mountd
    100005    2   tcp  32780  mountd
    100005    3   udp  32780  mountd
    100005    3   tcp  32780  mountd
    100024    1   udp  32778  status
    100024    1   tcp  32778  status
davicom88 commented 4 years ago
root@OpenWrt:/etc# rpcinfo
   program version netid     address                service    owner
    100000    4    tcp6      ::.0.111               -          superuser
    100000    3    tcp6      ::.0.111               -          superuser
    100000    4    udp6      ::.0.111               -          superuser
    100000    3    udp6      ::.0.111               -          superuser
    100000    4    tcp       0.0.0.0.0.111          -          superuser
    100000    3    tcp       0.0.0.0.0.111          -          superuser
    100000    2    tcp       0.0.0.0.0.111          -          superuser
    100000    4    udp       0.0.0.0.0.111          -          superuser
    100000    3    udp       0.0.0.0.0.111          -          superuser
    100000    2    udp       0.0.0.0.0.111          -          superuser
    100000    4    local     /var/run/rpcbind.sock  -          superuser
    100000    3    local     /var/run/rpcbind.sock  -          superuser
    100005    1    udp       0.0.0.0.128.12         -          superuser
    100005    1    tcp       0.0.0.0.128.12         -          superuser
    100005    1    udp6      ::.128.12              -          superuser
    100005    1    tcp6      ::.128.12              -          superuser
    100005    2    udp       0.0.0.0.128.12         -          superuser
    100005    2    tcp       0.0.0.0.128.12         -          superuser
    100005    2    udp6      ::.128.12              -          superuser
    100005    2    tcp6      ::.128.12              -          superuser
    100005    3    udp       0.0.0.0.128.12         -          superuser
    100005    3    tcp       0.0.0.0.128.12         -          superuser
    100005    3    udp6      ::.128.12              -          superuser
    100005    3    tcp6      ::.128.12              -          superuser
    100024    1    udp       0.0.0.0.128.10         -          65536
    100024    1    tcp       0.0.0.0.128.10         -          65536
    100024    1    udp6      ::.128.10              -          65536
    100024    1    tcp6      ::.128.10              -          65536
jjm2473 commented 4 years ago

Port 2049 should be listened by kernel.

root@Z9S:~# netstat -anp |grep 2049
tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN      -
tcp        0      0 192.168.31.250:2049     192.168.31.102:63917    ESTABLISHED -
tcp        0      0 :::2049                 :::*                    LISTEN      -
davicom88 commented 4 years ago

for me it doesn't

jjm2473 commented 4 years ago

try mount -t nfs4 192.168.31.250:/mnt/sataa2 /mnt -o vers=3, sussed in debian in docker.

jjm2473 commented 4 years ago

can you run nfsstat -s in x10 ?

davicom88 commented 4 years ago
user@server:~$ sudo mount -t nfs4 192.168.1.125:/mnt/sda1 /home/user/Desktop/NFS_shares/x10 -o vers=3
[sudo] password for user: 
mount.nfs4: access denied by server while mounting 192.168.1.125:/mnt/sda1
davicom88 commented 4 years ago
root@OpenWrt:/etc# nfsstat -s
Error: No Server Stats (/proc/net/rpc/nfsd: No such file or directory).
jjm2473 commented 4 years ago

try mount | grep nfsd. I my case:

root@Z9S:~# mount | grep nfsd
nfsd on /proc/fs/nfsd type nfsd (rw,relatime)
jjm2473 commented 4 years ago

if not mounted, try mount -t nfsd nfsd /proc/fs/nfsd -o rw,relatime

davicom88 commented 4 years ago
root@OpenWrt:/etc# mount -t nfsd nfsd /proc/fs/nfsd -o rw,relatime
mount: /proc/fs/nfsd: unknown filesystem type 'nfsd'.
jjm2473 commented 4 years ago

ok, try cat /proc/filesystems

davicom88 commented 4 years ago
root@OpenWrt:/etc# cat /proc/filesystems
nodev   sysfs
nodev   rootfs
nodev   ramfs
nodev   bdev
nodev   proc
nodev   cpuset
nodev   cgroup
nodev   tmpfs
nodev   devtmpfs
nodev   configfs
nodev   debugfs
nodev   tracefs
nodev   securityfs
nodev   sockfs
nodev   pipefs
nodev   rpc_pipefs
nodev   devpts
    ext3
    ext2
    ext4
    cramfs
    squashfs
    vfat
    msdos
    iso9660
nodev   ecryptfs
nodev   nfs
nodev   nfs4
nodev   cifs
    fuseblk
nodev   fuse
nodev   fusectl
nodev   overlay
    udf
nodev   selinuxfs
    btrfs
    ufsd
nodev   functionfs
jjm2473 commented 4 years ago

It seems like the kernel doesn't support nfsd.

There is some userspace NFS implements: https://unix.stackexchange.com/questions/45899/why-is-linux-nfs-server-implemented-in-the-kernel-as-opposed-to-userspace

Is original x10 openwrt supports NFS server?

davicom88 commented 4 years ago

No It is not original supported but I was hoping the update should work

Il mer 2 set 2020, 16:58 练亮斌 notifications@github.com ha scritto:

It seems like the kernel doesn't support nfsd.

There is some userspace NFS implements:

https://unix.stackexchange.com/questions/45899/why-is-linux-nfs-server-implemented-in-the-kernel-as-opposed-to-userspace

Is original x10 openwrt supports NFS server?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jjm2473/rtd1295-openwrt18-porting/issues/22#issuecomment-685792377, or unsubscribe https://github.com/notifications/unsubscribe-auth/APSQP2TSJTOLSSDL4AQDFY3SDZMP3ANCNFSM4QS2WTQQ .

jjm2473 commented 4 years ago

The kernel of x10 or other devices is not open source, so I can only use original kernel and it's kmods, can not add new kernel features.

If we want nfs server in x10, we can only port userspace NFS server to x10.

davicom88 commented 4 years ago

sorry for my little comprehension: what does it mean userspace? In other words do we have no chance?