Vagrant: Failed to upload a file to the guest VM via SCP due to a permissions

Created on 11 Jan 2014  Â·  18Comments  Â·  Source: hashicorp/vagrant

I am trying to reprovision a VM and I am getting the following error:

Applications/Vagrant/bin/../embedded/gems/bin/vagrant:23:in `<main>'
 INFO interface: error: Failed to upload a file to the guest VM via SCP due to a permissions
error. This is normally because the user running Vagrant doesn't have
read permission on the file. Please set proper permissions on the file:

/var/folders/wb/w7qzyksn56gc8pz5mjczx0kc0000gn/T/vagrant20140110-28495-1q6u63s
Failed to upload a file to the guest VM via SCP due to a permissions
error. This is normally because the user running Vagrant doesn't have
read permission on the file. Please set proper permissions on the file:

/var/folders/wb/w7qzyksn56gc8pz5mjczx0kc0000gn/T/vagrant20140110-28495-1q6u63s

However this file on the host system does not exist

# jdyer at retina in ~/Projects/chef/site-cookbooks/tropo-portal on git:12.5.0 x [22:24:22]
$ ls -la /var/folders/wb/w7qzyksn56gc8pz5mjczx0kc0000gn/T/vagrant20140110-28495-1q6u63s
gls: cannot access /var/folders/wb/w7qzyksn56gc8pz5mjczx0kc0000gn/T/vagrant20140110-28495-1q6u63s: No such file or directory

Environment Settings:
OSX 10.9
Vagrant 1.4.2
Virtualbox 4.3.6

Most helpful comment

Try this command sudo chmod 777 /tmp

All 18 comments

The file only exists for the duration of the process. Do you have a weird umask yet?

Not sure what your asking, I am not doing anything new that I can think of
that would have any thing to do w/ permissions

On Fri, Jan 10, 2014 at 10:42 PM, Mitchell Hashimoto <
[email protected]> wrote:

The file only exists for the duration of the process. Do you have a weird
umask yet?

—
Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant/issues/2804#issuecomment-32085526
.

That's really odd. Can you reliably reproduce this or was this a one-time thing?

I've seen that error coming also from permission errors on the guest. If the error is reproduceable, the Vagrantfile and debug output (in a gist) would help.

Agreed, if you can get us a clear reproduction case, this will be an easy fix. At the moment, I have no leads to go on, sorry!

I'm getting this error while attempting to create this box: https://github.com/promptworks/vagrant-cloudstack-simulator

I'm using Vagrant 1.4.3 and VirtualBox 4.3.6. Am I creating the box incorrectly?

Vagrant.configure("2") do |config|
  config.vm.box = "cloudstack-simulator"
  config.vm.box_url = "https://dl.dropboxusercontent.com/u/4153969/PromptWorks/cloudstack-simulator.box"

  config.vm.network "private_network", ip: "33.33.33.101"

  config.vm.provider "virtualbox" do |vbox|
    vbox.memory = 2048
  end
end
$ time vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'cloudstack-simulator'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Running 'pre-boot' VM customizations...
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] Configuring and enabling network interfaces...
Failed to upload a file to the guest VM via SCP due to a permissions
error. This is normally because the user running Vagrant doesn't have
read permission on the file. Please set proper permissions on the file:

/var/folders/gz/5xvm5fkx79bdr3bnbchj68980000gn/T/vagrant20140127-16970-qzam55

real    0m56.682s
user    0m5.687s
sys     0m2.791s

@justincampbell please run with --debug option and gist all the output.

@justincampbell, btw, you shouldn't use 33.33.33.* addresses as it's a valid network owned by someone. Better to use private networks like 192.168.0.0/16 or 10.0.0.0/8.

@justincampbell thanks! Could you confirm that the /tmp/vagrant-network-entry_1 doesn't exist on the VM and/or the "vagrant" user would have write permissions to it? My guess is that the Tempfile used to generate configuration is garbage collected too early and deleted.

@tmatilai Probably this then https://github.com/promptworks/vagrant-cloudstack-simulator/blob/master/bootstrap.sh#L72

I'll change it to rm -rf /tmp/* and try again

I think we should change the error message to include also the destination path, as the permission error could really be on both ends. /cc @mitchellh

@tmatilai Looking at the implementation and the error text, I think it is erroneously displaying from instead of to.

@justincampbell I think it's more common to have permission problems in the from path, so that's why it was chosen in the error message. But IMHO it should show both from and to, as Vagrant can't know where the error was (at least without parsing the scp error message more).

If you're stuck with this: make sure you check permissions on /tmp/ on the vagrant box before pulling your hair out. /tmp/ wasn't writable on the VAGRANT BOX and it caused this error message.

Try this command sudo chmod 777 /tmp

I have the same problem and
sudo chmod 777 /tmp
works for me.

I have the experience of only realistically being able to provision files (or in my case an entire folder with [web.vm.provision :file, source: "../elasticsearch_config", destination: "/some/where/elasticsearch_config"]) into the default /vagrant shared mount OR somwehere on the VM previously created by the vagrant user.

If I try to provision into /tmp (which is 777) or even into /home/vagrant then I get these permission errors we are talking about.

It seems cheesy to me that, before I provision the file upload, I have to provision the creation of an appropriate folder on the VM. My /vagrant mount is version controlled and so I don't want to put these throwaway things in there.

Hmmm...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

OtezVikentiy picture OtezVikentiy  Â·  3Comments

DreadPirateShawn picture DreadPirateShawn  Â·  3Comments

RobertSwirsky picture RobertSwirsky  Â·  3Comments

lebogan picture lebogan  Â·  3Comments

janw-me picture janw-me  Â·  3Comments