Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do the memory and cpu settings on Vagrant fail?

I have this in my Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.provider "virtualbox" do |v|
    v.memory = 2056
    v.cpus = 2
  end
end

I'm getting this:

There are errors in the configuration of this machine. Please fix
the following errors and try again:

VirtualBox:
* The following settings don't exist: cpus, memory

However, these settings are listed explicitly in the vagrant documentation here: http://docs.vagrantup.com/v2/virtualbox/configuration.html

like image 315
Josh Nankin Avatar asked May 21 '14 18:05

Josh Nankin


People also ask

How do I allocate more memory to vagrant?

You can easily increase your VM's RAM by modifying the memory property of config. vm. provider section in your vagrant file. This allocates about 4GB of RAM to your VM.

Does vagrant require VirtualBox?

Vagrant comes with support out of the box for VirtualBox, a free, cross-platform consumer virtualization product. The VirtualBox provider is compatible with VirtualBox versions 4.0.

How do I change my default provider on vagrant?

In fact, this is quite common. To make this experience better, Vagrant allows specifying the default provider to use by setting the VAGRANT_DEFAULT_PROVIDER environmental variable. Just set VAGRANT_DEFAULT_PROVIDER to the provider you wish to be the default.


1 Answers

The first thing that I would do is check the version of Vagrant that you are using (vagrant -v). I believe that both of those shortcuts were added in version 1.5 but, it might have been 1.6. I would recommend upgrading to the latest version, 1.6.2.

If you would like to do this in a way that will work with all versions of Vagrant, you can do by specifying those values like this:

Vagrant.configure("2") do |config|
  config.vm.provider "virtualbox" do |v|
     v.customize ["modifyvm", :id, "--memory", "2048"]
     v.customize ["modifyvm", :id, "--cpus", "2"]
  end
end
like image 82
btobolaski Avatar answered Oct 03 '22 18:10

btobolaski