Discussion:
[gentoo-user] Debugging NFS mounts
(too old to reply)
Peter Humphrey
2023-11-15 16:30:02 UTC
Permalink
Hello list,

My little server needs help with compiling, so I NFS-export /var (which has
its own partition) to a chroot on my workstation. I mount all the partitions
on both server and workstation. Then when I chroot, env-update hangs for ever.
Well, over an hour anyway.

Is it possible to export /var in this way? I can't see anything else wrong.
--
Regards,
Peter.
Alan McKinnon
2023-11-15 17:10:01 UTC
Permalink
Post by Peter Humphrey
Hello list,
My little server needs help with compiling, so I NFS-export /var (which has
its own partition) to a chroot on my workstation. I mount all the partitions
on both server and workstation. Then when I chroot, env-update hangs for ever.
Well, over an hour anyway.
Is it possible to export /var in this way? I can't see anything else wrong.
Did you run mount inside the chroot or outside of it?
--
Alan McKinnon
alan dot mckinnon at gmail dot com
Peter Humphrey
2023-11-15 23:50:01 UTC
Permalink
Post by Alan McKinnon
Post by Peter Humphrey
Hello list,
My little server needs help with compiling, so I NFS-export /var (which has
its own partition) to a chroot on my workstation. I mount all the partitions
on both server and workstation. Then when I chroot, env-update hangs for ever.
Well, over an hour anyway.
Is it possible to export /var in this way? I can't see anything else wrong.
Did you run mount inside the chroot or outside of it?
Outside. That's how it's worked everywhere else.
--
Regards,
Peter.
Peter Humphrey
2023-11-17 16:50:01 UTC
Permalink
Post by Peter Humphrey
Hello list,
My little server needs help with compiling, so I NFS-export /var (which has
its own partition) to a chroot on my workstation. I mount all the
partitions on both server and workstation. Then when I chroot, env-update
hangs for ever. Well, over an hour anyway.
Is it possible to export /var in this way? I can't see anything else wrong.
I don't see why it shouldn't work, but there's a couple commands I use to
debug NFS. They're not *great*, but they work.
I haven't used Gentoo in a while so I forget exactly what env-update does,
but I assume mounting the network share works successfully and this is just
a command that accesses /var.
You can use these commands to make the kernel driver output debugging
information to dmesg.
Post by Peter Humphrey
# rpcdebug -m nfs -s all
# rpcdebug -m nfsd -s all
On both sides, if the others don't give useful info, this is for the lower
Post by Peter Humphrey
# rpcdebug -m rpc -s all
Then, try running the command again. It will spew a lot of info but
hopefully you can figure out from it what's going on.
I'll try that - thanks.
--
Regards,
Peter.
Peter Humphrey
2023-11-18 07:40:01 UTC
Permalink
Post by Peter Humphrey
I'll try that - thanks.
Damn fool - it was a firewall problem on the server. For some reason, the NFS
destination port has changed.

Sorry for the noise.
--
Regards,
Peter.
William Kenworthy
2023-11-19 00:40:01 UTC
Permalink
Post by Peter Humphrey
Post by Peter Humphrey
I'll try that - thanks.
Damn fool - it was a firewall problem on the server. For some reason, the NFS
destination port has changed.
Sorry for the noise.
Actually, NFS may have some ports dynamicly allocated so they change on
reboot.  Google "pin NFS ports" for how to fix them for firewalls.

BillK
Peter Humphrey
2023-11-19 15:20:02 UTC
Permalink
Post by William Kenworthy
Post by Peter Humphrey
Post by Peter Humphrey
I'll try that - thanks.
Damn fool - it was a firewall problem on the server. For some reason, the
NFS destination port has changed.
Sorry for the noise.
Actually, NFS may have some ports dynamicly allocated so they change on
reboot. Google "pin NFS ports" for how to fix them for firewalls.
Yes, indeed. In fact I don't know why this has only just bitten me; I've been
doing the same thing for years without problem.

That search turns up so many answers that I don't know where to start, even
prefixing the phrase with "gentoo". Most of them seem to date from 10 years ago
or more.
--
Regards,
Peter.
Remy Blank
2023-11-19 16:00:01 UTC
Permalink
Post by Peter Humphrey
Yes, indeed. In fact I don't know why this has only just bitten me; I've been
doing the same thing for years without problem.
That search turns up so many answers that I don't know where to start, even
prefixing the phrase with "gentoo". Most of them seem to date from 10 years ago
or more.
You need to configure two files. Add a *.conf file below /etc/sysctl.d with
the following content:

# Set fixed ports for lockd.
fs.nfs.nlm_tcpport = 4014
fs.nfs.nlm_udpport = 4014

Then set some options in /etc/conf.d/nfs. Here's my config, the -p options configure the ports
of various NFS services.

# /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"

# Options to pass to rpc.nfsd
OPTS_RPC_NFSD="8 -s -V 3 -N 4"

# Options to pass to rpc.mountd
# ex. OPTS_RPC_MOUNTD="-p 32767"
OPTS_RPC_MOUNTD="-p 4010 --manage-gids"

# Options to pass to rpc.statd
# ex. OPTS_RPC_STATD="-p 32765 -o 32766"
OPTS_RPC_STATD="-p 4011 -o 4012"

# 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="-p 4013"

# 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"


Then you need to allow ports 111 (TCP + UDP), 2049 (TCP) and 4010:4014 (TCP + UDP) through your
firewall. I'm not entirely sure about TCP vs. UDP, you might be able to remove some of them (it
has been a while that I configured this). You can pick different port number than 4010:4014 if
you like.

-- Remy
Peter Humphrey
2023-11-20 11:30:01 UTC
Permalink
Post by Remy Blank
Post by Peter Humphrey
Yes, indeed. In fact I don't know why this has only just bitten me; I've
been doing the same thing for years without problem.
That search turns up so many answers that I don't know where to start, even
prefixing the phrase with "gentoo". Most of them seem to date from 10
years ago or more.
You need to configure two files. Add a *.conf file below /etc/sysctl.d with
# Set fixed ports for lockd.
fs.nfs.nlm_tcpport = 4014
fs.nfs.nlm_udpport = 4014
Then set some options in /etc/conf.d/nfs. Here's my config, the -p options
configure the ports of various NFS services.
# /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"
# Options to pass to rpc.nfsd
OPTS_RPC_NFSD="8 -s -V 3 -N 4"
# Options to pass to rpc.mountd
# ex. OPTS_RPC_MOUNTD="-p 32767"
OPTS_RPC_MOUNTD="-p 4010 --manage-gids"
# Options to pass to rpc.statd
# ex. OPTS_RPC_STATD="-p 32765 -o 32766"
OPTS_RPC_STATD="-p 4011 -o 4012"
# 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="-p 4013"
# 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"
Then you need to allow ports 111 (TCP + UDP), 2049 (TCP) and 4010:4014 (TCP
+ UDP) through your firewall. I'm not entirely sure about TCP vs. UDP, you
might be able to remove some of them (it has been a while that I configured
this). You can pick different port number than 4010:4014 if you like.
That's a great help. Thank you Remy.
--
Regards,
Peter.
Loading...