Skip to content
This repository has been archived by the owner on Dec 28, 2020. It is now read-only.

[SOLVED]nfs server on rtd1295 #22

Open
davicom88 opened this issue Sep 2, 2020 · 261 comments
Open

[SOLVED]nfs server on rtd1295 #22

davicom88 opened this issue Sep 2, 2020 · 261 comments

Comments

@davicom88
Copy link

davicom88 commented Sep 2, 2020

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
Copy link
Author

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
Copy link
Owner

jjm2473 commented Sep 2, 2020

Can you check is portmap running?

PS: I recommend you to install my new firmware

@davicom88
Copy link
Author

yes I have just your last firmware

@davicom88
Copy link
Author

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
Copy link
Owner

jjm2473 commented Sep 2, 2020

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
Copy link
Owner

jjm2473 commented Sep 2, 2020

portmap was replaced by rpcbind in new firmware

@jjm2473
Copy link
Owner

jjm2473 commented Sep 2, 2020

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
Copy link
Author

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
Copy link
Author

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

@jjm2473
Copy link
Owner

jjm2473 commented Sep 2, 2020

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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

@davicom88
Copy link
Author

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
Copy link
Owner

jjm2473 commented Sep 2, 2020

can you run lsmod in Openwrt?

@davicom88
Copy link
Author

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
Copy link
Author

could be a firewall issue?

@jjm2473
Copy link
Owner

jjm2473 commented Sep 2, 2020

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
Copy link
Author

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
Copy link
Author

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

@jjm2473
Copy link
Owner

jjm2473 commented Sep 2, 2020

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

@davicom88
Copy link
Author

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
Copy link
Owner

jjm2473 commented Sep 2, 2020

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

@davicom88
Copy link
Author

root@OpenWrt:~# ls -l /lib/modules/
drwxr-xr-x    2 root     root           921 Aug 29 04:14 4.1.17-g9100299-dirty

@davicom88
Copy link
Author

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
Copy link
Owner

jjm2473 commented Sep 2, 2020

Is your device Z10? What android version it running?

@davicom88
Copy link
Author

no mine is x10 rtd1295 android 6

@jjm2473
Copy link
Owner

jjm2473 commented Sep 2, 2020

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

@davicom88
Copy link
Author

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
Copy link
Owner

jjm2473 commented Sep 2, 2020

That it should support nfsd.

@davicom88
Copy link
Author

ok I did modify you recommended, do I have reboot first to remount on linux?

@jjm2473
Copy link
Owner

jjm2473 commented Sep 5, 2020

don't need reboot.

just umount and mount

@davicom88
Copy link
Author

same problem, it seems that unfs3 just ignores export file and it's configuration

davicom@server:~/Desktop/NFS_shares/x10$ sudo mkdir try
[sudo] password for davicom: 
mkdir: cannot create directory ‘try’: Read-only file system

http://www.imagestime.com/imageshow.php/1189100_tojim1.jpg.html

@davicom88
Copy link
Author

maybe I can try to create on linux a group 1023 media_rw and add to it root user, it should be safe?

@jjm2473
Copy link
Owner

jjm2473 commented Sep 5, 2020

can you check if unfsd running as root now?

@davicom88
Copy link
Author

root@OpenWrt:~# id
uid=0(root) gid=0(root) groups=1014(aid_dhcp),1015(aid_sdcard_rw),1020(aid_mdnsr),1023(media_rw),1028(aid_sdcard_r),2000(aid_shell),2001,3001,3002,3003(aid_inet),3004(aid_net_raw),3005(aid_net_admin),3006(aid_net_bw_stats),3007,3009(aid_readproc)
root@OpenWrt:~# ps |grep unfsd
  482 1000      6136 S    /usr/sbin/unfsd -d
 2211 root      1204 S    grep unfsd

@davicom88
Copy link
Author

maybe we have to create user 1000 on openwrt?

@davicom88
Copy link
Author

I really don't understand, I'll post you a correct configuration of another nfs share on another server...

@jjm2473
Copy link
Owner

jjm2473 commented Sep 5, 2020

I don't think it will work.

