WhitewaterFoundry / Pengwin

A Linux distro optimized for WSL based on Debian.
Other
1.48k stars 105 forks source link

Cannot launch Android Emulator as KVM extensions are not available #437

Open davidfi01 opened 5 years ago

davidfi01 commented 5 years ago

Describe the bug Cannot run an Android Emulator (from Android Studio) as AVD reports "Your CPU does not suport required features (VT-x or SVM). kvm-ok reports that cpu does not support kvm extensions.

To Reproduce 1) Run x410 2)Lauch Pengwin 3) Install qemu-kvm 4) Install Android Studio 5) Run Android Studio 6) Android Studio->Tools->AVD manager 7)Create new virtual device 8) Message indicates "Your CPU does not support required features (VT-x or SVM) 9) in Terminal run kvm-ok to confirm that nested vm's not available through kvm

Expected behavior Nested VM's should be available, and Android Emulators should be supported for Penguin to be useful for Android development. Using Windows Hyper-V, and a couple of simple powershell commands, nested vm's and xrdp can be enabled. This Hyper-V permits seamless Android development, albeit, within one window. I would expect that Penwin could provide those services as well.

Basic Troubleshooting Checklist

What other troubleshooting have you attempted?

qemu/kvm - added user to groups. penguin powershell to see if pwsh command: Set-VMProcessor -VMName -ExposeVirtualizationExtensions $true was available.

Pengwin Version

1.2

Find: Settings->Apps->Apps & features->Pengwin->Advanced Options->Version.

Insert here:

Windows Build 10.0.18362 Pro

crramirez commented 5 years ago

Hello,

I think that running Android emulator inside WSL is too ambitious for now. What is the use case? Probably you can run the Windows version and connect it to WSL. Or the IDE in WSL can connect to the emulator running in windows?

We can as you suggested improve this connection like we did with Docker and could be a good improvement.

Regards

DistractionRectangle commented 5 years ago

I believe this is an upstream issue with WSL. A litmus test would be trying this in other WSL distros like Debian or Ubuntu.

A cursory search regarding this brought me here: https://github.com/Microsoft/WSL/issues/2850. It suggests disabling memory integrity under core isolation as a potential solution.

davidfi01 commented 5 years ago

Hello,

I think that running Android emulator inside WSL is too ambitious for now. What is the use case? Probably you can run the Windows version and connect it to WSL. Or the IDE in WSL can connect to the emulator running in windows?

We can as you suggested improve this connection like we did with Docker and could be a good improvement.

Regards

1) If WSL is intended to keep developers on windows boxes, this should not be to ambitious. Android Emulators run straight up on mac's and work being done on chromebook linux (crostini) is going to make that achievable within months. USB access and GPUs were enabled this month.

2) Our developers make extensive use of cloud services with our mobile apps. The environment includes react native for mobile client development connected to a serverless aws backend which includes dynamodb. There is no way for them to test against dynamodb locally. They use aws cli & serverless and node locally but connect to dynamodb remote for dev purposes. For them to be efficient and facilitate debugging and code changes in real time, the android emulator needs to run in a linux environment.

crramirez commented 5 years ago

I still don't understand why such support cannot be achieved connecting the Android Emulator in Windows with your services running in WSL. I don't see such support be available soon. And if it runs probably will be too slow to be usable.

But we will consider it and make some tests.

WSLUser commented 5 years ago

Related: https://github.com/Microsoft/WSL/issues/3826 and https://github.com/Microsoft/WSL/issues/2948. A lot of stuff mentioned there that has had some changes to WSL since last looked at. Probably can be looked at using the May 2019 release to see how much "improvement" to WSL is there to enable this scenario.

ghost commented 5 years ago

If I'm understanding you correctly, you want to run Android Studio installed via Pengwin directly on WSL? So nothing fancy like using Android Studio GUI installed with Pengwin, but connecting to a Linux instance installed in Hyper-V?

If so, the issue will be that KVM is a default module in the Linux kernel. WSL is using a compatibility layer to allow running Linux executables, but ultimately running on the Windows kernel. KVM extensions will unfortunately not be possible unless significant changes are made given that WSL doesn't have direct exposure to hardware and that there is no Linux kernel running.

WSLUser commented 5 years ago

Best bet is either use Hyper-V or Docker for Windows. If using Docker, there is an auto-setup provided by Pengwin so you can run all docker commands in WSL.

davidfi01 commented 5 years ago

The simple solution is what we are looking for. Android studio (linux) running on Pegwin, Android emulator run from Android Studio. All in Penguin with x410 to handle win display. So far we can get jdk, node, aws cli, aws serverless and android studio to run. Problem is with emulator and no way to spoof in or nest pegwin so emulator senses its own vm. Windows allows nested vm's via powershell command and Hyper-V. Is there anyway to nest pengwin?

ghost commented 5 years ago

Unfortunately not. WSL isn't a virtual machine running in Windows, it's a compatibility layer running on the Windows kernel.