44

Machine: Window10 (64bit).

I downloaded the latest VirtualBox, Vagrant and initialized CentOS 6.7 64bit image/url.

The following worked successfully in Git-Bash session.
1. vagrant box add "centos67x64" "https://github.com/CommanderK5/packer-centos-template/releases/download/0.6.7/vagrant-centos-6.7.box"
2. vagrant init
3. Updated Vagrantfile (and turned vb.gui option i.e. uncommented that config section in the file).

  config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = true

    # Customize the amount of memory on the VM:
    vb.memory = "2048"
  end

After that, I tried the following command but I'm getting this error message.

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos67x64'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: vv_default_1466548735200_80300
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "ae74ebaa-8f01-48cf-bdad-956c59ef1208", "--type", "gui"]

Stderr: VBoxManage.exe: error: VT-x is not available (VERR_VMX_NO_VMX)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole

If I turn/comment off the whole Vagrantfile respective section, I'm still getting the following error.

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "ae74ebaa-8f01-48cf-bdad-956c59ef1208", "--type", "headless"]

Stderr: VBoxManage.exe: error: VT-x is not available (VERR_VMX_NO_VMX)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole

Any ideas! I looked into other posts but couldn't find how to resolve in my case.

As I got some hints, I tried one of the solution.

  1. TURN off the Hyper-V which is turned of by default I guess in Windows10.
  2. To do this, I Went to Control panel in Windows10 and looked here and found this. enter image description here

  3. Then, I turned Hyper-V off by unchecking (the tick mark, or black box).

  4. Windows10 told me to RESTART, I said "No" (later).
  5. Tried running "vagrant up" again (without or without any changes or the above mentioned config.vm... changes to the Vagrantfile). It didn't work and gave me the same --headless error message.

  6. OK, time to restart. Restarted Windows10. After the restart, I saw bunch of Virtual Box error messages popups (few of them are shown below).

enter image description here enter image description here enter image description here enter image description here

  1. Once I clicked on OK button on all of those Virtual Box popup windows, I tried to run Virtual Box on my machine, it came up fine(successfully).
  2. Now, I opened Git-BASH and again went to the directory where Vagrantfile was present. Tried tweaking the settings on / off or commenting/uncommenting the Vagrantfile respective section (as I described above).

STILL getting the the same error messages for running "vagrant up" (even after turning the Hyper-V off as well).

