Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to configure vagrant so that it doesn't try to create shared folders #1004

Closed
matighet opened this issue Jul 2, 2012 · 24 comments
Closed

Comments

@matighet
Copy link

matighet commented Jul 2, 2012

The shared folders are creating issues with my VMs right now, most likely because I don't have VirtualBox tools installed.
However, I don't really need shared folders, so ideally would like to disable that feature for my VMs.

Is there a way to disable shared folders in Vagrantfile?

Here is the error I'm getting:

{{{
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -t vboxsf -o uid=id -u proxyuser,gid=id -g proxyuser v-root /vagrant
}}}

@andy-zenjavi
Copy link

+1

@loe
Copy link

loe commented Aug 7, 2012

Vagrant.actions[:start].delete(Vagrant::Action::VM::ShareFolders)

@matighet
Copy link
Author

matighet commented Aug 7, 2012

Hi Andrew,

can you elaborate where to put this line?

Michael

On 8/7/2012 2:06 PM, W. Andrew Loe III wrote:

Vagrant.actions[:start].delete(Vagrant::Action::VM::ShareFolders)


Reply to this email directly or view it on GitHub
#1004 (comment).

Michael Atighetchi
Senior Scientist
Raytheon BBN Technologies
617-873-1679
matighet@bbn.com

@loe
Copy link

loe commented Aug 7, 2012

Pretty much anywhere? I put it above my config block:

# Remove Shared Folders, we're not using them and do not have the Virtualbox
# Tools.
Vagrant.actions[:start].delete(Vagrant::Action::VM::ShareFolders)

Vagrant::Config.run do |config|
end

@tomparkin
Copy link

I just wanted to chime in and add a +1 for this feature. For me this is really useful for VMs I use to test development builds of the Linux kernel. If I don't disable shared folders then "vagrant up" fails at the shared folder stage, and none of my provisioning runs.

As a workaround, adding the line loe mentioned above to my Vagrantfile works well, but I worry slightly that it's poking at Vagrant's internals and that as such it might well stop working in the future.

I'd really like to see an "official" way of disabling shared folders, even if it were just a matter of documenting the workaround.

@eduardodeoh
Copy link

+1 for this feature

@MJPA
Copy link

MJPA commented Mar 17, 2013

It appears this no longer works in v1.1.0. Does anyone have any recommendations for 1.1.0?

@mitchellh
Copy link
Contributor

If you're using VMware Fusion you can actually disable the shared folders:

config.vm.synced_folder ".". "/vagrant", id: "vagrant-root", disabled: true

Core doesn't yet have this feature but I will add it soon.

@mitchellh
Copy link
Contributor

Actually already committed and added. This will be part of 1.2. It already works with VMware, for now, though.

@swieton
Copy link

swieton commented Mar 21, 2013

I've been able to disable the auto mounting of /vagrant by using this specific line:

config.vm.share_folder "vagrant-root", nil, ".", guestpath: nil

You may want to give this workaround try to see if it solves your problems until 1.2 is released.

@petecheslock
Copy link

@swieton For v 1.x of vagrant your command won't work - I used this to disabled shared folders successfully on virtualbox:

config.vm.synced_folder(".", nil, :disabled => true, :id => "vagrant-root")

[freebsd] Configuring and enabling network interfaces...
[freebsd] Mounting shared folders...
[freebsd] -- Automounting disabled: .
[freebsd] Running provisioner: VagrantPlugins::Chef::Provisioner::ChefClient...

@klrmn
Copy link

klrmn commented Apr 23, 2013

I'm running Vagrant version 1.1.5 with VirtualBox, and I tried the following things in my Vagrantfile:

config.vm.synced_folder ".", nil, :disabled => true, :id => "vagrant-root"
described by @petecheslock and got
[snip]/Vagrantfile:115:in block (2 levels) in <top (required)>': undefined methodsynced_folder' for #VagrantPlugins::Kernel_V1::VMConfig:0x00000100a85ec0 (NoMethodError)

