Kirsle.net logo Kirsle.net

Waydroid on the Pinephone is a game changer

September 24, 2021 (updated October 11, 2021) by Noah

This week, some news about Waydroid made its way to the r/linux subreddit and in the comments I saw a Pinephone owner write about their experience with Waydroid and none of his complaints had anything to do with it being slow or clunky or broken, which is about what my experience was the last time I tested out Anbox about a year ago.

So it prompted me to check Waydroid out, and... it works remarkably well! It really surprised me. Waydroid makes use of containers to run Android directly on your own Linux kernel, without emulation, and so it performs very well -- some Android apps even run more smoothly than their native Linux counterparts!

I wasn't expecting that the Pinephone was ever going to be able to run Android apps smoothly on a GNU/Linux system, but now that it does, and does so this well, this is a game changer in terms of the Pinephone being "daily driver" ready. Finally, I have a way to use Slack and Discord from my Pinephone, something that was basically not possible at all before!

Screenshot of Discord (Android) running on Mobian

Now, to be clear: even without Android, there are a very good collection of Linux apps that already work well on the Pinephone. Having the option of Android for the odd proprietary app like Slack or Signal is nice to have. Read on to the full blog post for how Waydroid works right now, what are some of its pain points still, and a few screenshots of my Phosh app drawer showing everything I have installed on my Pinephone.

The User Experience

This is how Waydroid behaves once installed:

There is a "Waydroid" app launcher in my drawer and this brings up the "Full UI" screen for Waydroid -- you see the LineageOS home screen and can see the home screen apps, swipe up for the Android app drawer, swipe down for the Android notifications drawer, and the Android task switcher works to switch between the various running apps.

In addition to this Full UI launcher, every Android app installed also gets a launcher icon directly in your Phosh app drawer, alongside your other Linux apps. You can directly run the apps from here as normal.

The window manager in Phosh generally separates the Android apps into distinct tasks as you'd expect, one window per app. It's sometimes a little janky, you'll switch to the Slack window but Discord came up instead.

LineageOS comes with a handful of "redundant" apps such as Contacts, Calendar, Clocks, Settings, and others that are similar to GNOME apps and clutter my app drawer; but you can remove their launchers from your ~/.local/share/applications folder and clean that up. For the Android apps I would literally never want to launch from Phosh they can be removed this way; you can always reach them from the "Full UI" and going thru the Android apps drawer.

Waydroid Caveats

Waydroid is still in development and many of the below issues will surely be resolved over time. But Waydroid is already working way better than I ever expected at such an early stage!

The Mobian wiki has instructions how to set up Waydroid. Apparently, the upstream project hosts their own dpkg repo for Ubuntu and Debian which is nice - so I'll get updates directly from the source as they're released.

A few strange quirks that Waydroid currently has:

  • Initial startup time is slow. After a fresh reboot of the phone, launching your first Android app takes a considerably long time, like over 30 seconds of staring at your Phosh desktop waiting for an app window to appear.
  • Once warmed up, it runs fast! After that first app launch it works really well! Launching a new Android app has the app window appear within just a couple of seconds. I was easily able to run ~6 Android apps or so at the same time without the phone showing signs of being burdened yet. I haven't stress tested how far I can push that, though.
  • Scrolling and animations are "smooth" - not as fast and snappy as a flagship Android phone, but not as slow and choppy as some Linux apps either! Twitter for Android is very usable where all the other options on the Pinephone were sub-par (Firefox struggles on their mobile site, Chromium is better but has its own rendering issues and blurry text, etc.)
  • Sometimes window management is finicky. An Android app may appear to "crash" suddenly, but really only its window has gone away. Reopening another Android app will bring a Waydroid window back up and you can task switch and see your original app still there where you left it.
  • The camera and microphone don't work yet. But these are not important for my needs right now anyway, and I'm sure support will come with time.
  • The filesystem and clipboard are isolated. You can copy/paste within Android but the clipboard doesn't share across the Android/Linux boundary. To share a picture from my Pinephone thru an Android app I need to first download the picture into Android's environment. With creativity you can probably set up file sharing with SMB, FTP, KDE Connect or so on.
  • Keep your Phosh on-screen keyboard CLOSED while Waydroid initializes. If your keyboard is open, Waydroid will pick a window size that leaves room for the keyboard, and then stays that size forever (until you reboot the phone) even if you close your keyboard. The Mobian wiki suggests launching an app like Clocks that doesn't open your keyboard while you wait for Waydroid to come up.

