5

I have an Ubuntu 12.04 server that exports a couple of filesystems over NFS.

server$ cat /etc/exports
/home 192.168.42.0/255.255.255.0(rw,anonuid=65534,anongid=65534,async,no_subtree_check)
/stuff 192.168.42.0/255.255.255.0(rw,anonuid=65534,anongid=65534,async,no_subtree_check)
/stuff 192.168.99.0/255.255.255.0(ro,anonuid=65534,anongid=65534,async,no_subtree_check)

I also have a client that mounts them:

client$ cat /etc/fstab
...
server:/home    /home       nfs hard,intr,rsize=8192,wsize=8192,_netdev 0 0
server:/stuff   /server/stuff   nfs hard,intr,rsize=8192,wsize=8192,_netdev 0 0

The client's IP is in the 192.168.42.x range. It was running Ubuntu 10.04 until yesterday. NFS worked fine, more or less (sometimes it wouldn't automount on boot, but I had a cron script to detect and fix that).

I upgraded the client to Ubuntu 12.04 yesterday and rebooted. NFS continued to work fine.

I upgraded the client to Ubuntu 14.04 today and rebooted. Now NFS is mounted but all file ownership information is mapped to nobody:4294967294:

client$ ls -ld /home/weblate
drwxr-xr-x   5 nobody 4294967294     4096 Jan 29  2014 weblate

Why is that and what do I need to do to make file ownership work again?

1
9

The vital clue showed up in /var/log/syslog:

Sep 16 13:11:07 client nfsidmap[7340]: nss_getpwnam: name 'www-data@lan' does not map into domain 'localdomain'

combined with this excerpt from NFSv4Howto

If all directory listings show just "nobody" and "nogroup" instead of real user and group names, then you might want to check the Domain parameter set in /etc/idmapd.conf. NFSv4 client and server should be in the same domain.

and this comment in /etc/idmap.conf:

# set your own domain here, if id differs from FQDN minus hostname
# Domain = localdomain

So turns out my server thought its domain was lan:

server$ hostname -f
server.lan

server$ grep server /etc/hosts
127.0.1.1   server.lan server

while my client didn't have a domain:

client$ hostname -f
client

client$ grep client /etc/hosts
127.0.1.1   client

The fix: edit /etc/hosts on the client to read

127.0.1.1   client.lan client

and reboot.

4
  • /var/log/syslog on the client or the server? – 7yl4r Jul 17 '17 at 14:00
  • 1
    @7yl4r: on the client. – Marius Gedminas Jul 18 '17 at 11:32
  • I'd like to add that in /etc/hosts the order is important, that is, the FQDN needs to come first. So do not write 127.0.1.1 client client.lan, but 127.0.1.1 client.lan client. – myrdd Jul 10 '18 at 11:30
  • also, consider adding nfsidmap -c; apparently, it clears some caches that stay around even after restarting nfs.idmapd. – Latanius Apr 12 '20 at 9:01
1

I resolved my issue by this method. Open the file /etc/nfsmount.conf and find Nfsvers=.

Uncomment that line and write the NFS version which is supported by your server. Mine was 3 so I wrote:

Nfsvers=3

The I restarted the NFS server.

1
  • 1
    But aren't you missing out on functionality by not using NFSv4? – dalanmiller Jul 30 '19 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.