config.vm.share_folder "vagrant-root", nil, ".", guestpath: nil
described by @swieton and got
/Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/plugins/kernel_v2/config/vm.rb:257:in `initialize': can't convert nil into String (TypeError)

and
Vagrant.actions[:start].delete(Vagrant::Action::VM::ShareFolders)
described by @IoE and got
[snip]/Vagrantfile:109:in block (2 levels) in <top (required)>': undefined methodactions' for Vagrant:Module (NoMethodError)

has anyone got anything else I can try?

@mitchellh
Copy link
Contributor

@kirmn The first one is fine, but you ran it in an old V1 configuratin block. Run it in a V2 block.

See http://docs.vagrantup.com/v2/vagrantfile/version.html

@klrmn
Copy link

klrmn commented Apr 24, 2013

thanks for pointing that out @mitchellh.

when i switched from
Vagrant::Config.run do |config|
to
Vagrant.configure("2") do |config|
i got
/Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/plugins/kernel_v2/config/vm.rb:130:in `[]': can't convert Symbol into Integer (TypeError)

so i tried:
Vagrant.configure(2) do |config|
and got
/Applications/Vagrant/embedded/gems/gems/vagrant-1.1.5/lib/vagrant/config/loader.rb:104:in block (2 levels) in load': private methodload' called for nil:NilClass (NoMethodError)

this would be a lot easier if it were pointing to lines in my file

@jscheid
Copy link

jscheid commented Jul 2, 2013

@swieton's and @petecheslock's solutions didn't work for me. What works for me on Vagrant 1.2.2 with VirtualBox 4.2.14 is the following:

config.vm.synced_folder ".", "/vagrant", :disabled => true

So @mitchellh's solution works, unsurprisingly, I guess I was thrown off by the VMware reference. (The :id doesn't appear to be necessary anymore, but it also doesn't seem to break anything.)

Thanks to tscanausa and UForgotten for their help with figuring this one out.

@mitchellh: I think it would be good if one of the doc pages around http://docs.vagrantup.com/v2/synced-folders/index.html could mention this so people don't have to dive into github tickets to figure this one out.

@dvfabbri
Copy link

Hello,

The following correctly prevents the sharing of the vagrant folder:

config.vm.synced_folder ".", "/vagrant", :disabled => true

However, the following folder is still shared: /tmp/vagrant-chef-1/chef-solo-1/cookbooks. Is there any way to disable this?

I am using Vagrant 1.3.3.

Thanks!

@btobolaski
Copy link

I believe that the solution to that is to not use chef. Vagrant runs chef_solo on the box, so it needs to have the cookbooks available to it, so it uses a synced folder to make that happen.

aspiers pushed a commit to aspiers/vagrant that referenced this issue May 4, 2014
This caused a great deal of confusion e.g. as seen in

hashicorp#1004
aspiers pushed a commit to aspiers/vagrant that referenced this issue Oct 25, 2014
This caused a great deal of confusion e.g. as seen in

hashicorp#1004
@HarryWeppner
Copy link
Contributor

Is there a possible regression!? It no longer disables shared folders although the following config is set:

config.vm.synced_folder "./data", "/vagrant_data", disabled: true
$ vagrant version
Installed Version: 1.6.5
Latest Version: 1.6.5

$ vagrant plugin list | grep vmware
vagrant-vmware-fusion (3.1.0)

@madelaney
Copy link

I'm seeing the same issue with Vagrant 1.7.2 and VirtualBox

Installed Version: 1.7.2
Latest Version: 1.7.2

You're running an up-to-date version of Vagrant!

@tuscland
Copy link

+1

@jakeczyz
Copy link

I seem to only have problems with synced folders after my initial build and boot. Since they aren't really supported/useful for cloud environments (e.g., aws, digital ocean), I don't really want/need them locally. I do, however, need my vagrant folder itself to sync to /vagrant, but it can happen using rsync, as happens for the cloud. Is there a clean way to disable synced/shared/mounted /vagrant folder but continue to be able to rsync its contents once on build? I'm running the latest vagrant and vbox. Thanks!

@vhosakot
Copy link

When I did vagrant up with the box centos/7 (virtualbox, 1703.01), ==> default: Rsyncing folder: /root/ => /vagrant was stuck for me too, and adding
config.vm.synced_folder '.', '/vagrant', disabled: true
in Vagrantfile resolved the issue for me and rsync did not happen.

@tzakrajs
Copy link

tzakrajs commented Feb 6, 2019

Sorry for bumping this thread once again. This fix (adding config.vm.synced_folder '.', '/vagrant', disabled: true the Vagrantfile) allowed me launch a vagrant machine using Windows Subsystem for Linux when seeing the error: The host path of the shared folder is not supported from WSL. I typically run vagrant up from a bash shell in Ubuntu for Windows and whenever I did so from a Linux path (not in /mnt/c/) the preceding error appeared.

@ghost
Copy link

ghost commented Mar 28, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests