Skip to content

Instantly share code, notes, and snippets.

@onomatopellan
Last active January 9, 2026 11:59
Show Gist options
  • Select an option

  • Save onomatopellan/c5220c0efddaff69aaff77cca80b7b8e to your computer and use it in GitHub Desktop.

Select an option

Save onomatopellan/c5220c0efddaff69aaff77cca80b7b8e to your computer and use it in GitHub Desktop.
Waydroid in WSL2 with sound (Weston on top of Weston approach)

Waydroid in WSL2 with sound

Requirements

Recommended to install Waydroid in a brand new Ubuntu 25.04 install. Waydroid needs a custom linux kernel. Actually just needs latest kernel for WSL2 with just these changes before compiling:

CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"

Make sure WSL2 uses the custom kernel and modules modifying .wslconfig (or using WSL Settings)

[wsl2]
kernel=D:\\mykernel\\bzImage-6.6.87.ANDROID
kernelModules=D:\\mykernel\\modules.vhdx
Compiling the 6.6.x kernel: Step-by-step guide Instructions for building an x86_64 WSL2 6.6.x kernel with an Ubuntu distribution using bash are as follows:
  • Install the build dependencies:
    sudo apt install build-essential flex bison dwarves libssl-dev libelf-dev cpio qemu-utils

  • Download de kernel (always in a /home/user/ directory)
    git clone https://github.com/microsoft/WSL2-Linux-Kernel.git --depth=1

  • Change directory to kernel's directory root
    cd WSL2-Linux-Kernel

  • Modify WSL2 kernel configs:
    make menuconfig KCONFIG_CONFIG=Microsoft/config-wsl

Device Drivers --> Android --> Select "Android Binder IPC Driver" -> Save

  • Build the kernel using the WSL2 kernel configuration and put the modules in a modules folder under the current working directory:
    make -j$(nproc) KCONFIG_CONFIG=Microsoft/config-wsl && make INSTALL_MOD_PATH="$PWD/modules" modules_install

  • Strip symbols from modules (skip this step if you are insterested in debugging kernel's memory dumps)
    find ./modules/lib/modules/$(make -s kernelrelease) -name '*.ko' -exec strip --strip-unneeded {} \;

  • Then, you can use a provided script to create a VHDX containing the modules:
    sudo ./Microsoft/scripts/gen_modules_vhdx.sh "$PWD/modules" $(make -s kernelrelease) modules.vhdx

  • Copy de generated kernel and modules to the desired folder
    cp arch/x86/boot/bzImage /mnt/d/mykernel/bzImage-6.6.87.2.ANDROID
    cp modules.vhdx /mnt/d/mykernel/modules.ANDROID.vhdx

  • Open WSL Settings -> Developer -> Select Custom kernel, Custom modules

  • Shutdown WSL2 VM
    wsl.exe --shutdown

Setup

Download ubuntu-25.04-wsl-amd64.wsl distro from https://releases.ubuntu.com/plucky/

Double click on the .wsl file to install.

Run Ubuntu 25.04 and make sure is updated

sudo apt update && sudo apt upgrade -y

Install weston

sudo apt install weston

Install Waydroid

curl -s https://repo.waydro.id | sudo bash
sudo apt install waydroid

Configure Waydroid to only use software rendering (SwiftShader)

sudo nano /var/lib/waydroid/waydroid_base.prop

    ro.hardware.gralloc=default
    ro.hardware.egl=swiftshader

Make weston detect gpu for some acceleration

export GALLIUM_DRIVER=d3d12

Run weston

weston --backend=wayland-backend.so 

Inside weston desktop shell open a terminal and run

waydroid session start

When it shows 'Android with user 0 is ready' then open another terminal inside the weston desktop and run

waydroid show-full-ui

Tips:

  • If Waydroid shows some weird dbus errors make sure you shutdown the WSL2 VM (wsl.exe --shutdown) and try again.

  • By default Waydroid only launches correctly if the WSL2 networking mode is not MIRRORED. This is because dnsmasq tries to reserve some ports that are already used in Windows. If you want to keep using MIRRORED networking you will need to add this to your .wslconfig (or using WSL Settings)

    [experimental]
    ignoredPorts=53,67,68
    
  • Every time the WSL2 kernel changes significantly (from ASHMEM support in 5.15.x to none in 6.6.x) you need to reconfigure Waydroid or it wont boot.

      sudo waydroid upgrade --offline
    
@onomatopellan
Copy link
Author

onomatopellan commented Dec 29, 2025

@Bushido76 I just updated the list of ignored ports (53, 67, 68) that are needed to launch the lxc-net service in MIRRORED networking mode. Waydroid needs a working lxc-net in order to create the waydroid0 bridge. What's your output for systemctl status lxc-net.service ?

edit: I presume your kernel is properly compiled using Microsoft/config-wsl-arm64 instead of Microsoft/config-wsl

@Bushido76
Copy link

Dear @onomatopellan, thank you very much for your response. Indeed I used Microsoft/config-wsl because I was not aware of a dedicated ARM64 config. But even in this constellation, I managed to setup the waydroid0 interface and now I can see an IP in the container. In general great progess, but it seems that there is one last blocking stone. In the waydroid shell the network is working great (DNS + ping + curl), but when I try to access WebPages in the Android browser it's only a few (simple) pages working. For most of the WebPages, the progress bar does stuck around 50% and the browser page stays empty. Do you have an idea what the reason for this behaviour could be? I played around with MTU, firewall settings and some GPU parameters, but had to give up at the end...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment