config.vm.synced_folder ignored in default Vagrantfile

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

config.vm.synced_folder ignored in default Vagrantfile

Krist van Besien
Hello all,

I created my own box, and the box, and the Vagrantfile included in the box has the following content:

Vagrant.configure("2") do |config|
        config
.vm.provider :libvirt do |libvirt|
          libvirt
.disk_bus = 'virtio'
       
end
        config
.vm.synced_folder  ".", "/vagrant", disabled: true
end


However this setting is ignored. After doing a "vagrant init <mybox>" I need to edit the Vagrantfile manually to again disable the synced folder.

Why is that?






--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/317ab26a-7323-4b15-98a7-69d97a6d11bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: config.vm.synced_folder ignored in default Vagrantfile

Jamie Jackson
If I understand the question correctly, you're saying you've built a box and now you're trying to use it.

When you `vagrant init` you're creating a generic Vagrantfile, but it will have the config.vm.box value set to the box you inited with. When you `vagrant up` with that Vagrantfile, Vagrant will create that vagrant synced folder. If you don't want that in your running VM, you'll need to add that disabling line to the Vagrantfile. This also means that the Vagrantfile that you run your box with is important, and you'll want to keep it (e.g., in SCM), so don't `vagrant init` on top of it.

I might be assuming too much, but have you worked with any public boxes yet? If not, it might be confusing to try to grok box creation and box consumption all at once. It's probably easier to work with a public box and do a little provisioning (in Vagrantfile) to see how that part works before building your own boxes.

On Fri, Jul 7, 2017 at 11:44 AM, Krist van Besien <[hidden email]> wrote:
Hello all,

I created my own box, and the box, and the Vagrantfile included in the box has the following content:

Vagrant.configure("2") do |config|
        config
.vm.provider :libvirt do |libvirt|
          libvirt
.disk_bus = 'virtio'
       
end
        config
.vm.synced_folder  ".", "/vagrant", disabled: true
end


However this setting is ignored. After doing a "vagrant init <mybox>" I need to edit the Vagrantfile manually to again disable the synced folder.

Why is that?






--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/317ab26a-7323-4b15-98a7-69d97a6d11bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CA%2BonWPe28brPP7MBaZR%3Da%2BjaN2c%3DMkzrP93GdCOgGQCyBRSoXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: config.vm.synced_folder ignored in default Vagrantfile

Salty Vagrant
In reply to this post by Krist van Besien

I suspect this is simply a misunderstanding of the vagrant commands.

Once you have your edited Vagrantfile (with the synced_folder disabled) you should use ‘vagrant up’ NOT ‘vagrant init’.

‘vagrant init’ creates a new Vagrantfile and sets the vm/box to the value you provide on the command line (this will overwrite the one you previously created).

‘vagrant up’ on the other hand will start the VM specified by the Vagrantfile.


On 7 Jul 2017, at 16:44, Krist van Besien wrote:

Hello all,

I created my own box, and the box, and the Vagrantfile included in the box has the following content:

Vagrant.configure("2") do |config|
        config
.vm.provider :libvirt do |libvirt|
          libvirt
.disk_bus = 'virtio'
       
end
        config
.vm.synced_folder  ".", "/vagrant", disabled: true
end


However this setting is ignored. After doing a "vagrant init <mybox>" I need to edit the Vagrantfile manually to again disable the synced folder.

Why is that?






--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/317ab26a-7323-4b15-98a7-69d97a6d11bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/68126A9F-8956-4D96-9638-CB05F372CCD8%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: config.vm.synced_folder ignored in default Vagrantfile

Krist van Besien
I've been using Vagrant extensively. So I know the difference between init and up.

My problem is the following:

- I created a box myself, by packaging an image, together with a Vagrantfile and a Metadata.json file.
- In that Vagrantfile I have the following content:

Vagrant.configure("2") do |config|
        config
.vm.provider :libvirt do |libvirt|
          libvirt
.disk_bus = 'virtio'
       
end
        config
.vm.synced_folder  ".", "/vagrant", disabled: true
end

So I tarred/ziped those three files in to a new box, and imported that in to Vagrant.

Then I tested this. I created a new directory, and in that directory I did:

vagrant init newbox
vagrant up

What I expected to happen:

The box is started, but no synced folder is setup.

What I got:

Box is started, and vagrant attempts to setup a synced folder, which fails on this particular image. (and this is why I want it to be disabled by default)

In other words, I expect (and the documentation has led me to expect this) that the config you put in the Vagrantfile you package in a box is interpreted as a default for that box, and that this config is merged with the Vagrantfile created by vagrant init in your working directory. In other words, I expect to be able to set defaults in a box.

Are my expectations incorrect? Or did I do something wrong? Or is this a bug?







On Friday, 7 July 2017 17:47:38 UTC+1, Salty Vagrant wrote:

I suspect this is simply a misunderstanding of the vagrant commands.

Once you have your edited Vagrantfile (with the synced_folder disabled) you should use ‘vagrant up’ NOT ‘vagrant init’.

