From postmarketOS
Jump to navigation Jump to search
Note Consider using native Linux programs instead, see FAQ.

Waydroid is the modern approach to run Android apps on Linux. It is similar to Anbox, but it works with Wayland and is more performant. Waydroid is available in postmarketOS v21.12 and newer. Running Android apps on mobile Linux is still kind of experimental, so be prepared to deal with problems.


$ sudo apk add waydroid

Additional steps, or else the container won't start:

$ sudo rc-update add cgroups default # optional
$ sudo rc-service cgroups start
$ sudo apk add iptables dnsmasq


After installation, the Waydroid session is configured to start automatically on boot.

In order to run apps, the container needs to be started as well. (Apparently it should start automatically when running apps? Also it appears to take quite some time to start up.)

You can start the container and session as follows:

"Container" refers to the Android LXC container itself

$ sudo rc-service waydroid-container start

You can also let the container start on boot automatically:

$ sudo rc-update add waydroid-container default

"Session" refers to the Waydroid specific bits to integrate Android apps into your users environment (.desktop files etc). If it doesn't start up automatically on boot, you can launch it manually (and you have to do this if you stop the previously mentioned OpenRC service):

$ waydroid session start

Note that this command will not terminate after starting the session but will stay in the foreground, so either open a new terminal afterwards or send it to background via `nohup`.

Use the following command to inspect the status of Waydroid:

$ waydroid status
Session:        RUNNING
Container:      RUNNING
Vendor type:    MAINLINE
Session user:   user(10000)
Wayland display:        wayland-0

You can run the Android container in fullscreen (note that this isn't necessary to run apps):

$ waydroid show-full-ui

Run apps from the command-line:

$ waydroid app list
$ waydroid app launch com.android.settings

See waydroid -h for more information.



The container may not have access to the Internet out of the box. To access the network you need to allow access from and to the container via the firewall (otherwise DHCP will be blocked and the container will never get the IP) and configure a default gateway in the waydroid container (gateway IP is what your host device has on waydroid0 interface):

$ echo "ip route add default via" | sudo waydroid shell

If this fails with an error about an unreachable network, run:

$ sudo apk add waydroid-nftables

Waydroid service not starting

Waydroid may take 15 - 20 minutes, with errors in logs during its initial boot. See https://forum.pine64.org/showthread.php?tid=15813 for more details

Starting the Waydroid service

If you see something like this in your log:

(004537) [17:13:07] % sudo mount /usr/share/waydroid-extra/images/system.img /var/lib/waydroid/rootfs
mount: /var/lib/waydroid/rootfs: mount failed: Operation not permitted.

You most likely don't have the loop kernel module loaded or enabled. Try modprobe loop. If that doesn't work, make sure CONFIG_BLK_DEV_LOOP is enabled in your kernel.

Run 'waydroid log' for details

If every time you try to start a command as a non-root user nothing happens, and it prints "Run 'waydroid log' for details", it is due to the following bug, where the application crashed due to being unable to access the log. Until the fix is included in postmarketOS, sudo chown $(whoami) /var/lib/waydroid/waydroid.log should work as a temporary fix.


  • pmaports#1173 lets package it for postmarketOS
  • pmaports!2497 main/linux-postmarketos-*: enable CONFIG_PSI (with side-by-side performance video)