Cannot change file ownership from Vagrant VM
<p>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 <strong>create folder using puppet you have to specify its owner and group</strong> otherwise defaults are used. We have set <strong>default to root:root</strong> for some reason and this is <strong>applied to some other files / directories as well</strong>.</p>

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

<p>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 <strong>Vagrant</strong> and <strong>VirtualBox</strong>.</p>

<p>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 <strong>why puppet fails because of this only on NFS</strong>.</p>

<h3>Vagrantfile mount section</h3>

<pre><code>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
</code></pre>

<h3>Puppet log on NFS</h3>

<pre><code>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
</code></pre>

<h3>Puppet log on VirtualBox share</h3>

<pre><code>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'
</code></pre>

<h3>Directory listing after puppet run on NFS</h3>

<pre><code>drwxr-xr-x  4  501 dialout    136 Aug 19 05:40 .local
</code></pre>

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

<h3>Directory listing after puppet run on VirtualBox share</h3>

<pre><code>drwxr-xr-x  1 vagrant vagrant    136 Aug 19 05:40 .local
</code></pre>

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