1
votes

I have been using NFS mounts in my Vagrant VM for months without any problems running our puppet provisioning. As you can know each time you create folder using puppet you have to specify its owner and group otherwise defaults are used. We have set default to root:root for some reason and this is applied to some other files / directories as well.

Puppet trying to chown file to root:root and it fails but it should not because chown exits with 0 without changing the owner or group. This behavior is same on NFS and VirtualBox Share but puppet fails only when using NFS share.

The question is - is there any reasonable explanation why puppet has started to fail on changing ownership of files? It used to work for months and I'm still running the same version of Vagrant and VirtualBox.

I have found a lot of questions regarding similar problem (changing ownership) and found it is ok that owner and group is not changed. I just don't know why puppet fails because of this only on NFS.

Vagrantfile mount section

config.vm.synced_folder "../puppet", "/root/puppet", type: "nfs", mount_options: ["rw", "tcp", "fsc", "nolock", "noacl", "async"], nfs_udp: false
config.vm.synced_folder ".", "/media/src/project", type: "nfs", mount_options: ["rw", "tcp", "fsc", "nolock", "noacl", "async"], nfs_udp: false

Puppet log on NFS

Info: Applying configuration version '1471704237'
Notice: /Stage[main]/Farm_tooling::Webgrind/Exec[configure]/returns: executed successfully
Notice: /Stage[main]/Ulozto::Web::Lab/File[/media/src/ulozto/.local/]/owner: owner changed '501' to 'root'
Error: Failed to set group to '0': Operation not permitted @ lchown_internal - /media/src/ulozto/.local
Error: /Stage[main]/Ulozto::Web::Lab/File[/media/src/ulozto/.local/]/group: change from dialout to root failed: Failed to set group to '0': Operation not permitted @ lchown_internal - /media/src/ulozto/.local

Puppet log on VirtualBox share

Info: Applying configuration version '1471704248'
Notice: /Stage[main]/Farm_tooling::Webgrind/Exec[configure]/returns: executed successfully
Notice: /Stage[main]/Ulozto::Web::Lab/File[/media/src/ulozto/.local/]/owner: owner changed 'vagrant' to 'root'
Notice: /Stage[main]/Ulozto::Web::Lab/File[/media/src/ulozto/.local/]/group: group changed 'vagrant' to 'root'
Notice: /Stage[main]/Ulozto::Pornfile::Remote/File[/var/www/pornfile-web/PornFile/App]/owner: owner changed 'vagrant' to 'root'

Directory listing after puppet run on NFS

drwxr-xr-x  4  501 dialout    136 Aug 19 05:40 .local

I actually do not know what dialout is but 501 is ID of my account - uid=501(northys). After puppet run owner is still the same.

Directory listing after puppet run on VirtualBox share

drwxr-xr-x  1 vagrant vagrant    136 Aug 19 05:40 .local

After puppet run owner and group is still vagrant:vagrant but puppet didn't fail on changing it like in NFS mount case.

1
Puppet log claims that the group permissions on that nfs mount are not what you think they are. - Matt Schuchard
Is there anything I can do to fix it? I swear I'm using the same configuration for months so I'm really confused why it has stopped working. - Northys
The puppet logs claim that the nfs mount directory of /var/www/project/Lorem/App is owned by a group dialout and not root. This discounts your claim that it is owned by the root group. Why it is that the directory has the group dialout I cannot guess from the information provided. Why it is that puppet cannot change the group permission is probably because it was not mounted with that capability allowed. I have to speculate on some of this given the information provided. - Matt Schuchard
I claimed that we have set root:root as default for manipulating (creating, moving...) files with puppet not that all files are owned by root:root - little misunderstanding, sorry. I tried both NFS and VirtualBox Share now and all files are owned by vagrant:vagrant, never changed and puppet just ignores it - this is what am I asking. Why is it okay that changing owner to root fails on share but not okay when fails on NFS? I have added more information to question. - Northys
Well then this is a nfs filesystem versus nfs mount permissions question. If this was puppet/vagrant then I could help, but nfs filesystem versus mount permissions is more of a sysadmin thing. Sorry. - Matt Schuchard

1 Answers

1
votes

I found the answer for this here https://serverfault.com/questions/487862/vagrant-os-x-host-nfs-share-permissions-error-failed-to-set-owner-to-1000

In my VagrantFile, I added this to the mapping to get it to work:

:linux__nfs_options => ["no_root_squash"], :map_uid => 0, :map_gid => 0