Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to run a version 2 NFS server?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
MrZammler
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jun 2003
Posts: 113
Location: The Island of Crete

PostPosted: Sun Sep 28, 2014 10:12 am    Post subject: How to run a version 2 NFS server? Reply with quote

Hi,

I'm trying to force my gentoo's nfs server to run with version 2. I'm running a systemd system, and I know it did at some point. However, now it will only run a version 3 server.

Code:

winterland linux # rpcinfo | grep nfs
    100003    3    tcp       0.0.0.0.8.1            nfs        superuser
    100003    3    udp       0.0.0.0.8.1            nfs        superuser
    100003    3    tcp6      ::.8.1                 nfs        superuser
    100003    3    udp6      ::.8.1                 nfs        superuser


Code:

winterland linux # cat /proc/fs/nfsd/versions
-2 +3


/etc/conf.d/nfs is told to run a version 2 server:

Code:

winterland linux # more /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="8 -V 2 -V 3"

# Options to pass to rpc.mountd
# ex. OPTS_RPC_MOUNTD="-p 32767"
OPTS_RPC_MOUNTD="-V 2 -V 3"

# 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"
#NFSD_OPTS="-V 2"


Have CONFIG_NFSD in kernel which should handle version 2:

Code:

winterland linux # grep NFS /usr/src/linux/.config
CONFIG_NFS_FS=y
CONFIG_NFS_V2=y
CONFIG_NFS_V3=y
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=y
# CONFIG_NFS_SWAP is not set
# CONFIG_NFS_V4_1 is not set
CONFIG_ROOT_NFS=y
# CONFIG_NFS_USE_LEGACY_DNS is not set
CONFIG_NFS_USE_KERNEL_DNS=y
CONFIG_NFSD=y
CONFIG_NFSD_V3=y
# CONFIG_NFSD_V3_ACL is not set
# CONFIG_NFSD_V4 is not set
CONFIG_NFS_ACL_SUPPORT=y
CONFIG_NFS_COMMON=y


However, it just doesn't run...

No clue as to what else I can check.. Any ideas?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14281

PostPosted: Sun Sep 28, 2014 3:48 pm    Post subject: Reply with quote

Why do you want to run a legacy version NFS server? Do you have some custom device that cannot use a modern NFS protocol?
Back to top
View user's profile Send private message
MrZammler
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jun 2003
Posts: 113
Location: The Island of Crete

PostPosted: Sun Sep 28, 2014 5:35 pm    Post subject: Reply with quote

Yes, I mount the nfs share on an Amiga. As it might be expected, it's nfs client only made it as far as version 2 :-)

I've noticed that /usr/lib64/systemd/system/nfsd.service which starts nfs doesn't take into account anything from /etc/conf.d/nfs:

Code:

[Unit]
Description=NFS server
After=rpcbind.service
Requires=rpcbind.service

[Service]
Type=oneshot
ExecStart=/usr/sbin/rpc.nfsd 8
ExecStartPost=/usr/sbin/exportfs -a
ExecStop=/usr/sbin/rpc.nfsd 0
ExecStopPost=/usr/sbin/exportfs -a -u
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target


I've added:

Code:

ExecStart=/usr/sbin/rpc.nfsd 8 -V 2


and works as expected:

Code:

winterland linux # cat /proc/fs/nfsd/versions
+2 +3


Anyone knows why it's that?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14281

PostPosted: Sun Sep 28, 2014 6:38 pm    Post subject: Reply with quote

Configuration in /etc/conf.d is for OpenRC users. Some systemd services might include tricks to respect your OpenRC settings. Modifying a systemd service file outside the configuration protected area is likely a bad idea, since it will be overwritten on the next merge of the owning package.
Back to top
View user's profile Send private message
MrZammler
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jun 2003
Posts: 113
Location: The Island of Crete

PostPosted: Sun Sep 28, 2014 6:45 pm    Post subject: Reply with quote

Hu wrote:
Configuration in /etc/conf.d is for OpenRC users. Some systemd services might include tricks to respect your OpenRC settings. Modifying a systemd service file outside the configuration protected area is likely a bad idea, since it will be overwritten on the next merge of the owning package.


Yes, I know it will be overwritten.

I know I saw somewhere while searching that indeed systemd should pick up settings from /etc/conf.d/nfs, or at least did so at some point.

Will copying nfsd.service to /etc/systemd/system/ let it take precendance over the default file?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14281

PostPosted: Sun Sep 28, 2014 7:06 pm    Post subject: Reply with quote

I masked systemd and do not use or support it. I have no idea whether that would work, but if it did, there might be negative consequences if upstream publishes a modified version and some of the modifications are required, since your override would not receive those.
Back to top
View user's profile Send private message
MrZammler
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jun 2003
Posts: 113
Location: The Island of Crete

PostPosted: Mon Sep 29, 2014 8:20 am    Post subject: Reply with quote

So, it seems nfs-utils now ship 2 versions of nfsd.service:

nfsd.service:

Code:

[Unit]
Description=NFS server
After=rpcbind.service
Requires=rpcbind.service

[Service]
Type=oneshot
EnvironmentFile=/etc/conf.d/nfs
ExecStart=/usr/sbin/rpc.nfsd $OPTS_RPC_NFSD
ExecStartPost=/usr/sbin/exportfs -a
ExecStop=/usr/sbin/rpc.nfsd 0
ExecStopPost=/usr/sbin/exportfs -a -u
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target



and

nfsd.service-r1:

Code:

[Unit]
Description=NFS server
After=rpcbind.service
Requires=rpcbind.service

[Service]
Type=oneshot
ExecStart=/usr/sbin/rpc.nfsd 8
ExecStartPost=/usr/sbin/exportfs -a
ExecStop=/usr/sbin/rpc.nfsd 0
ExecStopPost=/usr/sbin/exportfs -a -u
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target


nfs-utils-1.2.9-r2.ebuild and upwards installs the r1 version, so no more /etc/conf.d/nfs reference.

Anyone knows if there is a new way of configuring the behaviour of the nfs server?
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
Page 1 of 1

 
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