I am a Vagrant and Puppet newbie, I have created a Base Box with Debian Squeeze plus standalone Puppet, using the instructions here to install Puppet with the Puppetlabs packages.

The box itself seems to import successfully but once I get onto provisioning it, I get errors that seem to be to do with the nfs share on the host. 1000 is the uid of the Vagrant user on the vm.


Error: Failed to set owner to '1000': Operation not permitted - /vagrant/www/index.php
Error: /Stage[main]/Perchdemo::Sites::Create/File[/vagrant/www/index.php]/owner: change from 501 to vagrant failed: Failed to set owner to '1000': Operation not permitted - /vagrant/www/index.php

This occurs when I copy the index.php file into the share /vagrant/www on the host filesystem using Puppet. I have used this Puppet module on a standalone install of Puppet on a vm where the files were hosted on the filesystem of the vm, ideally though I'd like them to be on the nfs share.

Edited with a bit more information. Having had a poke around the error initially occurs when I create the vhost using the puppetlabs apache module. However whichever user I try and force that to create under, it fails with the same error.

My VagrantFile for this is as follows.

Vagrant::Config.run do |config|

  config.vm.box = "squeeze64"

  config.vm.network :hostonly, ""

  config.nfs.map_uid = :auto
  config.nfs.map_gid = :auto

  config.vm.forward_port 80, 8080

  config.vm.share_folder("v-web", "/vagrant/www", "./www", :nfs => true)

  config.vm.provision :shell, :inline => "echo \"Europe/London\" | sudo tee /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata"

  config.vm.provision :shell, :inline => "apt-get update --fix-missing"
  config.vm.provision :shell, :inline => "apt-get upgrade"

  config.vm.provision :puppet do |puppet|
     puppet.facter = { "fqdn" => "perchtutorial.eoms"}
     puppet.manifests_path = "puppet/manifests"
     puppet.manifest_file  = "perchtutorial.pp"
     puppet.module_path = "puppet/modules"


To get rid of this permissions issue, here is what I added to my Vagrantfile :

if (/darwin/ =~ RUBY_PLATFORM) != nil
    config.vm.synced_folder ".", "/host/path/to/shared/folder", nfs: true, :bsd__nfs_options => ["-maproot=0:0"]
    config.vm.synced_folder ".", "/host/path/to/shared/folder", nfs: true, :linux__nfs_options => ["no_root_squash"]

It will adapt the NFS options according to your host OS (OSX or Linux).

  • 1
    Small correction for the :bsd__nfs_options: the minus prefix for the maproot argument should not be included as Vagrant will add it for you. – danieldkim Jul 6 '16 at 4:54

This might be caused by "root squashing" on the NFS server.

When the root user on an NFS client machine tries to manipulate files on an exported NFS filesystem, it does so with the permissions of an unprivileged user (usually nobody or nfsnobody). In this case, if I'm reading correctly, it may be that Puppet (running as root) cannot manipulate files on the NFS server because its permissions are being mapped to this unprivileged user.

To remove root squashing, edit /etc/exports on the NFS server, and add no_root_squash to the options for the exported filesystem, then run exportfs -av to re-export the filesystems.

Example /etc/exports line:

/srv (rw,no_root_squash)

mbarthelemy answer got me halfway there, but in the end, I had to tweak a little more:

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

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.