solo-io / unik

The Unikernel & MicroVM Compilation and Deployment Platform
Apache License 2.0
2.7k stars 192 forks source link

Error when running unik daemon on Windows: Raw-mode is unavailable courtesy of Hyper-V #166

Open hsluoyz opened 6 years ago

hsluoyz commented 6 years ago

After fixing several issues, I encountered a new issue when running unik daemon.

Microsoft Windows [Version 10.0.17134.112]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\luo>unik daemon --debug
time="2018-06-24T17:14:32+08:00" level=info msg="daemon started" config={{[] [] [] [{my-vbox VirtualBox Host-Only Ethernet Adapter host_only}] [] [] [] [] []} 0.0.0}
time="2018-06-24T17:14:32+08:00" level=info msg="using container versions" versions=map[compilers-osv-java:14f2183e5cb49482 compilers-osv-dynamic:59ba07ca2f12ecaa compilers-rump-c-xen:65c2c7316ad6fc77 vsphere-client:a9538c7c242acbef compilers-rump-python3-hw:22bc5378af6e099d qemu-util:6f5922561bbb86e3 compilers-rump-python3-hw-no-stub:81a494acc94d7827 compilers-rump-c-hw:1954dce79e407724 compilers-mirage-ocaml-ukvm:2c35c23771682e9a compilers-rump-nodejs-hw:b5029ddcc8731a25 compilers-rump-java-hw:e8c77dc577b288d9 compilers-rump-java-xen:43365940a0dd610c rump-debugger-qemu:0a841d0bf71287e6 image-creator:fa560ac11cecae33 boot-creator:d0665c8793b16c51 compilers-rump-nodejs-xen:2fbc447253ba19b8 compilers-mirage-ocaml-xen:0cd46f5253c6ca8a compilers-rump-go-xen:fe3335e71ed20510 compilers-rump-go-hw:d1bfbc13602e306d compilers-rump-nodejs-hw-no-stub:baebfe68f3283190 compilers-rump-base-xen:f841298dae4340f7 compilers-includeos-cpp-hw:694e22e023dbbbc8 compilers-rump-python3-xen:1496a60a071e79e1 compilers-includeos-cpp-common:8de1311f7b1365d9 compilers-rump-base-common:2eb72d1b386ce2a4 compilers-rump-base-hw:8cd85d4a7ee1009b]

... a lot of logs

