How can I create a virtual machine in a vagrant with a virtual box with two cpus?

On Windows 7, 64 bit is trying to start the VM (Ubuntu 32 bit). I am having trouble getting my virtual machine to show two kernels despite adding the modify vm command to my Vagrantfile. My stray version is 1.2.2.

 # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "precise32" config.vm.box_url = "http://files.vagrantup.com/precise32.box" config.vm.provider :virtualbox do |vb| vb.customize ["modifyvm", :id, "--memory", "2048"] vb.customize ["modifyvm", :id, "--cpus", "2"] end end 

With this Vagrantfile, I vagrant up command. Then I vagrant ssh and then lscpu , which gives:

 Architecture: i686 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 1 On-line CPU(s) list: 0 Thread(s) per core: 1 Core(s) per socket: 1 Socket(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 58 Stepping: 9 CPU MHz: 2565.513 BogoMIPS: 5131.02 L1d cache: 32K L1d cache: 32K L2d cache: 6144K 

I think CPU (s) should show 2, so my virtual machine only has one processor right now. How can I get 2 processors that will be displayed when lscpu starts?

+62
vagrant
Jun 14 '13 at 20:51
source share
3 answers

Add vb.customize ["modifyvm", :id, "--ioapic", "on"] to the config.vm.provider block inside your Vagrantfile.

Looking at the VirtualBox documentation, she mentions:

"Note: Enabling I / O APIC is required for working with 64-bit guest systems, especially Windows Vista; it is also necessary if you want to use more than one virtual processor in a virtual machine."

+76
Jun 15 '13 at 17:55
source share

If you use a firewall using Oracle Virtualbox, then the most common problem is Hyper-V on Windows 7, 8, or 10. This will limit you to a 32-bit and one processor.

Start or search for “Windows Features” and select “Enable or Disable Windows Features”.

In the checkboxes, make sure that Hyper-V is turned off - you cannot enable VT-x for Virtualbox with Microsoft Hyper-V supporting it.

Then you can make your Vagrantfile download very user friendly:

  config.vm.provider "virtualbox" do |vb| vb.memory = "2404" vb.cpus = "2" end 

Assuming you want to run two cores and just over 2 GB of memory

ps - do not forget to add your port forwarding. For PHPStorm (xdebug, mysql and web) I use:

  config.vm.network "forwarded_port", guest: 80, host: 8080 config.vm.network "forwarded_port", guest: 3306, host: 3306 config.vm.network "forwarded_port", guest: 9000, host: 9000 
+17
Mar 10 '15 at 23:37
source share

It seems you did not indicate which provider you are using. Starting with Vagrant 1.7, many VM providers (such as VirtualBox, HyperV) support the following configuration in your Vagrantfile:

 config.vm.provider "virtualbox" do |v| v.memory = 1024 v.cpus = 2 end 

Refer to the specific provider that you are using in the roaming documentation .

+3
May 28 '15 at 16:15
source share



All Articles