Josh Nankin
Josh Nankin

Reputation: 2568

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

Upvotes: 6

Views: 3095

Answers (1)

btobolaski
btobolaski

Reputation: 168

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

Upvotes: 9

Related Questions