time="2018-06-24T17:15:37+08:00" level=debug msg="running VBoxManage command" command=[VBoxManage modifyvm VboxUnikInstanceListener --nic1 hostonly --hostonlyadapter1 VirtualBox Host-Only Ethernet Adapter --nictype1 virtio]
time="2018-06-24T17:15:37+08:00" level=debug msg="running VBoxManage command" command=[VBoxManage modifyvm VboxUnikInstanceListener --nic2 nat --nictype2 virtio]
time="2018-06-24T17:15:37+08:00" level=debug msg="running VBoxManage command" command=[VBoxManage modifyvm VboxUnikInstanceListener --memory 256]
time="2018-06-24T17:15:38+08:00" level=debug msg="running VBoxManage command" command=[VBoxManage modifyvm VboxUnikInstanceListener --uart1 0x3F8 4 --uartmode1 file C:\Users\luo\.unik\virtualbox\instances/VboxUnikInstanceListener/Logs/serial.log]
time="2018-06-24T17:15:38+08:00" level=debug msg="copying base boot vmdk to instance dir"
time="2018-06-24T17:15:38+08:00" level=debug msg="copying source boot vmdk"
time="2018-06-24T17:15:38+08:00" level=debug msg="running VBoxManage command" command=[VBoxManage internalcommands sethduuid C:\Users\luo\.unik\virtualbox\instances\VboxUnikInstanceListener/boot.vmdk]
time="2018-06-24T17:15:38+08:00" level=debug msg="VBoxManage result" result="UUID changed to: 1a53f889-e43a-4df7-8004-8b7390f920cf\r\n"
time="2018-06-24T17:15:38+08:00" level=debug msg="running VBoxManage command" command=[VBoxManage storageattach VboxUnikInstanceListener --storagectl SCSI --port 0 --type hdd --medium C:\Users\luo\.unik\virtualbox\instances\VboxUnikInstanceListener/boot.vmdk]
time="2018-06-24T17:15:39+08:00" level=debug msg="running VBoxManage command" command=[VBoxManage storageattach VboxUnikInstanceListener --storagectl SCSI --port 1 --type hdd --medium C:\Users\luo\.unik\virtualbox\volumes\InstanceListenerData\data.vmdk]
time="2018-06-24T17:15:39+08:00" level=debug msg="powering on vm"
time="2018-06-24T17:15:39+08:00" level=debug msg="running VBoxManage command" command=[VBoxManage startvm VboxUnikInstanceListener --type headless]
time="2018-06-24T17:15:45+08:00" level=warning msg="error encountered, ensuring vm and disks are destroyed" error="[virtualbox/deploy_instance_listener.go:148] powering on vm: {Waiting for VM \"VboxUnikInstanceListener\" to power on...\r\nVBoxManage.exe: error: Raw-mode is unavailable courtesy of Hyper-V. (VERR_SUPDRV_NO_RAW_MODE_HYPER_V_ROOT)\r\nVBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole\r\n}"
time="2018-06-24T17:15:45+08:00" level=debug msg="running VBoxManage command" command=[VBoxManage controlvm VboxUnikInstanceListener poweroff]
time="2018-06-24T17:15:46+08:00" level=debug msg="running VBoxManage command" command=[VBoxManage unregistervm VboxUnikInstanceListener --delete]
time="2018-06-24T17:15:46+08:00" level=debug msg="VBoxManage result" result="0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%\r\n"
time="2018-06-24T17:15:46+08:00" level=error msg="running daemon failed: [cmd/daemon.go:86] daemon failed to initialize: {[daemon/daemon.go:107] initializing virtualbox provider: {[virtualbox/virtualbox_provider.go:49] deploying virtualbox instance listener: {[virtualbox/deploy_instance_listener.go:60] launching instance of instance listener: {[virtualbox/deploy_instance_listener.go:148] powering on vm: {Waiting for VM \"VboxUnikInstanceListener\" to power on...\r\nVBoxManage.exe: error: Raw-mode is unavailable courtesy of Hyper-V. (VERR_SUPDRV_NO_RAW_MODE_HYPER_V_ROOT)\r\nVBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole\r\n}}}}}"

After googling the error: Raw-mode is unavailable courtesy of Hyper-V (https://stackoverflow.com/questions/50053255/virtualbox-raw-mode-is-unavailable-courtesy-of-hyper-v-windows-10), I found that VirtualBox cannot be used when Hyper-V is enabled. But unik requires Docker. And Docker for Windows requires Hyper-V. So They are contradictory.

Is there any solution to fix it? I can think of some:

  1. Remove the use of Docker in unik. In fact, I don't understand why unik uses Docker. Unik is meant to run on Linux originally, and unik can just use Linux commands, why has to run the commands in a Linux container? Utilizing both Docker and virtualization can be complicated.
  2. Use Docker toolbox instead of Docker for Windows. Docker toolbox seems not to rely on Hyper-V. So I can use VMware or VirtualBox to hold the Linux VM of the Docker toolbox. I will try it.
  3. Use another unik provider than VirtualBox. Because I just want to use unik to understand it first. I didn't have to be bound to VirtualBox. But is there any other local providers that can run on Windows? From the list: https://github.com/solo-io/unik#supported-providers, I didn't see one.
ilackarms commented 6 years ago
  1. unik uses docker because of the complex dependencies that each unikernel compiler requires. between rump, osv and includeOS, there are a large number of dependencies many of which are not portable across platforms
  2. for running locally, qemu and VirtualBox are pretty much your only options. you could also run on a cloud provider like openstack or AWS

another option might be to investigate raw mode and if it's something that can be disabled (to be honest I can't recall if that's something we do explicitly in unik)

this is an issue i'd like to see fixed as well; let me know if i can help or provide any other guidance.

hsluoyz commented 6 years ago

I encountered an issue when using Unik with Docker Toolbox, please see: https://github.com/solo-io/unik/issues/167