Вчера написал про виртуальные машины, параллельно тестируя их. С утра же, когда устанавливать операционные системы, оказалось, что в VirtualBox вылетает ошибка «Не удалось открыть сессию для виртуальной машины». Код ошибки на скриншоте ниже. Дескать не поддерживается технология виртуализации. Проверил ещё раз настройки BIOS для надёжности — всё в порядке. Настройки VirtualBox и виртуальной машины так же в норме. Оказалось, что просто конфликтуют две программы, а точнее Hyper-V от Microsoft забирал виртуализацию на себя. Решается эта проблема удалением Hyper-V.

Итак, ошибка вот такая:
Удаляем Hyper-V:
Нажимаем Win + R, вводим OptionalFeatures и нажимаем Enter. Или же открываем:
Панель управления ➝ Все элементы панели управления ➝ Программы и компоненты ➝ Включение и отключение компонентов Windows
В открывшемся окне Компоненты Windows снимаем отметку с раздела Hyper-V.
Жмём ОК и перезагружаем компьютер. После этого в VirtualBox необходимо создать новую виртуальную машину и можно начинать с ней работать.
Спасибо, что читаете! Подписывайтесь на меня в социальных сетях Facebook, Twitter, VK, OK и мессенджерах Telegram и TamTam!
Читайте анонсы и посты целиком в ЖЖ, Medium, Голосе и Яндекс.Дзен!
Поддержите мой блог финансово. Все донаты пойдут на оплату хостинга и развитие сайта!
Если вы использовали гипервизор Hyper-V и в какой-то момент решили установить VirtualBox, то при запуске виртуальной машины столкнетесь с ошибкой «Не удалось открыть сессию для виртуальной машины»:
Call to WHvSetupPartition failed: ERROR_SUCCESS (Last=0xc000000d/87) (VERR_NEM_VM_CREATE_FAILED).
Код ошибки: E_FAIL (0x80004005)
Компонент: ConsoleWrap
Интерфейс: IConsole {872da645-4a9b-1727-bee2-5585105b9eed}
Решить это можно, удалив компоненты Hyper-V в Windows: Панель управления — Программы и компоненты — Установка и удаление компонентов. Однако, если виртуальные машины Hyper-V вам нужны, это может быть неудобно.
Для того, чтобы иметь возможность запускать виртуальные машины VirtualBox при установленных компонентах Hyper-V, требуется выключить запуск гипервизора Hyper-V. Для этого запустите командную строку от имени администратора и введите следующую команду:
> bcdedit /set hypervisorlaunchtype off
После выполнения команды перезагрузите компьютер. Теперь VirtualBox будет запускаться без ошибки «Не удалось открыть сессию для виртуальной машины» (однако Hyper-V запускаться не будет).
Чтобы вернуть всё в исходное состояние, используйте команду
> bcdedit /set hypervisorlaunchtype auto
с последующей перезагрузкой компьютера.
Этот способ можно модифицировать, добавив в меню загрузки Windows два пункта: один с включенным Hyper-V, другой — с отключенным. В в командной строке от имени администратора:
> bcdedit /copy {current} /d "Отключить Hyper-V"
Будет создан новый пункт меню загрузки Windows, также в командной строке отобразится GUID этого пункта.
> bcdedit /set {GUID этого пункта меню} hypervisorlaunchtype off
В результате, после перезагрузки Windows 10 или 8, вы увидите два пункта меню загрузки ОС:
Поиск:
Web-разработка • Windows • Ubuntu • Linux • Виртуальная машина • VirtualBox • MS Hyper-V • bcdedit
Каталог оборудования
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Производители
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Функциональные группы
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
На сегодняшний день VirtualBox является самой популярной бесплатной платформой виртуализации, однако даже у её приверженцев в какой-то момент может возникнуть желании опробовать другие виртуальные машины, в частности, встроенную платформу Hyper-V. Только вот включивший её пользователь очень вскоре обнаружит, что виртуальные машины на его любимом VirtualBox больше не запускаются, а платформа выдаёт ошибку «Не удалось открыть сессию для виртуальной машины» с кодом E_FAIL (0x80004005).

