Unbuntu, Android Studio and Emulated Google ChromeOS
Note: Before you go down this particular rabbit hole. Three words of advice.
Firstly, even with all the CPU accelerators in place and as many of the performance barriers removed, this emulation is not very horribly quick. It’s useable, but you could just go out and buy a cheap Chromebook, and get fantastic performance.
Secondly, the version of ChromeOS currently available on Android Studio is quite old its version 6.7.
Finally, although this performed better than the nested Windows version I had running on my ESXi host, I found it crashed more frequently on Ubuntu than it did on Windows10. I’d be tempted to try this on physical Windows.
For me, the deal-breaker is the ancient release of Google ChromeOS available through the ChromeOS Repo. Its something I might come back to using a Windows build in a few months time. The setup here works for ALL operating systems including Windows, just skip the Linux bits if you setup on Windows.
Alongside all my new work at Droplet Computing, I’ve allowed myself to feed my inner geek. There’s little point in being Chief Technologist if I’m not getting my hands dirty. One thing I’m considering doing is declaring Friday as “Geek Off Friday” where I allow myself the time to investigate madcap ideas and blog about them, as well as blogging about useful production-ready stuff too.
One thing I’m keen to do is to get my hands on a Google Chromebook/Pixelbook and kick the tyres on an internal build we have Droplet Containers running in ChromeOS. It occurred to be that needn’t necessarily have to run ChromeOS on a physical system, and there was probably an emulator that would do the job just fine – the same kind of emulators used by developers to write apps for Android and ChromeOS and test them across a range of device types, without the need to acquire every single device. Such a programme exists using the Android Studio, which containers profiles not just for tablets, phones, but also Google PixelBook.
At some stage, I will just cut to the case and acquire Google Pixelbook, but I was curious about the setup of the above and thought other who might want to play with ChromeOS might be interested in my adventures. Incidentally, it does look you can build a physical system using the Chromium OS programme. That looks like a truckload of steps, and I thought the emulation mode might be easier, and more flexible.
My first attempt was a bit nutty. Using VMware ESXi backed Windows 10 virtual machine! As you might gather the levels of “inception” style nesting was just too many levels deep! [Hence, the Russian Doll graphic on this post]
ESXi Host >> Windows10 VM >> Android Studio >> Emulated Pixelbook >> Droplet Computing Application
My other issue (which I’m still working to resolve) is the build provided of ChromeOS through Android Studio, it’s some releases behind…
Anyway, I decided to reduce the layers to see if I could get something more performant. In the end, I opted for Ubuntu, not least because Windows didn’t have a driver for my SATA controller, and I could be bothered to hunt around HP.com for the software (I did eventually find the driver on hp.com and I’ve Window10 running on ML350e with 64GB – Boy, is it quick. Just goes to show what can be done when you throw hardware at an operating system!!!)
Ubuntu >> Android Studio >> Emulated Pixelbook >> Droplet Computing Application
Incidentally, my hardware here was HP ML350e with 2xCPU (4 cores) and 64GB. It normally runs as an ESXi host. I figured a beefy box like this would allow me to assign plenty of RAM to Intel HAMX drivers to improve the emulation of the PixelBook (more about HAMX in a bit). Andriod Studio comes in a Windows, Mac and Linux editions. The main reason for me using Linux was the ease by which I could get it on to the hardware and the fact that hardware has a lot of grunt.
Another use of this physical installation will be to run Droplet Containers on native hardware, so far I’ve just been running Ubuntu and RHEL in vSphere Virtual Machines which is perfectly fine, but it’s perhaps more realistic to run on physical. I’ll be using this justify buying an Apple Mac with 64GB of RAM :-p
Installing the canberra-gtk-module
GTK (formerly GTK+, GIMP Toolkit) is a free and open-source cross-platform widget toolkit for creating graphical user interfaces (GUIs). Along with Qt, it is one of the most popular toolkits for the Wayland and X11 windowing systems.
1.) Open a terminal and run:
sudo apt install libcanberra-gtk-module libcanberra-gtk3-module
Installing Hardware Acceleration
As with virtual machines, emulators can take advantage of the modern CPU chipset to leverage Intel Virtualization Technology (VT, VT-x, vmx) extensions and AMD Virtualization (AMD-V, SVM) extensions.
Different operating systems expose using different methods.
- For Windows Intel HAXM adds support to Windows10 without the need to enable Hyper-V (incidentally, this is incompatible with Windows10 support for Hyper-V which isn’t a problem if you’re not using it). Previous editions of Android Studio used to download and install this automagically, but it looks like you sometimes have to download the Intel HAXM software manually. I’d go thru the install and just see if Android Studio downloads and installs Intel HAXM.
- For Apple Mac, it looks as if Android Studio downloads, but doesn’t install Intel HAXM, for more info look here:https://developer.android.com/studio/run/emulator-acceleration#vm-mac
- For Ubuntu, Android Studio piggybacks of KVM being enabled and the permissions to access /dev/kvm correctly configured. I found that the Ubuntu installation was KVM capable.
This should report back:
INFO: /dev/kvm exists
KVM acceleration can be used
Next, I need to install a distro of KVM that can be leveraged by Android Studio:
sudo apt install qemu-kvm
Download and Install Android Studio
1.) In my case, I cranked up a web-browser to download the software:
Note: I tried the preview and canary release but found no built-in Android Virtual Device profiles for Chromebook/PixelBook, nor did the repositories seem to pull down and Google ChromeOS images. So I used the one that’s a proper GA.
2.) Save and Download the tar.gz file to the download location
3.) Extract the gz file, and copy the Android-Studio folder to your Documents folder
4.) Open a terminal, and change into the /home/<username>/Desktop/android-studio directory.
5.) Within the directory should be studio.sh script which you can execute with ./studio.sh
Note: On Windows, you will find a studo.exe and studio64.exe in the /bin directory.
From this point onwards, the step of Android Studio is the same regardless of whether you are running on Windows, Apple Mac, or Linux.
Post Configuration of Android Studio
1.) Click next to the Welcome screen
2.) Choose the Custom Installation
3.) You may be asked to accept the default path for the JDK location (Android Studio includes the Java Development Kit)
4.) Select your UI Theme
5.) Select to include the Android Virtual Device
6.) Next and Finish, and allow the application to download the additional components selected
Note: With Windows, you will be asked to allocate a chunk of memory to the Android Studio Emulator and Intel HAXM…
Update the SDK Repository
A number of built-in repositories exist for common components in the Android Studio. To be able to access the sources for ChromeOS, we need to add them as repositories.
1.) Once the download has finished, click Finish, and you will see the Welcome to Android Studio screen
2.) Click the option to Configure and from the pull-down list select SDK Manager
3.) Select the SDK Update Sites tab, and click + to add a repository URL
We need to add two repositories:
Chrome OS Repository:
Chrome OS System Images:
4.) Next, under the SDK Tools tab in the same dialog box enable the option for the ChromeOS Device
5.) Click OK, and accept the message that a new device type is to be downloaded, and accept the license agreement for the Chrome OS Device
Note: Wait for the download to complete before continuing
Create an Android Virtual Device (AVD)
An Android Virtual Device (AVD) is a configuration that defines the characteristics of an Android phone, tablet, Wear OS, Android TV, or Automotive OS device that you want to simulate in the Android Emulator. The AVD Manager is an interface you can launch from Android Studio that helps you create and manage AVDs. In our case, we need that contains a hardware profile and system image for emulating ChromeOS.
1.) In the Welcome to Android Studio screen
2.) Click the option to Configure and from the pull-down list select AVD Manager
Note: Notice how the /dev/kvm device has “permission denied”. To fix this problem, I merely added my user account to the KVM group like so:
grep kvm /etc/group
sudo adduser $USER kvm
grep kvm /etc/group
Remember to logout and log back into update your login token.
3.) Click + Create Virtual Device
4.) Select the category of Tablet, and select PixelBook (beta)
Note: You may wish to clone this device and increase the amount of memory assigned to it. If you do this ensure you select as the type ChromeOS
5.) Under Select a system image, click Download
6.) Accept the Chrome OS 67 System Image license agreement
Note: Wait for the download of the Chrome OS to complete, it’s is about 1.5GB in size.
7.) In the Verify Configuration, select to use the hardware device for the graphics card, and click Finish.
8.) Click at the Green > play icon to launch the emulator. This will start in a separate window, and load ChromeOS.