# NFSD: Setting version failed: errno 22 (SOLVED)

## MrUlterior

Greetings,

I can no longer start my NFS server, which is rather problematic   :Mad: 

Before I file a bug report, I wondered if anybody had encountered this issue, you can see the error returned when I start nfsd here:

```
# /etc/init.d/nfs restart

 * Stopping NFS mountd ...                                                                                                                                                             [ ok ]

 * Stopping NFS daemon ...                                                                                                                                                             [ ok ]

 * Unexporting NFS directories ...                                                                                                                                                     [ ok ]

 * Exporting NFS directories ...                                                                                                                                                       [ ok ]

 * Starting NFS mountd ...                                                                                                                                                             [ ok ]

 * Starting NFS daemon ...

rpc.nfsd: Checking netconfig for visible protocols.

rpc.nfsd: Enabling inet udp.

rpc.nfsd: Enabling inet tcp.

rpc.nfsd: Enabling inet6 udp.

rpc.nfsd: Enabling inet6 tcp.

rpc.nfsd: knfsd is currently down

rpc.nfsd: Writing version string to kernel: +4.1 -4.2 -2 +3 +4 

rpc.nfsd: Setting version failed: errno 22 (Invalid argument)

rpc.nfsd: Creating inet TCP socket.

rpc.nfsd: Creating inet UDP socket.                                                                                                                                                    [ ok ]

 * Starting NFS smnotify ...          

```

net-fs/nfs-utils-1.2.9-r3 is built with these USE flags "libmount nfsidmap nfsv4 nfsv41 tcpd uuid -caps -ipv6 -kerberos -nfsdcld -selinux" (I upgraded to this version from stable net-fs/nfs-utils-1.2.9 version to check if this fixed the problem, no change)

```
# cat /etc/conf.d/nfs

# /etc/conf.d/nfs

# If you wish to set the port numbers for lockd,

# please see /etc/sysctl.conf

# Optional services to include in default `/etc/init.d/nfs start`

# For NFSv4 users, you'll want to add "rpc.idmapd" here.

NFS_NEEDED_SERVICES="rpc.idmapd"

# Number of servers to be started up by default

OPTS_RPC_NFSD="-d"

# Options to pass to rpc.mountd

# ex. OPTS_RPC_MOUNTD="-p 32767"

OPTS_RPC_MOUNTD=""

# Options to pass to rpc.statd

# ex. OPTS_RPC_STATD="-p 32765 -o 32766"

OPTS_RPC_STATD=""

# Options to pass to rpc.idmapd

OPTS_RPC_IDMAPD=""

# Options to pass to rpc.gssd

OPTS_RPC_GSSD=""

# Options to pass to rpc.svcgssd

OPTS_RPC_SVCGSSD=""

# Options to pass to rpc.rquotad (requires sys-fs/quota)

OPTS_RPC_RQUOTAD=""

# Timeout (in seconds) for exportfs

EXPORTFS_TIMEOUT=30

# Options to set in the nfsd filesystem (/proc/fs/nfsd/).

# Format is <option>=<value>.  Multiple options are allowed.

#OPTS_NFSD="nfsv4leasetime=30 max_block_size=4096"

```

```
# uname -a

Linux hub 3.10.25-gentoo-g5 #1 SMP Sun Feb 23 12:20:32 CET 2014 x86_64 AMD FX(tm)-8320 Eight-Core Processor AuthenticAMD GNU/Linux

```