‘vagrant init’ creates a new Vagrantfile and sets the vm/box to the value you provide on the command line (this will overwrite the one you previously created).

‘vagrant up’ on the other hand will start the VM specified by the Vagrantfile.


On 7 Jul 2017, at 16:44, Krist van Besien wrote:

Hello all,

I created my own box, and the box, and the Vagrantfile included in the box has the following content:

Vagrant.configure("2") do |config|
        config
.vm.provider :libvirt do |libvirt|
          libvirt
.disk_bus = 'virtio'
       
end
        config
.vm.synced_folder  ".", "/vagrant", disabled: true
end


However this setting is ignored. After doing a "vagrant init <mybox>" I need to edit the Vagrantfile manually to again disable the synced folder.

Why is that?






--
This mailing list is governed under the HashiCorp Community Guidelines - <a href="https://www.hashicorp.com/community-guidelines.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.hashicorp.com%2Fcommunity-guidelines.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGHa_CaKfZaJiwbkUndUQbVGlQCDw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.hashicorp.com%2Fcommunity-guidelines.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGHa_CaKfZaJiwbkUndUQbVGlQCDw&#39;;return true;">https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: <a href="https://github.com/mitchellh/vagrant/issues" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmitchellh%2Fvagrant%2Fissues\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHxcA5DuHlQlPInMi_k1Pz4pMNqNw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmitchellh%2Fvagrant%2Fissues\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHxcA5DuHlQlPInMi_k1Pz4pMNqNw&#39;;return true;">https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="TOymrC0nBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">vagrant-up+...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/vagrant-up/317ab26a-7323-4b15-98a7-69d97a6d11bd%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/vagrant-up/317ab26a-7323-4b15-98a7-69d97a6d11bd%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/vagrant-up/317ab26a-7323-4b15-98a7-69d97a6d11bd%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/vagrant-up/317ab26a-7323-4b15-98a7-69d97a6d11bd%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/5345e486-c18f-4d34-93a3-62b03e557dad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: config.vm.synced_folder ignored in default Vagrantfile

Alvaro Miranda Aguilera
hello

can you check the file is there once untarred by Vagrant?

find ~/.vagrant.d/boxes

if you add

puts __FILE__

it should print the name of the file when you run any command, ie vagrant status

this is helpful to confirm is being loaded.

if thats the case, then could you open an issue on github?

Thanks
Alvaro

On Wed, Jul 12, 2017 at 2:47 AM, Krist van Besien <[hidden email]> wrote:
I've been using Vagrant extensively. So I know the difference between init and up.

My problem is the following:

- I created a box myself, by packaging an image, together with a Vagrantfile and a Metadata.json file.
- In that Vagrantfile I have the following content:

Vagrant.configure("2") do |config|
        config
.vm.provider :libvirt do |libvirt|
          libvirt
.disk_bus = 'virtio'
       
end
        config
.vm.synced_folder  ".", "/vagrant", disabled: true
end

So I tarred/ziped those three files in to a new box, and imported that in to Vagrant.

Then I tested this. I created a new directory, and in that directory I did:

vagrant init newbox
vagrant up

What I expected to happen:

The box is started, but no synced folder is setup.

What I got:

Box is started, and vagrant attempts to setup a synced folder, which fails on this particular image. (and this is why I want it to be disabled by default)

In other words, I expect (and the documentation has led me to expect this) that the config you put in the Vagrantfile you package in a box is interpreted as a default for that box, and that this config is merged with the Vagrantfile created by vagrant init in your working directory. In other words, I expect to be able to set defaults in a box.

Are my expectations incorrect? Or did I do something wrong? Or is this a bug?







On Friday, 7 July 2017 17:47:38 UTC+1, Salty Vagrant wrote:

I suspect this is simply a misunderstanding of the vagrant commands.

Once you have your edited Vagrantfile (with the synced_folder disabled) you should use ‘vagrant up’ NOT ‘vagrant init’.

‘vagrant init’ creates a new Vagrantfile and sets the vm/box to the value you provide on the command line (this will overwrite the one you previously created).

‘vagrant up’ on the other hand will start the VM specified by the Vagrantfile.


On 7 Jul 2017, at 16:44, Krist van Besien wrote:

Hello all,

I created my own box, and the box, and the Vagrantfile included in the box has the following content:

Vagrant.configure("2") do |config|
        config
.vm.provider :libvirt do |libvirt|
          libvirt
.disk_bus = 'virtio'
       
end
        config
.vm.synced_folder  ".", "/vagrant", disabled: true
end


However this setting is ignored. After doing a "vagrant init <mybox>" I need to edit the Vagrantfile manually to again disable the synced folder.

Why is that?






--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/317ab26a-7323-4b15-98a7-69d97a6d11bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/5345e486-c18f-4d34-93a3-62b03e557dad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0exOdFuEOpy2_MQg0xJASmqK8JAKoOhWgJSGZ5jUfcSqKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.