openwrt / packages

Community maintained packages for OpenWrt. Documentation for submitting pull requests is in CONTRIBUTING.md
GNU General Public License v2.0
4.04k stars 3.5k forks source link

nfs-kernel-server: /mnt does not support NFS export #15633

Open blairfancy opened 3 years ago

blairfancy commented 3 years ago

Maintainer: @neheb
Environment: Opnwrt 21.02.0-rc1 on WRT1200AC router clean new install

Description: after opkg install nfs-kernel-server got error :

point 1
point 2
point 3
exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:/mnt".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x

exportfs: /mnt does not support NFS export

i m also not able to translate my old 19.07 exports file into new openwrt version:

/mnt/sda3    192.168.25.0/24(rw,all_squash,no_subtree_check,insecure,anonuid=0,anongid=0) 
/mnt/sda3/protected/osmc    192.168.25.20(rw,no_root_squash,sync,no_subtree_check,insecure)
neheb commented 3 years ago

Strange. I updated nfs-kernel-server so that it compiles with musl 1.2.x. Can you try mounting with -v ?

GitHuhl commented 3 years ago

+1, also having this issue (does not support NFS export, in addition to your reported "no_subtree_check specified" one, but I'm completely new to NFS, so there's always a possibility that it's me doing something wrong.

I'm using OpenWrt 21.02.0-rc3, r16172-2aba3e9784 on a Raspberry Pi 4b. So far I've been unable to export any mounted directories. I get the same "does not support NFS export" error, dmesg output reports that I'm trying to mount F2FS even though I'm specifying mount -t ext4 for example (yes I have the FS drivers installed, yes I've rebooted)

I'm glad to see I'm not alone. I'm actually unable to mount even a decrypted LUKS container at all on OpenWrt's rc3 that I'm using (I end up with the same dmesg errors as when starting/reloading nfsd)

ricsif commented 3 years ago

+1 On a D-Link DWR-118 A2. OpenWrt 21.02.0-rc3, r16172-2aba3e9784 For me mounting /tmp neither possible.

blairfancy commented 3 years ago

a work around is to export a folder in /tmp/export/ and make a bind mount

mount --bind /mnt/sda3 /tmp/export/mnt/sda3

and adapt export file accordingly:

/tmp/export     192.168.25.0/24(fsid=0,ro,all_squash,insecure,sync,no_subtree_check) 192.168.50.0/24(fsid=0,ro,all_squash,insecure,sync,no_subtree_check)
/tmp/export/mnt/sda3    192.168.25.0/24(fsid=1,rw,all_squash,no_subtree_check,insecure,anonuid=0,anongid=0) 

the trick is to add in /etc/init.d/fastb or elsewhere:

/bin/mkdir -p /tmp/export/mnt/sda3
/bin/mount --bind /mnt/sda3 /tmp/export/mnt/sda3

to automatically bind before nsfd start

ricsif commented 3 years ago

@blairfancy thanks a lot, it did the trick. Just for the record, both rows have to be in the export file (be aware, the first one is duplicated).

fpauser commented 3 years ago

Any news on this? Just flashed a linksys wrt3200acm with OpenWrt 21.02.1 r16325-88151b8303 and also get this error. The workaround posted by @blairfancy works - but feels a bit hacky.

neheb commented 3 years ago

@danwrt has done some work in master. Maybe it should be backported.

DavidASmith072 commented 3 years ago

I am experiencing this issue also with OpenWRT version 21.02.1 as well as version 17.07.7 on my Linksys WRT3200ACM Router.

dim6003 commented 2 years ago

idem on TP-Link Archer C2600 with OpenWrt 19.07.7 r11306-c4a6851c72 / LuCI openwrt-19.07 branch git-22.045.73925-36e5c1c, kernel 4.14.221. Not tested (yet?) @blairfancy's trick.

Edit : exactly the same status after upgrading to OpenWrt 21.02.1 r16325-88151b8303 / LuCI openwrt-21.02 branch git-22.025.79177-4ec18ec (kernel 5.4.154).

Tonghaofeng commented 2 years ago

still can not export nfs in external hard drive

Newifi-D2

Architecture | MediaTek MT7621 ver:1 eco:3 Target Platform | ramips/mt7621 Firmware Version | OpenWrt 21.02.1 r16325-88151b8303 / LuCI openwrt-21.02 branch git-22.083.69138-0a0ce2a Kernel Version | 5.4.154

AleXSR700 commented 1 year ago

Is there a fix or workaround for this? I can share subdirectories of mnt like sda1 but not the folder /mnt/ itself.

salim-b commented 1 year ago

Is there a fix or workaround for this?

Yes. See this post above. tl;dr: The NFSv4 root directory (the one that gets fsid=0 in /etc/exports) mustn't be on the OverlayFS.

I can share subdirectories of mnt like sda1 but not the folder /mnt/ itself.

You won't be able to export the whole /mnt dir since that one is part of the OverlayFS.

AleXSR700 commented 1 year ago

How come that mnt and everything else can be shared with SFTP/SSH or Samba?