Причиной ошибки может быть неудачная запись состояния ВМ в файл VBOX, кривое накопительное обновление самой Windows, отключение виртуализации в BIOS, но в данном случае причина кроется в конфликте VirtualBox с Hyper-V. Восстановить нормальную работу виртуалбокс можно удалив компоненты Hyper-V из системы, только вот как быть, если установленные на эту платформу машины вам всё же нужны? Запускать ВМ на одном ПК с включенными VirtualBox и Hyper-V нельзя, но можно временно отключить штатный компонент виртуализации, не удаляя его.
Делается это элементарно. Запустите от имени администратора командную строку или консоль PowerShell и выполните в ней команду bcdedit /set hypervisorlaunchtype off, а затем перезагрузите компьютер.

Виртуальные машины VirtualBox станут запускаться без ошибок. Чтобы вернуть Hyper-V в рабочее состояние, выполните команду bcdedit /set hypervisorlaunchtype auto и опять же перезагрузитесь.

Для удобства можете создать пакетные файлы с командами и разместить их на рабочем столе.
Кроме того, вы можете добавить режим работы системы с Hyper-V и без него в загрузочное меню.
Для этого в запущенной с повышенными правами командной строке (не PowerShell) выполните команду bcdedit /copy {current} /d «Hyper-V отключена». При этом будет создан новый элемент в загрузочном меню, а в консоли отобразится его идентификатор (32-значная строка). Скопируйте её в буфер, замените ею элемент GUID в команде bcdedit /set {GUID} hypervisorlaunchtype off и выполните команду.

Перезагрузившись, вы увидите меню выбора операционной системы.

Первое будет загружать рабочий стол с включенной Hyper-V, второе — без неё.
Загрузка…
Если вы пользуетесь виртуальными машинами VirtualBox (даже если не знаете об этом: многие эмуляторы Android также имеют в своей основе именно эту ВМ) и установите виртуальную машину Hyper-V (встроенный компонент Windows 10 и 8 отдельных редакций), вы столкнетесь с тем, что виртуальные машины VirtualBox перестанут запускаться.
Текст ошибки будет сообщать: «Не удалось открыть сессию для виртуальной машины», и описанием (пример для Intel): VT-x is not available (VERR_VMX_NO_VMX) код ошибки E_FAIL (однако, если вы не устанавливали Hyper-V, вероятнее всего, эта ошибка вызвана тем, что виртуализация не включена в БИОС/UEFI).
Решить это можно, удалив компоненты Hyper-V в Windows (панель управления — программы и компоненты — установка и удаление компонентов). Однако, если виртуальные машины Hyper-V вам нужны, это может быть неудобно. В этой инструкции — о том, как использовать на одном компьютере VirtualBox и Hyper-V с меньшими затратами времени.

Быстрое отключение и включение Hyper-V для работы VirtualBox
Для того, чтобы иметь возможность запускать виртуальные машины VirtualBox и основанные на них эмуляторы Android при установленных компонентах Hyper-V, требуется выключить запуск гипервизора Hyper-V.
Сделать это можно таким способом:
- Запустите командную строку от имени администратора и введите следующую команду
- bcdedit /set hypervisorlaunchtype off

- После выполнения команды, перезагрузите компьютер.
Теперь VirtualBox будет запускаться без ошибки «Не удалось открыть сессию для виртуальной машины» (однако Hyper-V запускаться не будет).
Чтобы вернуть всё в исходное состояние, используйте команду bcdedit /set hypervisorlaunchtype auto с последующей перезагрузкой компьютера.
Этот способ можно модифицировать, добавив в меню загрузки Windows два пункта: один с включенным Hyper-V, другой — с отключенным. Путь примерно следующий (в командной строке от имени администратора):
-
bcdedit /copy {current} /d "Отключить Hyper-V" - Будет создана новый пункт меню загрузки Windows, также в командной строке отобразится GUID этого пункта.
- Введите команду
bcdedit /set {отобразившийся GUID} hypervisorlaunchtype off
В результате, после перезагрузки Windows 10 или 8 (8.1) вы увидите два пункта меню загрузки ОС: загрузившись в один из них, получите рабочие ВМ Hyper-V, в другой — VirtualBox (в остальном это будет одна и та же система).

