Check the Sun RPC Sysctl Directory Before Touching NFS
NFS acting up and someone suggests poking a Sun RPC sysctl: check /proc/sys/sunrpc/ exists first, because on plenty of hosts it simply does not. This gives you a safe, repeatable check for the directory, what entries this host exposes, and whether a missing directory is just a host-specific condition. It changes nothing.
The route
Jump straight to the step you need, or tick off Done means at the end.
Allow about ten minutes. You need a shell and a mounted /proc filesystem. The examples were checked against the installed manpages package version 6.7-2 and Linux 6.8.0-139-generic. Your kernel, distribution and loaded modules can expose a different result.
This guide is deliberately conservative. The installed proc_sys_sunrpc(5) page documents the directory and its purpose, but promises no particular files or values. Do not turn an old list of Sun RPC tunables into a configuration recipe for a newer host without checking the running kernel and the relevant subsystem documentation.
1. Confirm the local documentation and kernel
Start with ordinary, read-only commands. No elevated privileges needed:
$ man 5 proc_sys_sunrpc
$ dpkg-query -W -f='${Package} ${Version}\n' manpages
manpages 6.7-2
$ uname -sr
Linux 6.8.0-139-generic
The package version identifies the manpage you are using, not every kernel component involved in NFS. uname identifies the running kernel. Record both when reporting a host-specific result.
Checkpoint
If man 5 proc_sys_sunrpc fails, install or consult the documentation package through your normal operating-system process before making changes. Do not compensate by copying a random sysctl list from another distribution.
2. Check whether the directory exists
Test the exact path and print a useful status:
if [ -d /proc/sys/sunrpc ]; then
printf '%s\n' '/proc/sys/sunrpc exists'
else
printf '%s\n' '/proc/sys/sunrpc is not present'
fi
The manpage explicitly allows the directory to be absent on some systems. A missing directory is a result to investigate, not proof that NFS is broken, and it is not permission to create the directory yourself. /proc is a kernel-provided pseudo-filesystem; an ordinary directory with the same name would not provide the interface the manpage describes.
On the machine used for this guide, the directory is not present. That is the expected output from this check on this host, not a universal default.
3. List only what this host exposes
If the directory exists, list its immediate entries without guessing at names from elsewhere:
if [ -d /proc/sys/sunrpc ]; then
find /proc/sys/sunrpc -mindepth 1 -maxdepth 1 -printf '%f\n' | sort
fi
This reads directory metadata and sorts the names. It does not write values, load a module or contact an NFS server. An empty listing is possible and still worth recording. An entry's name alone also does not tell you its accepted values, default, persistence rules or effect on a live workload.
For a quick human-readable look:
$ ls -la /proc/sys/sunrpc
total 0
dr-xr-xr-x 1 root root 0 Sep 26 00:00 .
dr-xr-xr-x 1 root root 0 Sep 26 00:00 ..
Timestamps and ownership will vary. If the path is absent, ls reports an error such as No such file or directory; treat that as the result from step 2, not as a reason to create the path.
4. Use sysctl as a read-only cross-check
If sysctl is installed, ask it to show the Sun RPC namespace without changing anything:
$ sysctl -a 2>/dev/null | grep '^sunrpc\.'
$ printf 'sysctl status: %s\n' "$?"
sysctl status: 1
Status 1 here just means the pipeline found no matching output. It does not distinguish an absent directory from a namespace with no matching entries, and the final status also depends on the filtering command. Treat the direct directory test in step 2 as authoritative for the path.
If you need to preserve the reason for a failed sysctl invocation, run it without hiding the diagnostic:
$ sysctl -a | grep '^sunrpc\.'
sysctl: ...
The exact diagnostic is host-specific. Do not treat a permission error, an unavailable command and no matching names as the same condition.
5. Do not write a value until you have a current contract
Warning
Writing under /proc/sys is a privileged, live kernel configuration change. It can alter RPC or NFS behaviour for processes on the host, and an incorrect value can disrupt a workload. Stop before any command using sysctl -w or shell redirection such as sudo sh -c 'echo VALUE > /proc/sys/sunrpc/NAME'.
The local proc_sys_sunrpc(5) page documents no NAME, no VALUE, no default and no rollback command. This guide gives no write example as a result. Before making a change, identify the exact file on the running kernel, read its authoritative documentation or source, capture its current value, and establish a service-specific maintenance and recovery plan. If the setting is meant to persist, separately verify which configuration mechanism your distribution supports: a one-off write and a persistent boot policy are different changes.
Recovery
If you have already changed a documented setting and need to undo it, restore the value you recorded before the change, using the same documented interface. If you did not record the old value, do not guess a default. Stop the affected service or follow its vendor recovery procedure while you establish the correct value.
6. Report the result without overclaiming
A useful report includes the kernel release, manpages version, exact path result and the names actually listed. For example:
printf 'kernel: '; uname -sr
printf 'manpages: '; dpkg-query -W -f='${Version}\n' manpages 2>/dev/null || printf '%s\n' 'not queried'
if [ -d /proc/sys/sunrpc ]; then
printf '%s\n' 'sunrpc directory: present'
find /proc/sys/sunrpc -mindepth 1 -maxdepth 1 -printf '%f\n' | sort
else
printf '%s\n' 'sunrpc directory: absent'
fi
Say "this host does not expose /proc/sys/sunrpc" rather than "Linux does not support Sun RPC". The manpage only establishes the directory's NFS-related purpose and warns that it may not exist on some systems. It defines no universal inventory of settings.
Done means
- Checked kernel and manual versions. You recorded the running kernel and local
proc_sys_sunrpc(5)version. - Tested the path directly. You checked
/proc/sys/sunrpcand recorded whether it exists. - Listed only real entries. You did not assume names from another kernel.
- Stayed read-only. No substitute directory was created.
- Have a rollback plan. A documented current value and recovery plan exist before any privileged write or service change.