Progress update: Seamless Linux VMs and containers for Pixel 6/7
Added 2022-11-01 07:27:54 +0000 UTCWhile hesitant at first, I ended up getting a Pixel 7 Pro earlier this month. I noticed that KVM is enabled by default, making it possible to run virtual machines without root.
This discovery led me to start working on a new app for developers and power users that makes it easy to run Linux VMs on the Pixel 7 without worrying about the details. It's similar to Termux but more powerful and flexible, and if you're familiar with WSL 2 (Windows Subsystem for Linux) or Linux on Chrome OS (Crostini), this is a very similar concept: instead of setting up your own VM, the app handles everything behind-the-scenes and makes it simple to use Linux containers with distros of your choosing. (Unlike WSL, however, the containers boot with full systemd init so service management is easy.) You can do practically anything in the VM: run Docker containers, servers that start on boot, standard GNU/Linux programs without porting to Android/Bionic libc, etc.
Unfortunately I didn't have time to release a preview of this app over the weekend as originally planned, but I'll finish it later this week. Now, for some early screenshots (subject to change, of course):
After this project is done, I still plan to finish writing my Windows VM guide, but I've decided to prioritize this because it has more practical applications. I expect Windows 11 to remain developer-exclusive, even with scripts, because of how involved the process is and how many caveats there are.
More details
- Shared folders for seamless integration with Android
- Disk only takes as much space as you use, size can be increased
- Battery usage: Thanks to my low-level optimizations, there's little to no impact on battery when left in the background to idle. No wakelocks are used, and I measured an average of ~0.005% CPU usage when idling with 3 distros running. Total of 2m40s CPU time overnight.
- Supported Linux distros: Alpine, Arch, CentOS, Debian, Fedora, Gentoo, Kali, openSUSE, Ubuntu, Void, AlmaLinux, ALT, Amazon Linux, Apertis, Devuan, OpenWRT, Oracle Linux, and Rocky Linux. Some impractical ones may be removed before release for simplicity.
- Potential future features, depending on demand: Port forwarding (to run servers), better performance with root, optional wakelocks, sound, graphics, etc.
- Terminal is based on Termux with some minor UX improvements
- UI around the terminal is custom-built for UX: tab switching uses gestures rather than a drawer, toolbar is more compact and designed to look integrated with Gboard, keys use haptic feedback for interactivity, light/dark mode follows system theme, keyboard animates smoothly, etc.
- There's a lot more under the hood than meets the eye! I've ran into limitations in Android's virtualization framework (there isn't even networking or internet access!), tricky security restrictions, and even freezes, crashes, and data corruption caused by a bug in Google's VMM, all of which have I've had to find workarounds for. More details