Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] NFS Server not working after systemd migration
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
ese002
Tux's lil' helper
Tux's lil' helper


Joined: 20 Sep 2006
Posts: 143

PostPosted: Tue Jan 21, 2014 11:27 pm    Post subject: Reply with quote

Nitro_146 wrote:
If by «edit your copy» you mean modify some file, I don't remember exactly. I have this issue for 2 month now and I have tried several fixes.

Should I backup my config file, unmerge nfsd (and some other package) and emerge it again ?


I meant: did you edit the service file: rpc-mountd.service? I'm running unmodified.

I'm not really sure which package this file comes from. It might have come with systemd.

If you have equery you can "equery --belongs /usr/lib64/systemd/system/rpc-mountd.service" and remerge whichever package it is.
Back to top
View user's profile Send private message
Nitro_146
Apprentice
Apprentice


Joined: 02 Mar 2005
Posts: 221
Location: Digne les bains, France

PostPosted: Tue Jan 21, 2014 11:44 pm    Post subject: Reply with quote

Hum... this is weird !

Code:
# equery belongs /usr/lib64/systemd/system/rpc-mountd.service
 * Searching for /usr/lib64/systemd/system/rpc-mountd.service ...

No answer.

I have
Code:
# find / -name rpc-mountd.service
/sys/fs/cgroup/systemd/system.slice/rpc-mountd.service
/usr/portage/net-fs/nfs-utils/files/rpc-mountd.service
/usr/lib64/systemd/system/rpc-mountd.service
/etc/systemd/system/multi-user.target.wants/rpc-mountd.service


Let's re-emerge nfs-utils and systemd
(...some time...)

No change, the service refuses to start.
_________________
Linux, cause booting is for adding new hardware
Back to top
View user's profile Send private message
ese002
Tux's lil' helper
Tux's lil' helper


Joined: 20 Sep 2006
Posts: 143

PostPosted: Wed Jan 22, 2014 6:01 am    Post subject: Reply with quote

Nitro_146 wrote:
Hum... this is weird !

Let's re-emerge nfs-utils and systemd
(...some time...)

No change, the service refuses to start.

rpc-mountd.service is provided by nfs-utils. You just have to equery /usr/lib instead of /usr/lib64

What I have (default) looks like this:
------------------------------------------------------
[Unit]
Description=NFS Mount Daemon
After=rpcbind.service nfsd.service
Requires=rpcbind.service nfsd.service

[Service]
Type=forking
EnvironmentFile=/etc/conf.d/nfs
ExecStart=/usr/sbin/rpc.mountd $OPTS_RPC_MOUNTD

[Install]
WantedBy=multi-user.target
------------------------------------------------------

The error you are seeing looks like invalid options are being passed to rpc.mountd. If your service file is unmodified the problem would seem to lie in /etc/conf.d/nfs. Look for OPTS_RPC_MOUNTD in this file. Mine is set to null:

----------------------------------------
# Options to pass to rpc.mountd
# ex. OPTS_RPC_MOUNTD="-p 32767"
OPTS_RPC_MOUNTD=""
-------------------------------------------
Back to top
View user's profile Send private message
Kompi
Apprentice
Apprentice


Joined: 05 Oct 2002
Posts: 252
Location: Germany

PostPosted: Wed Jan 22, 2014 10:34 am    Post subject: Reply with quote

Nitro_146 wrote:

Process: 31990 ExecStart=/usr/sbin/rpc.mountd $OPTS_RPC_MOUNTD (code=exited, status=1/FAILURE)

janv. 21 23:48:33 core-i5 rpc.mountd[31990]: Usage: rpc.mountd ....


This suggests rpc.mountd is started with wrong command line parameters. The /usr/lib/systemd/system/rpc-mountd.service service file shipped with the gentoo ebuild reads custom parameters from /etc/conf.d/nfs, as did the /etc/init.d file for openrc. You may have something wrong in the OPTS_RPC_MOUNTD variable in /etc/conf.d/nfs.

Edit: oh, didn't see in time that ese002 already posted that. Sry for double posting.
Back to top
View user's profile Send private message
Nitro_146
Apprentice
Apprentice


Joined: 02 Mar 2005
Posts: 221
Location: Digne les bains, France

PostPosted: Wed Jan 22, 2014 7:41 pm    Post subject: Reply with quote

My rpc-mountd.service is identical to yours.

