在 Vagrant 客户机上启用 Intel VT-x

在 Vagrant 客户机上启用 Intel VT-x

我正在运行 OSX Mavericks,并且我知道硬件虚拟化已启用。我在 Vagrant 中有一个 debian VM,其中有一个支持硬件虚拟化的虚拟 CPU,但 vmx 标志被禁用。这是一个问题,因为我想在我的 debian VM 中使用 KVM。我需要做什么才能在 debian 客户机操作系统上启用(虚拟)硬件虚拟化?作为参考,cat /proc/cpuinfo 的输出如下:

Last login: Wed Aug 20 17:01:35 2014 from 10.0.2.2
vagrant@vagrant-debian-wheezy:~$ cat /proc/cpuinfo
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 42
model name  : Intel(R) Core(TM) i5-2557M CPU @ 1.70GHz
stepping    : 7
cpu MHz     : 1743.766
cache size  : 6144 KB
fpu     : yes
fpu_exception   : yes
cpuid level : 5
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36     clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc rep_good nopl pni monitor ssse3   lahf_lm

bogomips :3487.53 clflush 大小:64 cache_alignment:64 地址大小:36 位物理,48 位虚拟 电源管理:

答案1

Virtualbox 不支持嵌套虚拟化,因此您无法使用它来做您想做的事情。但是 VMWare Fusion (OS X) 和 VMWare Workstation (Linux/Windows) 支持此功能并允许您启用嵌套虚拟化:

查看示例(注意 vmx 标志):

tmp2 -> vagrant up
Bringing machine 'default' up with 'vmware_fusion' provider...
==> default: Checking if box 'puppetlabs/ubuntu-14.04-64-nocm' is up to date...
==> default: Verifying vmnet devices are healthy...
==> default: Preparing network adapters...
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Starting the VMware VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 172.16.102.159:22
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Forwarding ports...
    default: -- 22 => 2200
==> default: Configuring network adapters within the VM...
==> default: Waiting for HGFS kernel module to load...
==> default: Enabling and configuring shared folders...
    default: -- /Users/michael/GigaSpaces/VagrantLab/tmp2: /vagrant
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: to force provisioning. Provisioners marked to run always will still run.
tmp2 -> vagrant ssh
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic x86_64)

 * Documentation:  https://help.ubuntu.com/
Last login: Thu Aug 28 15:53:11 2014 from 172.16.102.1
vagrant@localhost:~$ cat /proc/cpuinfo
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 42
model name  : Intel(R) Core(TM) i7-2620M CPU @ 2.70GHz
stepping    : 7
microcode   : 0x28
cpu MHz     : 2693.633
cache size  : 4096 KB
physical id : 0
siblings    : 1
core id     : 0
cpu cores   : 1
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt aes xsave avx hypervisor lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi ept vpid
bogomips    : 5387.26
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

以下是此设置的简短 Vagrantfile:

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm"
  config.vm.provider "vmware_fusion" do |v|
    v.vmx["vhv.enable"] = "TRUE"
  end
end

~

相关内容