Как итог, добиться работы, пусть и не одновременной, двух виртуальных машин на одном компьютере возможно.
Отдельно отмечу, что описываемые в Интернете способы с изменением типа запуска службы hvservice, в том числе в реестре HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServices в моих экспериментах нужного результата не принесли.
Here’s what worked for me.
You need to check to make sure that Hyper-V is not running.
The telltale test is running «systeminfo» from the command prompt and if you see ‘A hypervisor has been detected. Features required for Hyper-V will not be displayed’ — then it’s still not disabled.
Steps to disable
- Get into your machine’s BIOS, typically UEFI today, and disable TPM ! Otherwise none of the steps below will work!!
Boot computer using F2 into the BIOS setup mode ( alternate keys include ‘Enter’ or ‘Delete’). Alternately use the Windows method to get there using the Settings app ( reference : https://www.maketecheasier.com/boot-uefi-from-windows10/ )
Once inside the UEFI BIOS :
Locate the “Security” option and expand
Locate the “TPM” option nested under the “Security” setting
To clear the TPM you must check the box saying: “Clear” to clear the TPM , or «Disable» depending on your hardware manufacturer
Save these settings in the UEFI interface, the BIOS will likely ask you to reboot ( follow these steps )
Boot normally … you probably won’t see any difference.
Check : systeminfo
It should still complain about Hyper-V
- Open Powershell in administrator mode, enter:
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor -All
wait until it completes …
this will tell you the action is complete, not that the action was successful.
- In powershell also enter:
DISM /Online /Disable-Feature:Microsoft-Hyper-V
wait until it completes …
this will tell you the action is complete, not that the action was successful.
check systeminfo again — Hyper-V is proably still in the way .. keep going.
- Disable Windows Credential Guard
This appears to start Hyper-V regardless of settings.
The steps to do this are in the link provided, but I’ll pull the salient ones:
https://docs.microsoft.com/en-us/windows/security/identity-protection/credential-guard/credential-guard-manage
Open the app «Local Group Policy Editor» from Microsoft, it’s already part of the OS.
From the Group Policy Management Console, go to Computer Configuration -> Administrative Templates -> System -> Device Guard.
Change «Turn On Virtualization Based Security» and set this to «Disabled».
-
Now, restart by going through the typical windows shutdown process.
-
Once logged in again, run systeminfo , it SHOULD show you
Something like this now :
Hyper-V Requirements: VM Monitor Mode Extensions: Yes
Virtualization Enabled In Firmware: Yes
Second Level Address Translation: Yes
Data Execution Prevention Available: Yes
This means that the VT-x CPU extensions are not stolen by Hyper-V, and Type-2 Virtualization engines like VirtualBox can use VT-x directly to dramatically speed things up.
I anticipate that other VM technologies will benefit from this as well, Hyper-V stealing the VT-x interface from other VM technologies almost guarantees that Windows platforms will NOT be used as a host OS as time progresses.
This is incredibly difficult for the average user to disable and unfortunately really discourages anyone using VM technology on windows because any virtualization runs quite slowly.
Good luck. Add instructions if you find this needs some more detail.
Here’s what worked for me.
You need to check to make sure that Hyper-V is not running.
The telltale test is running «systeminfo» from the command prompt and if you see ‘A hypervisor has been detected. Features required for Hyper-V will not be displayed’ — then it’s still not disabled.
Steps to disable
- Get into your machine’s BIOS, typically UEFI today, and disable TPM ! Otherwise none of the steps below will work!!
Boot computer using F2 into the BIOS setup mode ( alternate keys include ‘Enter’ or ‘Delete’). Alternately use the Windows method to get there using the Settings app ( reference : https://www.maketecheasier.com/boot-uefi-from-windows10/ )
Once inside the UEFI BIOS :
Locate the “Security” option and expand
Locate the “TPM” option nested under the “Security” setting
To clear the TPM you must check the box saying: “Clear” to clear the TPM , or «Disable» depending on your hardware manufacturer
Save these settings in the UEFI interface, the BIOS will likely ask you to reboot ( follow these steps )
Boot normally … you probably won’t see any difference.
Check : systeminfo
It should still complain about Hyper-V
- Open Powershell in administrator mode, enter:
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor -All
wait until it completes …
this will tell you the action is complete, not that the action was successful.
- In powershell also enter:
DISM /Online /Disable-Feature:Microsoft-Hyper-V
wait until it completes …
this will tell you the action is complete, not that the action was successful.
check systeminfo again — Hyper-V is proably still in the way .. keep going.
- Disable Windows Credential Guard
This appears to start Hyper-V regardless of settings.
The steps to do this are in the link provided, but I’ll pull the salient ones:
https://docs.microsoft.com/en-us/windows/security/identity-protection/credential-guard/credential-guard-manage
Open the app «Local Group Policy Editor» from Microsoft, it’s already part of the OS.
From the Group Policy Management Console, go to Computer Configuration -> Administrative Templates -> System -> Device Guard.
Change «Turn On Virtualization Based Security» and set this to «Disabled».
-
Now, restart by going through the typical windows shutdown process.
-
Once logged in again, run systeminfo , it SHOULD show you
Something like this now :
Hyper-V Requirements: VM Monitor Mode Extensions: Yes
Virtualization Enabled In Firmware: Yes
Second Level Address Translation: Yes
Data Execution Prevention Available: Yes
This means that the VT-x CPU extensions are not stolen by Hyper-V, and Type-2 Virtualization engines like VirtualBox can use VT-x directly to dramatically speed things up.
I anticipate that other VM technologies will benefit from this as well, Hyper-V stealing the VT-x interface from other VM technologies almost guarantees that Windows platforms will NOT be used as a host OS as time progresses.
This is incredibly difficult for the average user to disable and unfortunately really discourages anyone using VM technology on windows because any virtualization runs quite slowly.
Good luck. Add instructions if you find this needs some more detail.
Here’s what worked for me.
You need to check to make sure that Hyper-V is not running.
The telltale test is running «systeminfo» from the command prompt and if you see ‘A hypervisor has been detected. Features required for Hyper-V will not be displayed’ — then it’s still not disabled.
Steps to disable
- Get into your machine’s BIOS, typically UEFI today, and disable TPM ! Otherwise none of the steps below will work!!
Boot computer using F2 into the BIOS setup mode ( alternate keys include ‘Enter’ or ‘Delete’). Alternately use the Windows method to get there using the Settings app ( reference : https://www.maketecheasier.com/boot-uefi-from-windows10/ )
Once inside the UEFI BIOS :
Locate the “Security” option and expand
Locate the “TPM” option nested under the “Security” setting
To clear the TPM you must check the box saying: “Clear” to clear the TPM , or «Disable» depending on your hardware manufacturer
Save these settings in the UEFI interface, the BIOS will likely ask you to reboot ( follow these steps )
Boot normally … you probably won’t see any difference.
Check : systeminfo
It should still complain about Hyper-V
- Open Powershell in administrator mode, enter:
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor -All
wait until it completes …
this will tell you the action is complete, not that the action was successful.
- In powershell also enter:
DISM /Online /Disable-Feature:Microsoft-Hyper-V
wait until it completes …
this will tell you the action is complete, not that the action was successful.
check systeminfo again — Hyper-V is proably still in the way .. keep going.
- Disable Windows Credential Guard
This appears to start Hyper-V regardless of settings.
The steps to do this are in the link provided, but I’ll pull the salient ones:
https://docs.microsoft.com/en-us/windows/security/identity-protection/credential-guard/credential-guard-manage
Open the app «Local Group Policy Editor» from Microsoft, it’s already part of the OS.
From the Group Policy Management Console, go to Computer Configuration -> Administrative Templates -> System -> Device Guard.
Change «Turn On Virtualization Based Security» and set this to «Disabled».
-
Now, restart by going through the typical windows shutdown process.
-
Once logged in again, run systeminfo , it SHOULD show you
Something like this now :
Hyper-V Requirements: VM Monitor Mode Extensions: Yes
Virtualization Enabled In Firmware: Yes
Second Level Address Translation: Yes
Data Execution Prevention Available: Yes
This means that the VT-x CPU extensions are not stolen by Hyper-V, and Type-2 Virtualization engines like VirtualBox can use VT-x directly to dramatically speed things up.
I anticipate that other VM technologies will benefit from this as well, Hyper-V stealing the VT-x interface from other VM technologies almost guarantees that Windows platforms will NOT be used as a host OS as time progresses.
This is incredibly difficult for the average user to disable and unfortunately really discourages anyone using VM technology on windows because any virtualization runs quite slowly.
Good luck. Add instructions if you find this needs some more detail.

После установки Microsoft Hyper-V Oracle VM VirtualBox при запуске виртуальной машины выдаёт сообщение как на скриншоте ниже.

Ошибка возникает из-за особенностей работы гипервизора от Microsoft с nested virtualization (вложенной виртуализацией).
Современные процессоры поддерживают аппаратные функции, которые делают виртуализацию быстрее и надежнее. Hyper-V использует эти расширения процессора (например, Intel VT-x и AMD-V) для выполнения виртуальных машин. Как правило, после запуска Hyper-V другое программное обеспечение блокируется с помощью этих возможностей процессора. Это предотвращает запуск Hyper-V на гостевых виртуальных машинах.
https://docs.microsoft.com/ru-ru/virtualization/hyper-v-on-windows/user-guide/nested-virtualization
Для совместной, но не одновременной, работы обоих гипервизоров необходимо отключать Hyper-V. Делается это через настройку загрузчика Microsoft Windows — bcdedit.
Запустите командную строку Windows или PowerShell с правами администратора. И выполните команду:
bcdedit /set hypervisorlaunchtype off
Изменения вступят в силу после перезагрузки Windows. Чтобы вернуть в исходное состояние работоспособность Hyper-V выполните команду:
bcdedit /set hypervisorlaunchtype Auto
Изменения по прежнему вступят в силу после перезагрузки Windows.
Для автоматизации переключения состояния Hyper-V я собрал небольшой скрипт для PowerShell. Из-за настроек безопасности Windows выполнение PowerShell скриптов не разрешено. Обходить запрет можно несколькими способами: либо включением возможности выполнения скриптов, либо прибегать к иным способам.
Чтобы включить выполнение скриптов достаточно единожды выполнить в терминале PowerShell команду
Set-ExecutionPolicy Unrestricted
Теперь можно выполнять свои скрипты на PowerShell! Чтобы вернуть настройки выполнения скриптов в исходное состояние выполните команду:
Set-ExecutionPolicy Restricted
Если по каким-то причинам вы не хотите прибегать к данному способу, то попробуйте выполнить приведённый скрипт ниже при помощи нескольких ухищрений. Сохраните скрипт к себе на компьютер. В той директории, в которую вы сохранили скрипт, запустите PowerShell.
TYPE .ваше_название_скрипта.ps1 | PowerShell.exe -noprofile -
PowerShell.exe -ExecutionPolicy UnRestricted -File .ваше_название_скрипта.ps1
PowerShell.exe -ExecutionPolicy Bypass -File .ваше_название_скрипта.ps1
Более обширно о альтернативных вариантах выполнения скриптов в этой статье https://www.securitylab.ru/analytics/461333.php
Скрипт для автоматического включения/выключения Hyper-V.
# Запускайте скрипт с правами администратора!
# Thanks for the solution https://stackoverflow.com/a/31602095
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
$hypervisor_status = Invoke-Expression "bcdedit /enum" | Select-String "hypervisorlaunchtype"
$reboot_timeout = 300; #Время в секундах до перезагрузки компьютера
$status_message = "Выключаем Hyper-V. Компьютер будет перезагружен через $reboot_timeout секунд.";
$message_displayed = 15; # How long the message will be displayed
$commentary_to_system_journal = @("Включаем Hyper-V","Выключаем Hyper-V");
$reboot_reason = "P:2:4";
If( $hypervisor_status -match "auto" )
{
Write-Host $status_message;
Start-Sleep -Seconds $message_displayed;
bcdedit /set hypervisorlaunchtype off;
shutdown -r -t $reboot_timeout /c $commentary_to_system_journal[1] /d $reboot_reason;
} Else {
Write-Host $status_message;
Start-Sleep -Seconds $message_displayed;
bcdedit /set hypervisorlaunchtype Auto;
shutdown -r -t $reboot_timeout /c $commentary_to_system_journal[0] /d $reboot_reason;
}
Метки: виртуализация, hyper-v, скрипт, Powershell, scripts, virtualbox, Windows
This entry was posted on 2018/07/19 at 21:54:07 and is filed under Software. You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.