My /etc/conf.d/nfs is as follow (only uncommented lines).
Code:
# 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="8"

# Options to pass to rpc.mountd
# ex. OPTS_RPC_MOUNTD="-p 32767"
OPTS_RPC_MOUNTD="-V 4 -V 3 -N 2" # supporte la version 3 et 4, mais pas la version 2

# 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=80


If I set OPTS_RPC_MOUNTD to "" and restart nfsd
Code:
# systemctl stop nfsd

# systemctl start nfsd

# systemctl status rcp-mountd.service
rcp-mountd.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

# systemctl start rcp-mountd.service
Failed to issue method call: Unit rcp-mountd.service failed to load: No such file or directory.

# systemctl -l status rpc-mountd.service
rpc-mountd.service - NFS Mount Daemon
   Loaded: loaded (/usr/lib64/systemd/system/rpc-mountd.service; enabled)
   Active: failed (Result: exit-code) since mer. 2014-01-22 18:17:12 CET; 2h 20min ago
  Process: 3255 ExecStart=/usr/sbin/rpc.mountd $OPTS_RPC_MOUNTD (code=exited, status=1/FAILURE)

janv. 22 18:17:12 core-i5 systemd[1]: rpc-mountd.service: control process exited, code=exited status=1
janv. 22 18:17:12 core-i5 systemd[1]: Failed to start NFS Mount Daemon.
janv. 22 18:17:12 core-i5 systemd[1]: Unit rpc-mountd.service entered failed state.

_________________
Linux, cause booting is for adding new hardware
Back to top
View user's profile Send private message
Nitro_146
Apprentice
Apprentice


Joined: 02 Mar 2005
Posts: 221
Location: Digne les bains, France

PostPosted: Wed Jan 22, 2014 9:38 pm    Post subject: Reply with quote

After a reboot it is working on the client side ! :D

What I dont understand, is that rcp-mountd is not working...
Code:
# systemctl status rcp-mountd.service
rcp-mountd.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)


I think the problem is solved.

Thank all those answered this post and especially ese002 for his precious help !
_________________
Linux, cause booting is for adding new hardware
Back to top
View user's profile Send private message
yogi77
n00b
n00b


Joined: 02 Jul 2006
Posts: 13

PostPosted: Sun Jan 26, 2014 6:57 pm    Post subject: Reply with quote

Sorry to capture this thread, I also have the described problem even if I'm on Openrc layout and not systemd...

Starting nfs with only nfsv4 enabled via OPTS_RPC_MOUNTD="-V 4 -N 3 -N 2" on my server gives me

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

showmount -e server then gives me
Code:
clnt_create: RPC: Program not registered


If I just give no OPTS_RPC_MOUNTD parameter, I still get the errno 22. However, I'm able to see my shares and connect to it (but it's nfs v3 as nfsstat tells me). So, it seems to be a problem related to nfsv4 and I don't have a clue where the error comes from...

Any help is appreciated!
Back to top
View user's profile Send private message
Kompi
Apprentice
Apprentice


Joined: 05 Oct 2002
Posts: 252
Location: Germany

PostPosted: Sun Jan 26, 2014 8:02 pm    Post subject: Reply with quote

yogi77 wrote:
If I just give no OPTS_RPC_MOUNTD parameter, I still get the errno 22. However, I'm able to see my shares and connect to it (but it's nfs v3 as nfsstat tells me). So, it seems to be a problem related to nfsv4 and I don't have a clue where the error comes from...


Do you have the module "nfsv4" loaded (or compiled in the kernel)?