AKS
  • 16,482
  • 43
  • 166
  • 258
  • 1
    Did you stop hyper-v? – fips Jun 21 '16 at 23:03
  • No I didn't. On my Windows7 machine, I didn't do that step. On Windos10 (where I'm getting this message), is it a pre-requisite step for Vagrant? Not sure if their site or section where they have listed their image boxes mentions this part. http://www.vagrantbox.es/ – AKS Jun 21 '16 at 23:04
  • 1
    yeah that's because windows 7 doesn't have hyper-v installed. here's some more info in this thread: https://social.technet.microsoft.com/Forums/windows/en-US/118561b9-7155-46e3-a874-6a38b35c67fd/hyperv-disables-vtx-for-other-hypervisors?forum=w8itprogeneral – fips Jun 21 '16 at 23:06
  • OK, I unchecked the boxes for Hyper-V. Do I really need to restart my machine (even after the unchecking process applied the changes). I'll do that next. I expect that after this both vb.gui and vb.memory should work, right? – AKS Jun 21 '16 at 23:12
  • Yes I remember I had to reboot my win server for it to take effect. – fips Jun 21 '16 at 23:19
  • Awesome, it did NOT work. I'm post what I did in my question here. Still researching.. – AKS Jun 21 '16 at 23:26
  • OK, I take that back. Voting up 1 for fips. After I restarted the computer, I went to BIOS and under the respective network, security settings, I made sure Intel Virtualization settings were both ENABLED. Restarted my machine and the errors went away and vagrant up ran successfully. – AKS Jun 28 '16 at 22:15
  • @fips you can post an answer and I'll accept it as a final answer. Thanks. – AKS Jun 29 '16 at 20:53
  • Arun, just did. Feel free to suggest an update if there's any other useful step I'm not mentioning. – fips Jun 29 '16 at 22:23
  • Docker can be the culprit. I had same issue after installing docker. Docker uses Windows hyper-v driver to create containers. Hence Docker and Virtual Box may not work together! – Mohammad Azim Mar 23 '18 at 21:39

13 Answers13

58

Stop hyper-v service running by default in Windows 8/10, since it blocks all other calls to VT hardware.

Additional explanation here: https://social.technet.microsoft.com/Forums/windows/en-US/118561b9-7155-46e3-a874-6a38b35c67fd/hyperv-disables-vtx-for-other-hypervisors?forum=w8itprogeneral

Also as you have mentioned, if not already enabled, turn on Intel VT virtualization in BIOS settings and restart the machine.


To turn Hypervisor off, run this from Command Prompt (Admin) (Windows+X):

bcdedit /set hypervisorlaunchtype off

and reboot your computer. To turn it back on again, run:

bcdedit /set hypervisorlaunchtype on

If you receive "The integer data is not valid as specified", try:

bcdedit /set hypervisorlaunchtype auto

-- credit Tj Kellie

fips
  • 4,319
  • 5
  • 26
  • 42
  • 17
    To turn Hypervisor off on windows from a command window: "bcdedit /set hypervisorlaunchtype off" and reboot. To turn it back on: "bcdedit /set hypervisorlaunchtype on" (or auto start) and reboot. – Tj Kellie Jan 23 '17 at 17:02
  • 2
    @TjKellie your advice worked for me, thanks. Perhaps you'd like to edit your commend and add to it that the user should be an admin in order to perform that command. :) – Luis Milanese Mar 02 '17 at 00:40
  • Woooow, thanks so much for this. I was fighting with this for a few hours, and I thought it was because I was running Windows 10 on a MacBook Pro. It was just because hyper-v was enabled. (Side note: it's strange that Docker and VirtualBox can't work at the same time.) – ndbroadbent Oct 20 '17 at 09:23
  • To turn it back on, its "bcdedit /set hypervisorlaunchtype auto", not as mentioned by @TjKellie – AlexLiesenfeld Oct 02 '19 at 14:23
41

I just solved this problem by disabling(uncheck) Hyper-V. Seems Hyper-V was enabled when I installed Docker

Control Panel -> Program And Features -> Turn Windows Features on or off.

You may need to reboot afterwords.

Warning: Vagrant with VirtualBox cannot work with Docker at the same time.

f-society
  • 2,898
  • 27
  • 18
  • I have similar issue as I need to enable Hyper-V to use docker, but disable it when I need to use VMware or Virtualbox. – ascetic652 Mar 09 '19 at 15:11
  • On my Dell Precision 7530, running Win 10 Pro, my CPU virtualization capabilities were enabled in BIOS settings but I still got the same "VT-x" error when running Vagrant. To fix it, I had to turn off more Windows features, especially "Hyper-V", "Virtual Machine Platform" and "Windows Hypervisor Platform". I guess it might be related to Windows subsystems feature. – Franck Sep 06 '19 at 10:34
  • After turning off Hyper-V, just restarting did not work for me. I needed to shut down and start again before it worked. – Stackman Jul 15 '20 at 12:48
10

Although this is an old question, but I've still encounter it recently.

This is what worked for me on my i7-3770 3.40GHz, Z77 extreme motherboard running Windows 10.

In Windows, disable Hyper-V:

  1. Open up a PowerShell or CMD session as Administrator.
  2. Type the following command: dism.exe /Online /Disable-Feature:Microsoft-Hyper-V-All
  3. Windows will ask you to restart.

In the bios:

  1. Disable >>> Intel Virtualization Technology, vt-d
  2. Save the bios settings and allow it to restart and boot into Windows.
  3. Shutdown the computer (I've tried just restarting and it didn't work)
  4. Power up the computer, go into the bios and re-enable the above disabled settings.
  5. Save, restart.

Download the Intel Utility to check.

You should now see it been supported:

Screen shot

If it still doesn't work, try re-enabling Hyper-V first then following the steps above.

user3691314
  • 159
  • 3
  • 5
  • I actually found that after turning off virtualization the second time, virtualization was finally enabled -- yes, the exact opposite of what would be expected. – Adam Wise Feb 11 '20 at 15:02
9

Docker can be the culprit. I had same issue after installing docker. Docker uses Windows hyper-v driver to create containers. Hence Docker and Virtual Box may not work together!

Mohammad Azim
  • 2,604
  • 20
  • 21
4

Along with Hyper-V option, I had to uncheck "Containers" Windows feature to have my Vagrant work.

Leo
  • 121
  • 1
  • 7
3

If you are getting the above error on Windows 10 Pro then you can disable the Hyper-V. Hyper-V is default enable in the Windows 10. You can either use Hyper-V or Virtual Box. So, to use the Virtual box you have to disable hyper-v in windows, you can follow following steps to do -

  1. Search Control Panel
  2. Click on Uninstall a program
  3. Turn Windows features on or off
  4. Unselect the Hyper-V option.
  5. Click on OK
  6. Restart the system to apply the changes.
Prabhat Maurya
  • 1,058
  • 16
  • 21
2

Search for Windows Features. Turn off Hyper V.Most likely, Virtual Box is clashing with Hyper V on Windows. Also check for Hyper V running in your Services. Stop and disable that as well.

gbade_
  • 339
  • 1
  • 8
  • 21
2

Besides turning on virtualization features of the processor and turning off Hyper-V, here's another thing, related to Windows' Virtualization-Based Security features:

https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/oem-vbs

VBS (and the associated security features) must be disabled to avoid conflicting hypervisors. Here is a solution from VMware, which also seems valid for the VirtualBox issue":

https://kb.vmware.com/s/article/2146361

friedman
  • 21
  • 1
2

If the Docker is installed and up and running at the same time, if you are trying to run Virtual Box it will not work. The underlying kernel on host machine which is present on your laptop will not allow to work both things at the same time.

Hence Docker and Virtual box can't run at the same time. for that,

  1. To use Docker you have to enable the hyper-v which is present on this location

    Control Panel -> Program And Features -> Turn Windows Features on or off.

  2. To run Virtual box you have to disable the hyper-v from above location.

Dashrath Mundkar
  • 7,956
  • 2
  • 28
  • 42
0

Turn Off the Hyper-V option from the windows feature list. You can find this on control panel.

Piusha
  • 594
  • 5
  • 11
0

The only thing that worked for me was running the installers and doing a repair for VM VirtualBox and Vagrant.

thenninger
  • 506
  • 3
  • 16
0

Tried all above steps but nothing was working till I enabled Virtualization Technology in BIOS. Even though Intel CPU Utility was showing Virtualization as Ticked, it really wasn't.

Had boot-up system, entered BIOS, Enabled Virtualization, Restarted and Voila! It worked after more than 4 hours of efforts.

-1

This is what helped me:

  1. Remove Hyper-V and install Hypervisor platform.

    • In the elevated Powershell prompt do:

      Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All
      Enable-WindowsOptionalFeature -Online -FeatureName HypervisorPlatform
      
    • Restart

  2. Disable Windows Defender Credential Guard

    • "Local Group Policy Editor" → "Computer Configuration" → "Administrative Templates" → "System" → "Device Guard" → "Turn on Virtualization Based Security" → Set to "Disabled"

    • Delete the following registry settings:

      • HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\LSA\LsaCfgFlags
      • HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\DeviceGuard\LsaCfgFlags
    • Restart

  3. Delete the Windows Defender Credential Guard EFI variables

    • In the elevated command prompt do:

      mountvol X: /s
      copy %WINDIR%\System32\SecConfig.efi X:\EFI\Microsoft\Boot\SecConfig.efi /Y
      bcdedit /create {0cb3b571-2f2e-4343-a879-d86a476d7215} /d "DebugTool" /application osloader
      bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} path "\EFI\Microsoft\Boot\SecConfig.efi"
      bcdedit /set {bootmgr} bootsequence {0cb3b571-2f2e-4343-a879-d86a476d7215}
      bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} loadoptions DISABLE-LSA-ISO
      bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} device partition=X:
      mountvol X: /d
      
    • Restart

  4. Disable virtualization-based security

    • Delete all registry keys under HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\DeviceGuard\* (but keep DeviceGuard itself).

    • Restart

See also: Disable Windows Defender Credential Guard

0x416e746f6e
  • 9,872
  • 5
  • 40
  • 68