I saw you image, you have wrong usage with umount.

umount just take directory as parameter, so just run umount /home/davicom/Desktop/NFS_shares/x10

@jjm2473
Copy link
Owner

jjm2473 commented Sep 5, 2020

after mount, run mount | grep nfs to check if it was mounted as rw

@davicom88
Copy link
Author

davicom@server:~$ mount | grep nfs
nfsd on /proc/fs/nfsd type nfsd (rw,relatime)
192.168.1.22:/media/hdd on /home/davicom/Desktop/NFS_shares/latest type nfs (rw,relatime,vers=3,rsize=65536,wsize=65536,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.22,mountvers=3,mountport=36050,mountproto=udp,local_lock=none,addr=192.168.1.22)
192.168.1.111:/mnt/sda1 on /home/davicom/Desktop/NFS_shares/x10 type nfs (rw,relatime,vers=3,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.111,mountvers=3,mountport=2049,mountproto=udp,local_lock=none,addr=192.168.1.111)

here is working configuration of nfs server

from linux client

davicom@server:~$ sudo mount -t nfs 192.168.1.22:/media/hdd /home/davicom/Desktop/NFS_shares/latest
[sudo] password for davicom: 
davicom@server:~$ ls -l /media/hdd /home/davicom/Desktop/NFS_shares/
ls: cannot access '/media/hdd': No such file or directory
/home/davicom/Desktop/NFS_shares/:
total 12
-rw-r--r--  1 root root   86 May 15 23:12 montaggi_NFS
drwxr-xr-x 13 root root 4096 Sep  4 09:59 latest
drwxrwxrwx  7 root 1023 4096 Sep  4 21:16 x10
davicom@server:~$ ls -l /media/hdd /home/davicom/Desktop/NFS_shares/latest
ls: cannot access '/media/hdd': No such file or directory
/home/davicom/Desktop/NFS_shares/latest:
total 60400
drwxr-xr-x 12 root root     4096 Aug 30 21:31 film
drwx------  2 root root    16384 May 20 16:22 lost+found
drwxr-xr-x  3 root root     4096 Jul 13 15:20 movie
drwxr-xr-x 43 root root     4096 Sep  1 09:37 serietv

from latest server

root@latest:~# vi /ect/exports
/media/hdd/ 192.168.1.55/255.255.255.0(rw,no_root_squash,async,no_subtree_check)
root@latest:~# ls -l /mnt
lrwxrwxrwx    1 root     root             5 Apr 18 20:11 /mnt -> media
root@latest:~# ls -l /mnt/hdd
drwxr-xr-x    2 root     root          4096 Aug  9 02:07 backup
drwxr-xr-x    4 root     root          4096 Aug 23 11:42 documentari
drwxr-xr-x   12 root     root          4096 Aug 30 21:31 film
drwx------    2 root     root         16384 May 20 16:22 lost+found
drwxr-xr-x    3 root     root          4096 Jul 13 15:20 movie
drwxr-xr-x   43 root     root          4096 Sep  1 09:37 serietv
drwxr-xr-x   14 root     root          4096 Aug 27 19:47 temp
root@latest:~# ls -l /media
drwxr-xr-x    2 root     root             0 Aug 30 09:57 autofs
drwxr-xr-x   13 root     root          4096 Sep  4 09:59 hdd
drwxr-xr-x    2 root     root            40 Sep  2 14:44 try

@davicom88
Copy link
Author

o.t. transfer copy folder 42gb speed --> 79.6444MB/s

@davicom88
Copy link
Author

When I restart openwrt and nfs is not mounted in client it's so:


root@OpenWrt:~# ps |grep unfsd
  487 root      6136 S    /usr/sbin/unfsd -d
 2198 root      1204 S    grep unfsd

@davicom88
Copy link
Author

I enabled unfs -s (single mode) now the two processes are under root both

root@OpenWrt:~# ps |grep unfsd
 2225 root      6064 S    unfsd -s
 2252 root      1204 S    grep unfsd

But from client problem remains

@davicom88
Copy link
Author