How does you /etc/exports look like? For nfsv4 you need a slightly different configuration: For example, you need a virtual root and all exported filesystems mounted below that root AFAIK (see https://wiki.gentoo.org/wiki/NFSv4#.2Fetc.2Fexports)
Back to top
View user's profile Send private message
yogi77
n00b
n00b


Joined: 02 Jul 2006
Posts: 13

PostPosted: Sun Jan 26, 2014 8:11 pm    Post subject: Reply with quote

Thx for your quick reply!

nfsv4 is compiled into the kernel and /etc/exports is created acc. to the wiki (with fsid=0 for the root etc.)

rpcinfo -p gives me
Code:

   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
    100024    1   udp  41273  status
    100024    1   tcp  43880  status
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    2   tcp   2049  nfs_acl
    100227    3   tcp   2049  nfs_acl
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100227    2   udp   2049  nfs_acl
    100227    3   udp   2049  nfs_acl
    100021    1   udp  48252  nlockmgr
    100021    3   udp  48252  nlockmgr
    100021    4   udp  48252  nlockmgr
    100021    1   tcp  55333  nlockmgr
    100021    3   tcp  55333  nlockmgr
    100021    4   tcp  55333  nlockmgr
    100005    3   udp  50575  mountd
    100005    3   tcp  35339  mountd


rpcinfo -u server nfs 4 gives me
Code:
program 100003 version 4 ready and waiting


Only mountd service doesn't seem to be running for v4 and I don't have specific errors in the log...
Back to top
View user's profile Send private message
Kompi
Apprentice
Apprentice


Joined: 05 Oct 2002
Posts: 252
Location: Germany

PostPosted: Sun Jan 26, 2014 8:23 pm    Post subject: Reply with quote

ah, ok :idea: you were writing about the rpc.mountd daemon! (should have read more carefully).

Okay, that's your problem: mountd does not understand -V 4, because it is not needed for NFSv4 and thus only supports up to v3. So if you want a pure NFSv4 setup, you don't need rpc.mountd at all. Same fore statd BTW.
Back to top
View user's profile Send private message
yogi77
n00b
n00b


Joined: 02 Jul 2006
Posts: 13

PostPosted: Sun Jan 26, 2014 8:36 pm    Post subject: Reply with quote

Ok, if mountd service isn't needed for v4 (but I've read a lot about options like -V 4 -N 3 N -2), I'm fine.
But I get the same error and no access to the share, if I put for instance -N 3 -N 2 as mountd options (to get pure and only v4). That's why I'm assuming the relation to mountd (I don't know, if my error are related to mountd)...
Back to top
View user's profile Send private message
rochus
n00b
n00b


Joined: 06 Dec 2012
Posts: 8

PostPosted: Fri Jan 31, 2014 2:56 pm    Post subject: Reply with quote

I have the same problem that yogi77 has. mountd is automatically started when you start nfs, and -N 3 -N 2 is ignored. The server will still provide versions 2 and 3. Any way to fix this?

To summarize: NFSv4 is built into the kernel (3.10.25), nfs-utils v1.2.9 with nfsv4 and nfsv41 useflags, "standard" /etc/conf.d/nfs with -V 4 -N 3 -N 2 for mountd (or without -V 4, doesn't really matter):

the relevant fstab part:
Code:

/home/rochus/library   /export/library      none   bind 0 0
/home/rochus/media/audio /export/audio      none   bind 0 0


and exports file:
Code:

/export         net/24(ro,fsid=0,no_subtree_check)
/export/library      net/24(ro,no_subtree_check)
/export/audio      net/24(ro,no_subtree_check)


(of course with "net" something suitable)

some results:
Code:

root / # /etc/init.d/nfs start
 * Starting rpcbind ...                                                                                                                         [ ok ]
 * Starting NFS statd ...                                                                                                                       [ ok ]
 * Starting idmapd ...                                                                                                                          [ ok ]
 * Exporting NFS directories ...                                                                                                                [ ok ]
 * Starting NFS mountd ...                                                                                                                      [ ok ]
 * Starting NFS daemon ...
rpc.nfsd: Setting version failed: errno 22 (Invalid argument)                                                                                   [ ok ]
 * Starting NFS smnotify ...                                                                                                                    [ ok ]
root / # rpcinfo -u localhost nfs
program 100003 version 2 ready and waiting
program 100003 version 3 ready and waiting
program 100003 version 4 ready and waiting
root / # exportfs -v
/export      net/24(ro,wdelay,root_squash,no_subtree_check,fsid=0,sec=sys,ro,secure,root_squash,no_all_squash)
/export/library   net/24(ro,wdelay,root_squash,no_subtree_check,sec=sys,ro,secure,root_squash,no_all_squash)
/export/audio   net/24(ro,wdelay,root_squash,no_subtree_check,sec=sys,ro,secure,root_squash,no_all_squash)
root / # showmount -e localhost
clnt_create: RPC: Program not registered
Back to top
View user's profile Send private message
Kompi
Apprentice
Apprentice


Joined: 05 Oct 2002
Posts: 252
Location: Germany

PostPosted: Fri Jan 31, 2014 3:24 pm    Post subject: Reply with quote

looks like the shipped /etc/init.d/nfs script for openrc hard codes starting mountd in any case.

As said, AFAIK you do not need mountd for NFSv4 only and it probably won't like "-V 4 -N 3 -N 2" as it does not speak NFSv4. So probably - this is just a guess - nfsd sees mountd running and does not like not to provide v3/2.

So one thing you could try is to comment out starting mountd and see if that changes anything. It should be thoose lines in /etc/init.d/nfs, starting with at line 99:

Code:

        local ret=0
#        start_it mountd ${mountd} ${OPTS_RPC_MOUNTD}
        start_it daemon ${nfsd} ${OPTS_RPC_NFSD}
        [ -x "${smnotify}" ] && start_it smnotify ${smnotify} ${OPTS_SMNOTIFY}
        return ${ret}
}

stop() {
        local ret=0

#        ebegin "Stopping NFS mountd"
#        start-stop-daemon --stop --exec ${mountd}
#        eend $?
#        ret=$((ret + $?))


If that does not help: What are your OPTS_RPC_NFSD in /etc/conf.d/nfs?

And does nfsd tell you any more if you add "--debug" to the OPTS_RPC_NFSD?
Back to top
View user's profile Send private message
CrazyIvanMN
n00b
n00b


Joined: 20 Feb 2007
Posts: 45

PostPosted: Sun Feb 02, 2014 6:31 am    Post subject: Reply with quote

I believe I have been having a similar issue. (google brought me here).

I dug into the source code and found the error "rpc.nfsd: Setting version failed: errno 22 (Invalid argument)"

nfsd on start up write a string to /proc/fs/nfsd/versions, specifically it should be setting the versions you tell it to support or not support.
for example.. if you have the options -V 4 -N 3 -N 2.. it will construct a string "+4 +4.1 -4.2 -3 -2" (not necessarily in that order) and write it to /proc/fs/nfsd/versions.

Try it yourself you'll get an error if your kernel doesn't recognize nfsd 4.2.
echo "+4 +4.1 -4.2 -3 -2" > /proc/fs/nfsd/versions

the message will be invalid input or some such. (when you run the --debug option you'll see this message).

try it again with out 4.2 and it will succeed.
echo "+4 +4.1 -3 -2" > /proc/fs/nfsd/versions
(no error)

I hacked a patch that suppresses the error, and tried to start nfsd again.
Code:
diff -urN nfs-utils-1.2.9/support/include/nfs/nfs.h nfs-utils-1.2.9.new/support/include/nfs/nfs.h
--- nfs-utils-1.2.9/support/include/nfs/nfs.h   2013-11-05 14:41:27.000000000 -0600
+++ nfs-utils-1.2.9.new/support/include/nfs/nfs.h   2014-02-01 16:05:17.378726133 -0600
@@ -16,7 +16,7 @@
 #define NFSD_MAXVERS 4
 
 #define NFS4_MINMINOR 1
-#define NFS4_MAXMINOR 2
+#define NFS4_MAXMINOR 1
 #define NFS4_VERDEFAULT  0x1  /* minor verion 1 */
 
 struct nfs_fh_len {


The function that does this is sort of a noop if it fails. You'll be stuck with I believe the kernel default support, instead of what you chose with the -V and -N flags.

To see for yourself the function is nfssvc_setvers in utils/nfsd/nfssvc.c

The patch above just restricts the building of the string to only do version 4.1 at most not go to 4.2.

I suspect there are some 'newer' kernels that do not have this problem. I'm running a 3.6.11 kernel on a raspberry pi..

You could take the patch and add it to an overlay ebuild and it works like a champ for both supressing the error about setting version numbers and allowing your -V and -N flags to work again.
Back to top
View user's profile Send private message
yogi77
n00b
n00b


Joined: 02 Jul 2006
Posts: 13

PostPosted: Thu Feb 06, 2014 8:36 am    Post subject: Reply with quote

I also was at that point, I found some comments on the net about that string and the missing 4.2 support (I think it was mentioned for kernel < 3.11 or such). Normally, I would expect, that the parameter given by OPTS_RPC_NFSD would be used to write the versions file. I changed the init script to control the output and the script worked like expected, but it seems to be overwritten (e.g. output is +4 -3 -2, but the file shows -4.2 +4.1 +4 +3 +2 or such). I didn't look at the source so far, but your post explains my observation :) I will try your patch, thx for this!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum