How to setup nfs-kernel-server?

There is no reason I know of to enable writing to lost&found from outside the OS itself.

The Backup directory …
Would it hurt anything if it’s permissions were also changed?
It is writable using SAMBA so there is likely no reason it should not be writable using NFS.

Creating other directories … I expect anyone creating a new directory will manually change its permissions to what they desire, so I doubt there is any reason to change defaults for the creation process.

CoreELEC:~ # mkdir /storage/test-dir

provides

CoreELEC:~ # ls -l /storage | grep test
drwxr-xr-x    2 root     root          4096 Aug  5 09:50 test-dir

So a simple chmod on it should suffice

CoreELEC:~ # chmod -R 777 /storage/test-dir
CoreELEC:~ # ls -l /storage | grep test
drwxrwxrwx    2 root     root          4096 Aug  5 09:50 test-dir

I think it is reasonable to expect users to do this much manually and of course their chosen permissions survive reboots etc.
(added those commands for reader info)

Thanks again @anon88919003.

Samba is running as root user and thats why there is no issue, if you connect to NFS as root you would also have no problem writing to any of the directories.

I got a Mecool KI Pro and did a clean install but couldn’t get nfs-server working no matter what I tried.

It seems portmap was moved to http://bin.entware.net/aarch64-k3.10/archive/ so the package can’t be installed anymore. Luckily I had a backup of the .opt folder from my Meccol M8S Pro+ and all is working now.

Could someone try with a clean Entware install if nfs-kernel works?

I finally got it working:

Go to https://forum.keenetic.net/topic/355-ядерный-nfs-сервер-на-кинетике/ and replace /opt/etc/init.d/S57nfs-kernel-server with the contents of the S20nfsd file posted there.

Its not worth it to use NFS over CIFS, even in pure Linux environments.

The complexity with port mappings and rpcbind, as you see in this thread, and also the “process is stuck in D state since network issue with nfs mount happened”.

If you just run a samba server, have it listen on 1 port only, and it has better performance than NFS, yet will never stuck your processes.

This guidance no longer works, can someone please check what steps are broken. Even the last but one instruction to modify S57nfs-kernel-server doesn’t help.

This is especially important given that we are now recommending people use NFS over SMB.

Opensuse has gone out of its way to break SAMBA functionality yet again and there is no adequate guidance on how to get it working again - so I have lost networking between my Opensuse computer and Coreelec (again). Their own YAST2 setup tools are broken.

Networking on Linux systems is a right royal pain in the arse.

Shoog

Has this been dropped from recent releases?

Me too. It seems NFS not working. Installed went well but can’t find NFS server. I did configure per above instructions.

Having done a new install of CE 9.0 I attempted to set up NFS share from CE.
In truth I have forgotten how I successfully set it up in the first instance, so this is probably an incomplete method which explains why I failed this morning.

In any case maybe someone will point out the reason for my failure

Create NFS server and share directories

    installentware

Disable rpcbind

    systemctl mask rpcbind.socket
    systemctl mask rpcbind.service

Edit /opt/etc/init.d/*nfs-kernel-server by changing these two

    rpc.nfsd --no-nfs-version 4 --no-tcp 1
    rpc.mountd --no-nfs-version 4 --no-tcp

to

    rpc.nfsd --no-nfs-version 4 1
    rpc.mountd --no-nfs-version 4

Put entries in /opt/etc/exports for the directories to be shared.

  cat /opt/etc/exports
  /mnt        *(ro,all_squash,insecure,no_subtree_check,sync)
  /storage/music 192.168.1.0/8(rw,no_all_squash,async,secure,no_subtree_check)

  modprobe nfsd

Where should that “modprobe nfsd” command be entered to ensure it is launched at each boot?
What is the preferred file?
This is probably the reason my set up is not yet working?

Try with echo nfsd >/storage/.config/modules-load.d/nfsd.conf

1 Like

Thanks.

Unfortunately I still have a problem when trying to mount the share in PCLinuxOS via Dolphin filemanager

An error occurred while accessing ‘storage/music on 192.168.1.6’, the system responded: mount.nfs: requested NFS version or transport protocol is not supported

and from command line

.# mount -a
mount.nfs: requested NFS version or transport protocol is not supported

Is this likely to be due to a difference in the NFS versions between PC and CE?

Greetings. Has anyone managed to raise the nfs server on ng 9.2 … 0227? I wanted to raise the server on AM6 (922x) for the pioneer-140 bd player. I tried all the perversions found on the network, but it does not work. For old guides, it requires portmap, which is not in the entware repo. It’s a shame …

Working 29.2.2020.

install kernel nfs server

opkg install nfs-kernel-server

modify exports file /opt/etc/exports (not sure how secure this is)

/media *(rw,no_root_squash,insecure,no_subtree_check,fsid=0,crossmnt)

modify start script /opt/etc/init.d/S57nfs-kernel-server (just some small modifications)

remove this 4 lines checking for portmap

if [ -z "`pidof portmap`" ] ; then
        echo 'Error: portmap not started'
        exit 1
fi

remove --no-tcp, add --udp and increase number of threads from 1 to 8

    rpc.nfsd --no-nfs-version 4 --udp 8
    rpc.mountd --no-nfs-version 4

start nfs server

/opt/etc/init.d/S57nfs-kernel-server start

mount share (only for test)

mkdir /storage/test_nfs_mount
mount -t nfs THIS_DEVICE_IP:/media /storage/test_nfs_mount
3 Likes

I am completely lost with understanding the 2 lines for mounting a share. I have a drive attached to my N2 that i want to share, It shows in file manager as /var/media/TOSHIBA_EXT.

Could you help a thicky out and tell me what I need to set in order to see it and use it. I did say that there was far too much SSHing for my skills. To set my skills in context, I did manage to edit the files in your quide once I’d looked up that the command was nano!

You need to set the path in /opt/etc/exports file

/var/media/TOSHIBA_EXT *(rw,no_root_squash,insecure,no_subtree_check,fsid=0)

The last 2 lines (mkdir and mount) are only for a test. You mount NFS on some other device.

Should be so simple then. The only thing is that the drive is labelled TOSHIBA EXT with a space. I think thats messing it up. I’ve tried with space / and _ in /opt/etc/exports but the best I get is that add sourcesearching NFS in file manager on my other CoreELEC box sees the IP of my N2 and offers up the drive but I cannot get to the contents.

I suffered with this when setting a mount for smb. I don’t suppose you know how to fix it other than by changing the label to TOSHIBA?

I found that there is an “escape sequence” \040 to ignore paces. TOSHIBA\040EXT did the trick. I am jubilant. Thanks so much for your help.

2 Likes

friends, yesterday I didn’t have time to write here about the results of my research … I adjusted the nfs server on AM6 (ugoos) from CE to cd-card. Actually, you need the correct script and the correct exports file for normal operation. Above, the comrade vpeter has a very useful instruction. Now my second box from ugoos x3pro with its nfs-client on android communicates perfectly with AM6. However, I have not been able to make friends of my bd player with this server yet. When you start the network search on the player, the player finds the AM6 resource, but it is empty! At the same time, if you raise Hanewin-server on Win, then its resource is perfectly shared and plays the content. Perhaps you need to change the export settings, tried to change it to default - there is no difference. Could it be the case with certain tcp / utp ports? I apologize for my English (google translit)

Probably nfs-kernel-server forgot to enable udp for nfs …


probably because of the difficulties of translation, we do not understand each other correctly. I did not find confirmation that nfs works with utp protocol. Nowhere in the files did I meet utp for port 2049. Hanewin server uses tcp and udp on port 2049