SOLVED! the credit is all yours and the great job you did with this build. You have made x9s / X10 totally versatile devices! I warmly invite you to propose your work to zidoo! And let me know how I can repay! thanks for all your support and effort jim

@davicom88 davicom88 changed the title nfs server [SOLVED]nfs server Sep 5, 2020
@davicom88 davicom88 changed the title [SOLVED]nfs server [SOLVED]nfs server on rtd1295 Sep 5, 2020
@jjm2473
Copy link
Owner

jjm2473 commented Sep 5, 2020

should be notice that, single user mode will always use root to access files

@davicom88
Copy link
Author

hi jim, no it's working default mode


root@OpenWrt:~# ps |grep unfsd
 2301 1000      6144 S    /usr/sbin/unfsd -d
 2434 root      1204 S    grep unfsd

@jjm2473
Copy link
Owner

jjm2473 commented Sep 5, 2020

did you change command in /etc/init.d/nfsd? It should be unfsd -d -s, without -d, procd will not handle unfsd process.

@davicom88
Copy link
Author

davicom88 commented Sep 5, 2020

no i didn't, i I try a reboot to see if it still works

@davicom88
Copy link
Author

After reboot it's still working

Unmounted:

root@OpenWrt:~# ps |grep unfsd
  487 root      6136 S    /usr/sbin/unfsd -d
 2208 root      1204 S    grep unfsd

Mounted:

root@OpenWrt:~# ps |grep unfsd
  487 1000      6136 S    /usr/sbin/unfsd -d
 2210 root      1204 S    grep unfsd

@jjm2473
Copy link
Owner

jjm2473 commented Sep 5, 2020

can write file on client side?

@davicom88
Copy link
Author

davicom88 commented Sep 5, 2020

yes, now I'm setting correct permission to 755 and see if is it works: it should be accept write only by opening the mount as superuser, sorry again for my bad english

@jjm2473
Copy link
Owner

jjm2473 commented Sep 5, 2020

so it's working without single user mode?

@davicom88
Copy link
Author

yes it's working flawlessy

@davicom88
Copy link
Author

yes, before when I mounted on, with single user mode, the first process remained owned by root, now is uid 1000

not mounted
root@OpenWrt:~# ps |grep unfsd
  482 root      6132 S    /usr/sbin/unfsd -d
 2230 root      1204 S    grep unfsd
mounted
root@OpenWrt:~# ps |grep unfsd
  482 1000      6136 S    /usr/sbin/unfsd -d
 2240 root      1204 S    grep unfsd

@jjm2473
Copy link
Owner

jjm2473 commented Sep 5, 2020

maybe you can post NFS option and mount command here, let others know how to do that.

@davicom88
Copy link
Author

yes for sure

@davicom88
Copy link
Author

davicom88 commented Sep 5, 2020

Before mounting Luci NFS export configuration:

/mnt/sda1/ 192.168.1.0/24(your desired network or single IP) rw,no_root_squash,async,insceure,no_subtree_check

Before mounting, server-side/openwrt has to show:

root@OpenWrt:~# ps |grep unfsd
  482 root      6132 S    /usr/sbin/unfsd -d
 2230 root      1204 S    grep unfsd

Before mounting, client-side has to show:

user@server:~$ showmount -e OpenWrt_IP
Export list for OpenWrt_IP:
/mnt/sda1/ 192.168.1.0/24 (your desired network or single IP)

Mounting:
sudo mount -t nfs OpenWrt_IP:/mnt/sda1 /mnt/your_preferred_folder

After mounting, server-side/OpenWrt has to show:

root@OpenWrt:~# ps |grep unfsd
  482 1000      6136 S    /usr/sbin/unfsd -d      uuid=1000 could be different
 2240 root      1204 S    grep unfsd

Permissions:

basing myself on a normal nfs share already working I set on openwrt WITH UNMOUNTED THE NFS SHARE ON CLIENT:

root@OpenWrt:~# chmod 777 /mnt
root@OpenWrt:~# chmod -R 755 /mnt/sda1

in this way you could mount normally NFS share but you couldn't write as if you aren't in superuser mode

forgive poor English in advance

all credits goes to @jjm2473 jim2473

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants