# nfs mountd - can't change attributes



## chazz (Feb 18, 2011)

/etc/exports


```
#Works on Boot: 
/usr/mydata     webserver1 webserver2

#Does not work:
/usr/mydata	-maproot=root	webserver1 webserver2
```


/etc/rc.conf

```
nfs_client_enable="YES"
extra_netfs_types="NFS"
nfs_client_flags="-n 6"

rpc_lockd_enable="YES"
rpc_statd_enable="YES"

rpcbind_enable="YES" 

nfs_server_enable="YES"
nfs_server_flags="-u -t -n 10 -h 10.1.1.35"
nfs_reserved_port_only="NO"

mountd_flags="-r"
```


On boot: 

```
mountd error: can't change attributes ... bad exports list
```

I've read the handbook and can't see what the issue could be.
None are folders are symlinks, I'm plain out of ideas.

7.1 - Stable


----------



## nakal (Feb 18, 2011)

Is this the only entry in your /etc/exports?

I get this error when I try to assign different settings to exported directories within one physical mountpoint on one local filesystem.

I don't know why it is like this, but it surely shows how crappy NFS is.


----------



## chazz (Feb 18, 2011)

The one and only, maybe you need an additional option or flag?  
None that I've tried panned out.


----------



## nakal (Feb 21, 2011)

Something trivial perhaps... did you look if there are some weird white-spaces in your /etc/exports?


----------



## peetaur (Dec 21, 2011)

I have the same problem on a ZFS dataset, with a solution/workaround.

*Problem:*

/etc/exports

```
#works fine
/tank/somedataset1 -maproot=root -network somenetwork/16
/tank/somedataset1 -maproot=root someipaddress1
/tank/somedataset1 -maproot=root someipaddress2
/tank/somedataset1/somesubdir/somesubdir -maproot=root someipaddress4 #even this works
/tank/somedataset2 -maproot=root someipaddress3

#does not work
/tank/somedataset2/somesubdir -maproot=root someipaddress3
```

/var/log/messages

```
Dec 21 09:29:02 bcnas1 mountd[47163]: can't change attributes for /tank/somedataset/somesubdir
Dec 21 09:29:02 bcnas1 mountd[47163]: bad exports list line /tank/somedataset/somesubdir -maproot
```

`# uname -a`

```
FreeBSD bcnas1.bc.local 8.2-STABLE FreeBSD 8.2-STABLE #0: Thu Sep 29 15:06:03 CEST 2011     root@bcnas1.bc.local:/usr/obj/usr/src/sys/GENERIC  amd64
```


This seems to be more like what nakal said, because the first line works fine; only the subdirectory share won't work. I vaguely remember this is fixed by rebooting. 


> different settings to exported directories within one physical mountpoint on one local filesystem




http://www.freebsd.org/doc/en/books/faq/networking.html#EXPORTS-ERRORS


> 12.12. Why does mountd keep telling me it â€œcan't change attributesâ€ and that I have a â€œbad exports listâ€ on my FreeBSD NFS server?
> 
> The most frequent problem is not understanding the correct format of /etc/exports. Please review exports(5) and the NFS entry in the Handbook, especially the section on configuring NFS.



If only it was true... but then why do some lines work, and others don't, and others don't until reboot and then they do?

*Solution:*

The handbook, etc. tells me that the option "-alldirs" exists; it is not exactly what I want, but is just as secure, since both the working dataset dir and the subdir use the same ip address, so it is acceptable. And also it would not be acceptable for the other which already works, because the ip is not the same. But it seems to work without that option.

But I don't see something saying that I am not allowed to share the directories separately. So I would say the error message should say what is wrong, ie. "You cannot export a directory that is already exported as a subdirectory to the same host/network. Consider using -alldirs instead. Offending line: ......  previous overlapping line: .....". So I guess I'll file a PR.

/etc/exports

```
#works fine
/tank/somedataset1 -maproot=root -network somenetwork/16
/tank/somedataset1 -maproot=root someipaddress1
/tank/somedataset1 -maproot=root someipaddress2
/tank/somedataset1/somesubdir/somesubdir -maproot=root someipaddress4 #even this works
/tank/somedataset2 [B]-alldirs[/B] -maproot=root someipaddress3

#not needed anymore
#/tank/somedataset2/somesubdir -maproot=root someipaddress3
```


----------



## peetaur (Dec 21, 2011)

Possibly related PR: http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/109911


----------



## mworld (Feb 4, 2012)

*nullfs*



			
				peetaur said:
			
		

> Possibly related PR: http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/109911



One way around this is the mount everything with nullfs(5).


```
# fstab
/usr/src                /exports/src-fbsd9      nullfs ro       0       0
/usr/ports              /exports/ports          nullfs ro       0       0
/usr/ports/distfiles    /exports/distfiles      nullfs rw       0       0
```


```
# /etc/exports
/exports/src-fbsd9 -ro -mapall=nobody
/exports/ports -ro -mapall=nobody
/exports/distfiles -maproot=0 -network 192.168.0.0/19
/exports/distfiles -maproot=0 -network 2001:xxxx:xxxx:xxxx::/56
```


----------