And on the topic of keyboards: Android will use its own keyboard for Android apps, and the Phosh keyboard doesn't currently interact well with Android anyways. So while you are using Android apps you'll keep your Phosh keyboard hidden away, and the Android keyboard will appear when needed. It's a little weird having two keyboards, but oh well! Since Waydroid doesn't resize its window your Phosh keyboard would appear "on top" so even if you could type into Android apps with it, you wouldn't see the text you were writing because the text box is at the bottom of the Android screen, "below" your Phosh keyboard!

It is basically LineageOS without Google Play Services

Waydroid uses a minimal LineageOS image as its Android base.

In Waydroid you can install the F-Droid app store and, through that, install the Aurora Store -- a third-party client for the Google Play Store. With Aurora you can download all your usual Android apps such as Slack, Discord, Netflix, and so on.

Like any de-googled Android ROM, some apps from the Play Store won't function without the Google services and other apps may have limited functionality. See my Degoogle Wiki for some of my notes on de-googling Android and some apps that still work fine without the Play Services.

Notable apps that will not work on Waydroid include:

  • Lyft and Uber because they require the Google Location API. But, these two have good working web apps that you can use from just Firefox on Linux on the Pinephone.
  • Google's first-party apps (YouTube, Gmail, etc.) 100% depend on the Play Services.
  • Snapchat is notoriously difficult to use from a de-googled phone, it makes use of Google SafetyNet and employs all kinds of tricks so that it does NOT sign in on suspicious Android devices -- they really don't trust their users!

But many apps that I personally use will work fine without Google services.

Android apps I have tested

Slack was the first one I installed. My workplace uses it and it's a crucial app for me to have so I can stay responsive to work in case I'm away from my laptop for a while. There was previously NO good way to use Slack from the Pinephone -- their mobile website just directs you to the Play Store, and their desktop web app isn't optimized at all for the phone's screen size; you need to zoom out the page quite a ways to see the UI properly but then text size is very small. Workable in a pinch but not great. I have looked at Pidgin plugins and Matrix bridges for Slack but options are not good. It is very nice having the Android Slack app easily runnable on the Pinephone!

Discord also works well -- see the screenshot at the top of this blog post. Keep in mind that the camera and microphone aren't working yet, but for just chat and sharing files and pictures all is fine!

Bank of America works (updated Oct 11 2021), this has been my bank for ages and they have a fully functional mobile website that would work in Firefox but also their Android app works in Waydroid. I had trouble searching in Aurora Store for the app but used the link from their website and installed it; could sign in and everything. On de-googled Androids I've tried the BofA app even supports the fingerprint reader! The Pinephone doesn't have one of those (yet) and I wouldn't expect Waydroid to pass it thru yet even if it did but all the basic features of the BofA app are working!

Signal works fine. I needed to manually download the .apk from Signal's website because the Aurora Store said the app "wasn't compatible" with my phone - but it works fine! The manually downloaded APK even has a work-around for the lack of push notifications. I was able to activate a new account (using my Google Voice number) within Waydroid on Pinephone and send messages.

Telegram also works -- and it works better than the native Linux client does! Under Mobian, Telegram Desktop takes a very long time to log on whereas the Android app comes right up (provided Waydroid is warmed up already).

Spotify works -- I could log in and play music. I tested this app to verify whether DRM-heavy apps will function, and it seems to! I have not tested Netflix or Hulu though, as I have little interest to watch video on my phone and there is no Chromecast support anyway.

Twitter works great. They have a mobile website too which is OK and there were already a few options to access Twitter on the Pinephone without Android. Even on my Pixel phone I prefer Twitter in a web browser over their native app, but the web browsers on Pinephone struggle a bit with their website, so it is nice to have the native app available.

VLC Media Player works! It plays videos back really well too, at least for the h.264 encoded video I tested it with. Your mileage may vary with other video codecs. While VLC has built-in Chromecast support, it does not seem to work under Waydroid.

Jellyfin doesn't really work. Its in-built Chromecast feature, too, can not detect any actual Chromecast on my network. When I stream a video, I can hear the audio but the video output is just black.

Screenshots of my Pinephone Apps Drawer

The Pinephone was already getting close to "daily driver ready" before Waydroid and now it's even better! Here are the full set of apps I currently have installed on my Pinephone, a few of which now are Android apps!

Home Screen 1 Home Screen 2

Home Screen 3 Home Screen 4

