CPU passthrough on proxmox, flutter android device emulation

How to enable VM CPU passthrough for Android virtual device Emulation

Are you ready to set up a Linux VM on ProxMox and turn it into the ultimate Flutter development workstation? One of the key requirements for this setup is the ability to emulate virtual devices, such as Android OS. This is where hardware accelerated virtualization comes in, and we’re here to show you how to enable it.

First things first, you’ll need to make sure your host machine is equipped with VT-x or SVM. Once that’s confirmed, it’s time to create a new VM. When you’re setting up the VM, be sure to select the CPU type as “host”. After the VM is up and running, it’s time to install the necessary tools for Flutter development. This includes Flutter itself, JDK, and Android Studio.

To install JDK, run the following commands:

sudo apt-get update
sudo apt-get install openjdk-8-jdk

Next, let’s install Flutter:

sudo snap install flutter --classic
flutter sdk-path 
export PATH="$PATH:[PATH_OF_FLUTTER_GIT_DIRECTORY]/bin"

Be sure to check the path of your Flutter installation and update the path accordingly.

Now that everything is set up, it’s time to run flutter doctor to make sure your environment is ready to go. This command will also display any additional software or tasks that you may need to install or complete.

flutter doctor 

Next, download Android Studio and the App Tools. Once you have Android Studio up and running, go through the Android Studio Setup Wizard to install the latest Android SDK and tools. Don’t forget to add Flutter as a plugin! After that, run ‘flutter doctor' again to ensure everything is good to go.

Finally, run Android Studio, go to the device manager, and create a virtual device. Choose the latest system image to download and follow the steps to finish adding the virtual device. Once the virtual device is set up, start it up and you’ll be ready to emulate your app!

You might run into an error message “/dev/kvm device: permission denied” when trying to start android virtual device. But don’t fret, we’ve got the solution! Simply run this command, and reboot the vm:

sudo usermod -a -G kvm $USER

Leave a Reply

Your email address will not be published. Required fields are marked *