I think the nfs-utils package, when the nfs4 use flag is set, needs to check for nfs4 server support in kernel. If you build a kernel with NFS client only support, it will not work with nfs4 uid/gid mappings via idmapd.
When you try, you will get the following error, and nothing you can do configuration or otherwise will correct and allow proper mappings of UID/GID.
nfsdopenone: Opening /proc/net/rpc/nfs4.nametoid/channel failed: errno 2 (No such file or directory)
This is a result from mounting nfs4 mount with idmapd running, but the kernel is missing nfs4 server support. Thus it does not have a required directory necessary for things to work properly. The only way to get that directory is to compile in nfs4 server support to the kernel.
I was plagued by this for quite some time, hopefully this helps others, and not sure if the kernel can be modified to allow for client only support without requiring support for nfs server in kernel.
if I load the module nfsd on startup it also not works.
Can you please help to setup idmap on nfs4?
One week of my life wasted...
"nfsdopenone: Opening /proc/net/rpc/nfs4.nametoid/channel failed: errno 2 (No such file or directory)
The only way to get that directory is to compile in nfs4 server support to the kernel."
This. Thank you.
rpc.idmapd throws error on /proc/net/rpc/nfs4.nametoid, but does not even try to open /proc/net/rpc/nfs4.idtoname and contiue to run normally, because it's not needed when run as a client. /proc/net/rpc/nfs4.*/content is empty on client, but contains something on server. (At least in my case.)
So (few reboots later) IMHO it's not error, it's normal. All the problems I'm having with id mapping are unrelated to this error message.