The app list in text form:

  • Chatty (Linux): SMS messenger.
  • Contacts (Linux)
  • Firefox (Linux)
  • King's Cross (Linux): Terminal emulator.
  • Advanced Network Config (Linux)
  • Archive Manager (Linux)
  • Aurora Store (Android): Google Play Store client.
  • Axolotl (Linux): third party Signal client (I haven't got it working)
  • Blanket (Linux): sleep sounds generator
  • Browser (Android): runs fine! Sometimes faster, sometimes slower than native Linux browsers.
  • Calculator (Linux)
  • Calendar (Linux)
  • Calls (Linux)
  • Cawbird (Linux): a Twitter client, works OK, doesn't do notifications well and DM's are a bit jank.
  • Chromium (Linux)
  • Clapper (Linux): a hardware-accelerated video player for Pinephone.
  • Clocks (Linux)
  • Dialect (Linux): a language translation app.
  • Dictionary (Linux)
  • Discord (Android)
  • Document Viewer (Linux): PDF viewer.
  • DoorDash (Chromium web app; Linux)
  • Email (Android)
  • F-Droid (Android): free and open source Android app store.
  • Files (Linux)
  • Flashlight (Linux)
  • Flatseal (Linux): permissions manager for Flatpak apps.
  • Gallery (Android)
  • Geary (Linux): an e-mail client optimized for mobile phones.
  • Giara (Linux): a Reddit client, a bit buggy and crashes a lot.
  • Gtkeddit (Linux): a better Reddit client, works very very well already!
  • Help (Linux): GNOME documentation.
  • Image Viewer (Linux)
  • Jellyfin (Android): doesn't work super great right now.
  • KeePassXC (Linux): works decently! It "scales-to-fit" and is usable and it supports 2FA TOTP codes.
  • Lollypop (Linux): offline music player for your MP3 collection.
  • Maps (Linux): GNOME Maps.
  • Megapixels (Linux): the only working camera for the Pinephone.
  • Password Safe (Linux): a KeePass client that is optimized for mobile.
  • Passwords and Keys (Linux): manage your GNOME keyring etc.
  • Portfolio (Linux): a simple file browser.
  • Powersupply (Linux)
  • Pure Maps (Linux): another Maps application.
  • Screenshot (Linux): the GNOME Screenshooter tool.
  • Settings (Linux): GNOME Settings.
  • Shortwave (Linux): Internet radio.
  • Signal (Android)
  • Slack (Android)
  • Software (Linux): the GNOME Software Store.
  • Sound Recorder (Linux)
  • Spotify (Android)
  • Tangram (Linux): a Matrix client?
  • Telegram Desktop (Linux)
  • Telegram FOSS (Android)
  • Termit (Linux): a terminal emulator - I'm not sure how this got installed.
  • Text Editor (Linux)
  • To Do (Linux)
  • Twitter (Android)
  • Twitter Web (Chromium web app; Linux)
  • Ungoogled Chromium (Linux)
  • Usage (Linux): CPU usage monitor.
  • Videos (Linux)
  • VLC for Android
  • Waydroid (Android Full UI)
  • Weather (Linux)
  • Web (Linux): the GNOME Web browser, Epiphany.
  • What IP (Linux): simple IP address tool.

53 native Linux apps to 13 Android apps - not a terrible ratio to have!

All of the above apps work well on the Pinephone except where noted otherwise.

Tags:

Comments

There are 5 comments on this page. Add yours.

Avatar image
Dave posted on October 10, 2021 @ 00:15 UTC

Hi Noah, Thanks for this post about your experience with Waydroid. I've been hoping to run some Android apps such as Signal on my PinePhone but haven't had much luck with Anbox, so Waydroid sounds very promising. I have a clean Mobian/Phosh installation on a 64 Gb SD card and followed these installation instructions: https://docs.waydro.id/usage/install-on-desktops Everything seemed to install fine but when I try to open Waydroid nothing happens on the phone. 'sudo systemctl status waydroid-container.service' shows that it is running but that command shows this error after trying to open Waydroid:

Oct 09 21:45:22 mobian systemd[1]: Started Waydroid Container.
Oct 09 21:46:04 mobian waydroid[2883]: [21:46:04] Failed to add service waydroidhardware: -1

The output from $ waydroid log > ~/waydroid-log.txt shows lots of problems (edited for length):

(002822) [21:45:59] Failed to get service waydroidplatform, trying again...
(002076) [21:45:59] Failed to get service waydroidplatform, trying again...
(002903) [21:45:59] Starting waydroid session
(002903) [21:45:59] Save session config: /var/lib/waydroid/session.cfg
(002903) [21:45:59] UserMonitor service is not even started
(002903) [21:45:59] Clipboard service is not even started
(002883) [21:46:00] % /usr/lib/waydroid/data/scripts/waydroid-net.sh start
(002076) [21:46:00] Failed to get service waydroidplatform, trying again...
waydroid-net is already running
(002883) [21:46:00] % umount /var/lib/waydroid/rootfs/vendor/waydroid.prop
(002883) [21:46:00] % umount /var/lib/waydroid/rootfs/vendor
(002883) [21:46:00] % umount /var/lib/waydroid/rootfs
(002883) [21:46:00] % mount /var/lib/waydroid/images/system.img /var/lib/waydroid/rootfs
(002883) [21:46:00] % mount -o remount,ro /var/lib/waydroid/images/system.img /var/lib/waydroid/root
fs
(002883) [21:46:00] % mount /var/lib/waydroid/images/vendor.img /var/lib/waydroid/rootfs/vendor
(002072) [21:46:01] Failed to get service waydroidplatform, trying again...
(002822) [21:46:01] Failed to get service waydroidplatform, trying again...
(002883) [21:46:01] % mount -o remount,ro /var/lib/waydroid/images/vendor.img /var/lib/waydroid/root
fs/vendor
(002883) [21:46:01] % mount -o bind /var/lib/waydroid/waydroid.prop /var/lib/waydroid/rootfs/vendor/
waydroid.prop
(002883) [21:46:01] % chmod 777 -R /dev/ashmem
(002883) [21:46:01] % chmod 777 -R /dev/dri
(002883) [21:46:01] % chmod 777 -R /dev/fb0
(002076) [21:46:01] Failed to get service waydroidplatform, trying again...
(002883) [21:46:01] % chmod 777 -R /dev/video3
(002883) [21:46:01] % chmod 777 -R /dev/video2
(002883) [21:46:01] % chmod 777 -R /dev/video1
(002883) [21:46:01] % chmod 777 -R /dev/video0
(002883) [21:46:01] % lxc-start -P /var/lib/waydroid/lxc -F -n waydroid -- /init
(002883) [21:46:01] New background process: pid=2941, output=background
lxc-start: waydroid: cgroups/cgroup2_devices.c: bpf_program_load_kernel: 348 Invalid argument - Fail
ed to load bpf program: (null)
(002883) [21:46:01] Save session config: /var/lib/waydroid/session.cfg
(002903) [21:46:01] Failed to start Clipboard manager service, check logs
(002072) [21:46:02] Failed to get service waydroidplatform, trying again...
(002822) [21:46:02] Failed to get service waydroidplatform, trying again...
(002883) [21:46:04] Failed to add service waydroidhardware: -1
(002903) [21:46:04] Failed to add service waydroidusermonitor: -1
(002072) [21:46:05] Failed to get service waydroidplatform, trying again...

Do you have any ideas about how to resolve these issues?

Thanks, Dave

Avatar image
Noah (@kirsle) posted on October 10, 2021 @ 21:48 UTC (updated 10/10/21 22:24 UTC)

Hey Dave,

Waydroid has been finicky like this for me each time I upgrade, it seems. My Mobian install is currently upgraded to the bookworm (testing) branch, and I realized I had originally installed Waydroid using their bullseye (stable) repo; so I corrected that and then Waydroid was failing to start.

I found two common issues that come back now and again:

One is that the Waydroid container fails to start, and waydroid log says that it failed to mount tmpfs on /usr/lib/x86_64-linux-gnu/lxc/mnt_extra and when this happens the solution is to run sudo waydroid upgrade to download the latest LineageOS base. This has happened to me on at least two apt upgrades of Waydroid, so they seem to break something often here.

Another problem was in case every Waydroid command would say: "Run 'waydroid log' for details." and even when you run waydroid log it says the same instead of showing you the log. This turned out to be a log file ownership problem and how I eventually got it working was: I had to add --details-to-stdout to all waydroid commands and could manually start the container, session, and show-full-ui.

Waydroid worked great on my last upgrade a couple of days ago, I'll try a latest apt upgrade on bookworm and update if any such tweaks were needed. Their install and manual troubleshooting documentation and checking their issue tracker I can usually get it running again; it does suck during times when I can not.

Update: after an upgrade and a reboot (there was no Waydroid update for me today), was able to just launch the Full UI with no fussing about on the CLI. Try sudo waydroid upgrade to ensure the Android base is updated or try a reinstall from scratch.

Avatar image
Dave posted on October 11, 2021 @ 14:48 UTC

Thanks Noah. Unfortunately I still haven't gotten it working and I'm not sure what to try next. Here's what I've tried:

  1. sudo waydroid upgrade didn't do anything
  2. I tried a reinstall of Waydroid (per the Waydroid documentation) and I still got the same errors
  3. I tried switching my Mobian installation to bookworm but still got the same errors
  4. I reinstalled Waydroid on bookworm... same errors
  5. I poked around on the issue tracker and installed python3-pyclip, but I don't think that fixed anything significant.

It appears from the logs that the key problem is related to bpf. Maybe I need to try a different kernel?

(010821) [13:52:22] % lxc-start -P /var/lib/waydroid/lxc -F -n waydroid -- /init
(010821) [13:52:22] New background process: pid=10869, output=background
lxc-start: waydroid: cgroups/cgroup2_devices.c: bpf_program_load_kernel: 334 Invalid argument - Failed to load bpf program: (null)
(010821) [13:52:22] Save session config: /var/lib/waydroid/session.cfg
(010836) [13:52:26] Failed to add service waydroidusermonitor: -1
(010836) [13:52:26] Failed to add service waydroidclipboard: -1
(010821) [13:52:26] Failed to add service waydroidhardware: -1
lxc-start: waydroid: conf.c: run_buffer: 323 Script exited with status 126
lxc-start: waydroid: start.c: lxc_end: 996 Failed to run lxc.hook.post-stop for container "waydroid"`

This is what I have now:

mobian@mobian:~$ uname -a
Linux mobian 5.10-sunxi64 #1 SMP PREEMPT Sat Aug 7 12:10:38 UTC 2021 aarch64 GNU/Linux
Avatar image
Noah (@kirsle) posted on October 11, 2021 @ 19:55 UTC

Hey Dave,

I'm running the same kernel as you, I'm not sure what the bpf thing is about and didn't find much on Google; here are some details from my Pinephone:

[kirsle@pine ~]% cat /etc/debian_version 
bookworm/sid
[kirsle@pine ~]% uname -a 
Linux pine 5.10-sunxi64 #1 SMP PREEMPT Sat Aug 7 12:10:38 UTC 2021 aarch64 GNU/Linux
[kirsle@pine ~]% lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux bookworm/sid
Release:	testing
Codename:	bookworm
[kirsle@pine ~]% waydroid --version
1.1.1
[kirsle@pine ~]% md5sum /usr/bin/waydroid 
e74e7a364382cc301a182050655da4d5  /usr/bin/waydroid
[kirsle@pine ~]% cat /etc/apt/sources.list
deb http://deb.debian.org/debian bookworm main
[kirsle@pine ~]% cat /etc/apt/sources.list.d/mobian.list 
deb http://repo.mobian-project.org/ bookworm main non-free
[kirsle@pine ~]% cat /etc/apt/sources.list.d/waydroid.list 
deb [signed-by=/usr/share/keyrings/waydroid.gpg] https://repo.waydro.id/ bookworm main

Software all up to date, today I had some upgrades for appstream apt-config-icons flatpak gir1.2-flatpak-1.0 libappstream4 libflatpak0 but nothing new for Waydroid or kernels. I last installed Mobian from the 2021-05-16 installer image and don't think I've installed a bunch of weird things since then (development libraries etc., most my apps were from Flathub or apt installs).

Avatar image
Dave posted on October 11, 2021 @ 21:04 UTC

Thanks for the quick reply. Everything you listed above is identical to my phone. The only difference is that I had some packages held back for some reason. I manually upgraded them with apt but that didn't change anything. I would assume this is the same on your phone:

mobian@mobian:~$ md5sum /var/lib/waydroid/images/*
86ad0eafb86a528ee2f6f6c3ff6036b7  /var/lib/waydroid/images/system.img
3caf5a31f3574c7f9ecb490007f55df7  /var/lib/waydroid/images/vendor.img

I also used a Mobian image from that same date. The only thing I can think of at this point that might differ is that I used the full disk encryption image (mobian-installer-pinephone-phosh-20210516.img.gz).

Here's how I try to start Waydroid:

  1. after a reboot, ssh into the phone and run $ sudo systemctl status waydroid-container.service to confirm that the container service is running.
  2. then I log into the phone directly and tap the Waydroid icon, or run waydroid session start in a terminal session- this is when I see the errors from $ sudo waydroid --details-to-stdout log

Add a Comment

Used for your Gravatar and optional thread subscription. Privacy policy.
You may format your message using GitHub Flavored Markdown syntax.