I managed to setting up my Symfony2 project inside a ubuntu vagrant box. But it takes around 20 seconds to load the website through it's webserver. After some research, i came up with using nfs for the sync folder. Here're my setting from Vagrantfile:
config.vm.network "private_network", ip: "192.168.56.101"
config.vm.synced_folder ".", "/vagrant", :nfs => true, :mount_options => ["dmode=777","fmode=777"]
After starting de vagrant box i get the following error
==> default: Mounting NFS shared folders...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mount -o 'dmode=777,fmode=777' 192.168.56.1:'/Users/marcschenk/Projects/teleboy.ch' /vagrant
Stdout from the command:
Stderr from the command:
stdin: is not a tty
mount.nfs: an incorrect mount option was specified
The VM seems to work, but the synced folder's obviously empty. What did i wrong?
My setup:
Vagrant 1.6.5 & Virtualbox 4.3.18
Host: OS X 10.10
Guest: Ubuntu 12.04
Found the solution for the problem here https://github.com/mitchellh/vagrant/issues/2546
The correct syntax for vagrant version 1.3 to 1.6 is:
config.vm.synced_folder ".", "/vagrant", :nfs => { :mount_options => ["dmode=777","fmode=777"] }
Related
I have added debian os to vagrant, then run vagrant up command, but it will throw the following error.
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mount -o 'vers=3,udp' 192.168.56.1:'/u01/ChennaiBox/mage2_vagrant' /vagrant
Stdout from the command:
Stderr from the command:
stdin: is not a tty
mount.nfs: Connection timed out
Next i added /etc/sudoers
vagrant ALL=(ALL) NOPASSWD:ALL
Defaults:vagrant !requiretty
This is My Syn_Folder code in vagrantfile:
if Vagrant::Util::Platform.windows?
config.vm.synced_folder ".", "/vagrant", :mount_options => ["dmode=777", "fmode=777"]
else
# config.vm.synced_folder ".", "/vagrant", :nfs => { :mount_options => ["dmode=777", "fmode=777"] }
config.vm.synced_folder ".", "/vagrant", type: "nfs", mount_options: ["dmode=777", "fmode=777"]
#rsync_args = ['--verbose', '--archive', '-z']
#config.vm.synced_folder ".", "/vagrant",
# rsync__args: rsync_args, rsync__exclude: ['.vagrant/'], rsync__auto: true, type: 'rsync'
end
Now also throw same error, suggest me how to solve this problem.
I solve my Problem to stop firewall
Using follwing command:
systemctl stop firewalld
Its worked for me.
i had the same problem suddelny vagrant up doesn't work any more and the error msg "mount.nfs: Connection timed out". was shown
i just remove the old version of vagrant and download the new version "2.2.4"
After a lot of review trying to use rsync in Vagrant with Docker as provider. (bidirectional sync)
I moved on to use nfs to sync my files inside the VM boot2docker
I have this vagrant error message after vagrant up
dockerhost: Mounting NFS shared folders...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mount -o 'vers=3,udp' 192.168.50.1:'/Users/myMac/workspace/docker-vagrant/test' /project
Stdout from the command:
Stderr from the command:
mount: RPC: Unable to receive; errno = No route to host
mount: mounting 192.168.50.1:/Users/myMac/workspace/docker-vagrant/test on /project failed: Bad file descriptor
Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "dduportal/boot2docker"
config.vm.define "dockerhost"
config.vm.network "forwarded_port", guest: 8000, host: 8000
config.vm.network "private_network", ip: "192.168.50.4"
config.vm.synced_folder "../", "/project", type: "nfs"
...
My mac already have nfs because started up the service using nfsd start
In the Vagrant documentation recommend to use rsync but I didn't find a way to rsync from VM to my MAC and vice versa.
I'm using
Mac Yosemite
Vagrant 1.8.1
VM dduportal/boot2docker
I posted my question directly on the dduportal/boot2docker project.
and this is the correct configuration if you have your custom Docker Host in different directory.
config.vm.synced_folder "../", "/vagrant", type: "nfs", mount_options: ["nolock", "vers=3", "udp"], id: "nfs-sync"
Reference:
https://github.com/dduportal/boot2docker-vagrant-box/issues/48
In my Vagrantfile (Vagrant 1.7.4) I have the following:
config.vm.synced_folder ".", "/home/vagrant/sync", type: "rsync", :mount_options => ["dmode=777", "fmode=666"], rsync__exclude: [".git/"]
When I issue vagrant up, it outputs the following:
==> default: Rsyncing folder: /project/ => /home/vagrant/sync
==> default: - Exclude: [".vagrant", ".git/",]
==> default: Mounting shared folders...
default: /vagrant => /project
I don't understand why there is a shared and a synced folder. I'm using virtualbox so i understand these are the same but I just want a shared folder - why are there 2?
So first sync folder is the Vagrant term for Virtual Box shared folder, so you're correct to say the 2 are the same. Now coming to your question,
By default, Vagrant will share your project directory (the directory
with the Vagrantfile) to /vagrant.
This is defined as config.vm.synced_folder ".", "/vagrant"; so this one always comes, if you define or not new sync folder.
If you want not to have the default sync folder, you can add the following to your Vagrant file
config.vm.synced_folder ".", "/vagrant", disabled: true
I am having trouble accessing files through Vagrant on Windows. I have been using it on OS X for quite some time and have my Vagrantfile setup correctly which works every time.
I have sent my colleague the same Vagrant file, he is on Windows and receives 'Permission Denied' when trying to access files through the browser.
Just to be clear, the permission errors are returned by the server when accessing 'dev.local' in the browser and not from Vagrant itself... it will be a configuration error on Windows or within the VM.
The VM is CentOS 6.5
Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "chef/centos-6.5"
config.vm.network "private_network", ip: "192.168.33.21"
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.provision :shell, :path => "install.sh"
config.vm.hostname = "dev.local"
config.vm.synced_folder ".", "/home", id: "vagrant", :nfs => false, :mount_options => ["dmode=777","fmode=777"]
config.ssh.insert_key = false
config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
end
Can any Windows Vagrant users shed any light on this?
It was VBGuestAdditions out of date. The permission error was caused by not being able to sync to my local folder (which contained an index.php) so it was using the servers /home folder which didn't contain anything and since viewing directory structure is disabled it returned permission errors.
I had 4.X.X installed, and VirtualBox is on 5.X.X Here is the fix:
run command: vagrant plugin install vagrant-vbguest
the run vagrant up which may still throw an error as the plugin fails to copy a file.
vagrant ssh to get into the box and run the following command:
sudo ln -s /opt/VBoxGuestAdditions-5.X.X/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
Replace 5.X.X with the version of your VirtualBox.
logout and run vagrant reload
do a happy dance
I am getting this error with this line in my Vagrantfile during vagrant up, until I comment it out.
The setting is documented here:
http://docs-v1.vagrantup.com/v1/docs/config/vm/share_folder.html
Not sure why the following documented paramenter causes an error
config.vm.share_folder "puppetdir", "/etc/puppet", "/vagrant/mypuppetdir"
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:
vm:
* The following settings don't exist: share_folder
The latest virtualbox and latest vagrant. everything else works fine.
On Vagrant 1.1+ you should use config.vm.synced_folder, the docs you are looking at are for older versions. Please refer to the updated documentation for more info: http://docs.vagrantup.com/v2/synced-folders/basic_usage.html
Shared Folders has been renamed to Synded Folder since 1.1.
In your Vagrantfile you should be using the following
config.vm.synced_folder "../data", "/vagrant_data"
# by default enabled, uncomment to disable
# config.vm.synced_folder ".", "/vagrant", disabled: true
NOTE: By default, Vagrant will share your project directory (the directory where Vagrantfile resides) to /vagrant.
config.vm.synced_folder ".", "/vagrant", disabled: true
More flexible example
vagrant_data = File.expand_path("../vagrant_data", __FILE__)
Dir::mkdir(vagrant_data) unless FileTest::directory?(vagrant_data)
config.vm.synced_folder "vagrant_data", "/vagrant_data"
Take a look at this for more information => shared folders VS synced folders
Extending from https://github.com/mitchellh/vagrant/issues/936#issuecomment-7179034
if you need to mount a volume as a user that doesn't exist when the vm boots you can get there like so:
# Vagrantfile line
config.vm.synced_folder "host_folder", "/svr/fake_mount_folder", id: "whatever_name"
# ...
config.vm.provision "shell", inline: <<-SHELL
# ...
# In my case a package installed a user with UID 110, GID 116
mount -t vboxsf -o uid=110,gid=116 whatever_name /media/actual_mounted_folder
# ...
SHELL