(I was on gentoo-sources 3.10.7, I upgraded to 3.10.25 to check if this resolved the problem, it didn't ... )

```
# lsmod

Module                  Size  Used by

xt_conntrack            2953  2 

iptable_nat             2726  0 

nf_conntrack_ipv4      12352  3 

nf_defrag_ipv4          1219  1 nf_conntrack_ipv4

nf_nat_ipv4             3448  1 iptable_nat

nf_nat                 12109  2 nf_nat_ipv4,iptable_nat

zfs                   894821  4 

crc32_pclmul            2771  0 

crc32c_intel           13937  0 

ghash_clmulni_intel     4637  0 

pcspkr                  1907  0 

zunicode              319032  1 zfs

zcommon                30891  1 zfs

znvpair                41082  2 zfs,zcommon

zavl                    4485  1 zfs

vmw_vsock_vmci_transport    19514  0 

vsock                  23491  1 vmw_vsock_vmci_transport

vmw_vmci               48697  1 vmw_vsock_vmci_transport

spl                    53107  5 zfs,zavl,zunicode,zcommon,znvpair

serio_raw               4537  0 

k10temp                 2930  0 

fam15h_power            2636  0 

```

```
# zcat /proc/config.gz |egrep -i NFS

CONFIG_USB_FUNCTIONFS=m

# CONFIG_USB_FUNCTIONFS_ETH is not set

# CONFIG_USB_FUNCTIONFS_RNDIS is not set

CONFIG_USB_FUNCTIONFS_GENERIC=y

CONFIG_XENFS=y

CONFIG_XEN_COMPAT_XENFS=y

CONFIG_NFS_FS=y

CONFIG_NFS_V2=y

CONFIG_NFS_V3=y

CONFIG_NFS_V3_ACL=y

CONFIG_NFS_V4=y

CONFIG_NFS_SWAP=y

CONFIG_NFS_V4_1=y

CONFIG_PNFS_FILE_LAYOUT=m

CONFIG_PNFS_BLOCK=m

CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org"

CONFIG_ROOT_NFS=y

# CONFIG_NFS_FSCACHE is not set

# CONFIG_NFS_USE_LEGACY_DNS is not set

CONFIG_NFS_USE_KERNEL_DNS=y

CONFIG_NFSD=y

CONFIG_NFSD_V2_ACL=y

CONFIG_NFSD_V3=y

CONFIG_NFSD_V3_ACL=y

CONFIG_NFSD_V4=y

# CONFIG_NFSD_FAULT_INJECTION is not set

CONFIG_NFS_ACL_SUPPORT=y

CONFIG_NFS_COMMON=y

```

I've also tried all combinations of NFS protocols (4, 4.1, 3 and 2) and nothing changes this behavior.

When I try mount an exported directory remotely, this is what happens:

```
# mount /usr/portage 

mount.nfs: Connection timed out

```

```
Portage 2.2.7 (hardened/linux/amd64, gcc-4.6.3, glibc-2.15-r3, 3.10.25-gentoo-g5 x86_64)

=================================================================

System uname: Linux-3.10.25-gentoo-g5-x86_64-AMD_FX-tm-8320_Eight-Core_Processor-with-gentoo-2.2

KiB Mem:    16393840 total,  15580060 free

KiB Swap:   31233020 total,  31233020 free

Timestamp of tree: Sat, 22 Feb 2014 12:45:01 +0000

ld GNU ld (GNU Binutils) 2.23.2

distcc 3.1 x86_64-pc-linux-gnu [enabled]

app-shells/bash:          4.2_p45

dev-lang/python:          2.7.5-r3, 3.2.5-r2

dev-util/cmake:           2.8.10.2-r2

dev-util/pkgconfig:       0.28

sys-apps/baselayout:      2.2

sys-apps/openrc:          0.12.4

sys-apps/sandbox:         2.5

sys-devel/autoconf:       2.69

sys-devel/automake:       1.10.3, 1.12.6, 1.13.4

sys-devel/binutils:       2.23.2

sys-devel/gcc:            4.6.3, 4.7.3-r1

sys-devel/gcc-config:     1.7.3

sys-devel/libtool:        2.4-r1

sys-devel/make:           3.82-r4

sys-kernel/linux-headers: 3.6 (virtual/os-headers)

sys-libs/glibc:           2.15-r3

Repositories: gentoo x-portage

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="* -@EULA"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-O2 -pipe -march=athlon64"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/bind"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-O2 -pipe -march=athlon64"

DISTDIR="/usr/portage/distfiles"

FCFLAGS="-O2 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distcc distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"

FFLAGS="-O2 -pipe"

GENTOO_MIRRORS="http://distfiles.gentoo.org"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j20"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/root/portage"

SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"

USE="X acl acpi alsa amd64 berkdb bzip2 cli cracklib crypt cxx dri fuse gdbm gtk hardened iconv justify libkms loop-aes mmx modules multilib ncurses nls nptl openmp pam pax_kernel pcre python readline session sse sse2 ssl tcpd truetype udev unicode urandom usb xtpax xvfb zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc efi-64" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NGINX_MODULES_HTTP="access auth_basic autoindex browser charset empty_gif fastcgi gzip limit_conn limit_req map memcached proxy referer rewrite scgi split_clients ssi upstream_ip_hash userid uwsgi fancyindex flv mp4" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python3_2 python2_7" QEMU_SOFTMMU_TARGETS="i386 arm x86_64" QEMU_USER_TARGETS="i386 arm x86_64" RUBY_TARGETS="ruby19 ruby18" USERLAND="GNU" VIDEO_CARDS="dummy fbdev nouveau nv" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

```

Help!

----------

## MrUlterior

Welp, I'm an idiot, figured out the solution, on the server:

Changed /etc/exports to:

```
# /etc/exports: NFS file systems being exported.  See exports(5).

/nfs            10.99.0.0/24(fsid=0,rw,no_subtree_check)

/nfs/portage    10.99.0.0/24(rw,nohide,insecure,no_subtree_check)

```

Then:

```

# echo "/usr/portage            /nfs/portage    none        bind                            0 0" >> /etc/fstab

# mkdir -p /nfs/portage

# mount /nfs/portage

# exportfs -r

# /etc/init.d/nfs restart

```

And it works once more, from the client:

```
# mount -t nfs 10.99.0.2:/nfs/portage /usr/portage

# df -h

Filesystem              Size  Used Avail Use% Mounted on

/dev/sda3                16G  9.6G  5.4G  65% /

tmpfs                   395M  968K  394M   1% /run

udev                     10M     0   10M   0% /dev

shm                     2.0G     0  2.0G   0% /dev/shm

cgroup_root              10M     0   10M   0% /sys/fs/cgroup

none                    1.0G   92K  1.0G   1% /tmp

none                    2.0G     0  2.0G   0% /var/tmp

10.99.0.2:/nfs/portage  1.8T  4.2G  1.8T   1% /usr/portage

```

----------

