Re: nfs idmap change
On 2012-01-27, Alan Greenberger <alanjg@ptd.net> wrote:
> I recently rebooted a squeeze client which does nightly backups to a
> squeeze nfs server with exports (rw,no_root_squash) using rsnapshot (with
> cmd_cp) and started getting nightly mail from cron that:
> rsync: chown "/the_mount/daily.0/etc/fetchmailrc" failed:
> Invalid argument (22)
> The only thing that had changed recently was the server had been upgraded
> to kernel 2.6.39-bpo.2-amd64 .
>
> ls -l and ls -n of the problem file on the client gives:
> -rw------- 1 fetchmail root 416 Jun 12 2010 /etc/fetchmailrc
> -rw------- 1 110 0 416 Jun 12 2010 /etc/fetchmailrc
> The server's /etc/passd contains:
> nut:x:110:118::/var/lib/nut:/bin/false (same uid different user)
> and fetchmail was not installed on the server.
>
> I tried installing fetchmail on the server (but not running it). In the
> next nightly backup, the error message went away. But then ls -l and
> ls -n of the backed up file showed:
> -rw------- 17 fetchmail root 416 Jun 12 2010 /serverdir/fetchmailrc
> -rw------- 17 111 0 416 Jun 12 2010 /serverdir/fetchmailrc
> but viewed nfs mounted from the client:
> -rw------- 17 fetchmail root 416 Jun 12 2010 /mountedOnClient/fetchmailrc
> -rw------- 17 110 0 416 Jun 12 2010 /mountedOnClient/fetchmailrc
> Despite /etc/rsnapshot.conf having "rsync_long_args --delete
> --numeric-ids", it was using the non-numeric user name to translate the
> numerical ids! It didn't do this before.
>
> I created a test file on the server with user nut:
> -rw-r--r-- 1 nut root 0 Jan 20 14:02 /serverdir/junk
> -rw-r--r-- 1 110 0 0 Jan 20 14:02 /serverdir/junk
> viewed nfs mounted from the client shows as:
> -rw-r--r-- 1 nobody root 0 Jan 20 14:02 /mountedOnClient/junk
> -rw-r--r-- 1 65534 0 0 Jan 20 14:02 /mountedOnClient/junk
> since it can't find user nut on the client, it maps to nobody!
>
> Then I uninstalled fetchmail from the server, rebooted to 2.6.32 and then
> rebooted the client. The old behavior was restored: no more cron rsync
> error and ls -n showing uid 110 on server and from client nfs mount.
>
> The Squeeze backport of linux-image-3.1.0-0.bpo.1-amd64 became available
> so I tried booting into that. It exhibited the same behavior as 2.6.39 .
>
> Something has changed in kernel nfs idmap implementation. In
> linux-doc-3.1 there is idmapper.txt.gz which discusses changes if
> NFS_USE_NEW_IDMAPPER is set in the kernel. It is not set in the
> backported kernel. The program /usr/sbin/nfs.idmap it discusses is not
> found. I had played with /etc/idmap.conf and /etc/default/nfs-common
> settings but only succeeded in breaking things. man rpc.idmapd has a -C
> option but it is not clear how to set it in /etc/idmap.conf or whether
> it addresses this.
>
> Going forward with kernels, will there be a way to configure nfs idmap
> for the previous functionality? Or will I have to mount differently
> such as using sshfs instead of nfs?
>
I found the recent nfs developer message related to this,
http://www.spinics.net/lists/linux-nfs/msg26557.html . Based on this, I
tried booting Squeeze with kernel 3.1.0-0.bpo.1-amd64 and kernel
parameter nfs.nfs4_disable_idmapping=1 thinking that it would solve the
problem. It didn't. I still get the "rsync: chown" Cron mail. On the
client, the file is:
-rw------- 1 fetchmail root 416 Jun 12 2010 /etc/fetchmailrc
-rw------- 1 110 0 416 Jun 12 2010 /etc/fetchmailrc
backed up on the server it is:
-rw------- 17 nut root 416 Jun 12 2010 /serverdir/fetchmailrc
-rw------- 17 110 0 416 Jun 12 2010 /serverdir/fetchmailrc
and viewed from the client nfs mounted:
-rw------- 17 nut root 416 Jun 12 2010 /mountedOnClient/fetchmailrc
-rw------- 17 115 0 416 Jun 12 2010 /mountedOnClient/fetchmailrc
(I have installed nut on the client where its id is 115)
So I guess this is a work in progress and maybe some future kernel may
straighten this out. I am surprised that I seem to be the only one
bitten by this nfs change.
Reply to: