How to setup nfs-kernel-server?

Thanks for providing this section; appreciated!

Can anyone help with the correct instructions to set up the Entware nfs-kernel-server on CE?

I have the installation done without problems.
I have tried to set it up but have not succeeded … I get conflicting instructions for different devices/OSs so I most likely did something wrong.

I do see the server on the LAN when I look for NFS servers from within Kodi on client box, but no sign of a share being available (I did create one but might not have done so correctly or completely) so it seems I cannot connect to the server.

Running rc.unslung restart gives me

Error: portmap not started
 Starting portmap...              failed.

If anyone can assist I would appreciate it, thanks.

The test build you are running is not compatible because it is missing the NFSD kernel module, I have added it to future builds.

The rpcbind included with the system needs to be disabled first for portmap to work.

systemctl mask rpcbind.socket
systemctl mask rpcbind.service

then you need to modify the nfs service nano -w /opt/etc/init.d/*nfs-kernel-server and change the following 2 lines

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


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

Finally modify /opt/etc/exports for the directories you want to share, reboot and you are done.

1 Like

Thanks adamg … I look forward to the next devel release to set this up and test.

I have tested again using the instructions above and the devel release from ‘Computerbastler18’ CoreELEC-S905.arm-9.0-devel_01.08.2018.img doing a fresh install.

All went well (omitting my errors due to unfamiliarity with setting up NFS shares manually).
I created a share and successfully used it from my PCLinuxOS PC.


This raises a question which might be better asked elsewhere, but I am unsure …

Is it possible to alter the permissions on the media directories under /storage?
Directories such as music, videos, pictures etc are what I have in mind.

It appears to me that these directory permissions are set at each boot, and they exclude the possibility of writing to them using NFS.
There is no difficulty writing to them using SMB of course, but NFS obeys the Linux permissions …

drwxr-xr-x    2 root     root          1024 Aug  2 10:55 music

Thanks again for making NFS available, and for providing the instructions for set up.

Did you set the permissions in /etc/exports ?

With the exception of the directory name everything is the same as the working directory which I created for a test.
I can change the permissions on a media directory, but they are changed back on reboot.

What would avoid the problem - a work-around - is if I can run a script to change permissions prior to the NFS shares being made available or mounted.
All would then work for R/W.

I have no idea where it might be best to place that script so that it gets executed early enough.

What is the contents of your /opt/etc/exports

    CoreELEC:~ # cat /opt/etc/exports
    CoreELEC:~ # 

The first entry is the test one I set up and which works as expected.
The second only works, if I change the permissions of /storage/music before it is mounted.

Having changed permissions and attaching to the share it works but the permissions revert to default after a reboot.

Try the following build here, the problem has been fixed now, this is only for S905, you will have to wait for @Computerbastler18 if you need it for S912.

Thanks … I will try it soon and report back.
905 is fine as I am using a Tanix TX3 mini.

All directories except backup and lost&found now have open permissions and things work as expected.

Much appreciated!

you should be able to change permissions on lost+found, if you need any other directories changing then let me know

it’s a bit stupid really but it’s something that was carried over from the OpenELEC days

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


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 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ядерный-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.


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.