Skip to content

Instantly share code, notes, and snippets.

@pilafov
Last active September 9, 2025 00:26
Show Gist options
  • Select an option

  • Save pilafov/9f50de89a245a2922e89f31d65a92607 to your computer and use it in GitHub Desktop.

Select an option

Save pilafov/9f50de89a245a2922e89f31d65a92607 to your computer and use it in GitHub Desktop.
Waydroid in WSL2

This is to expand on onomatopellan's original tutorial here Waydroid in WSL2 with sound

We had a productive discussion and confirmed that Weston installation is optional. Since Weston is already part of WSLg and availible in WSL2, the guide is getting much simplified. Bottomline, if you prefer you can do this without second/separate Weston installtion.

To simplify it even further I use this startup script "android-startup.sh" (below) which automates the startup steps. But that comes after the installations and other preparations. For them just follow onomatopellan's guide.

#!/bin/bash
if [[ $(pgrep -u $UID -f "dbus-daemon --session") ]]; then
echo "Found a running instance of 'dbus-daemon'"
else
dbus-daemon --session --address=$DBUS_SESSION_BUS_ADDRESS --nofork --nopidfile --syslog-only &
echo "Spawned a new instance of 'dbus-daemon'"
fi
export GALLIUM_DRIVER=d3d12
WAYDROID_SESS_LOG=/tmp/waydroid_session_start.out
waydroid session start >$WAYDROID_SESS_LOG 2>&1 &
WAYDROID_SESS_PID=$!
echo WAYDROID_SESS_PID=$WAYDROID_SESS_PID
while [[ true ]]; do
echo "Waiting for 10s longer ..."
sleep 10
WAYDROID_SESS_ACTIVE=$(ps --no-headers -o pid -p $WAYDROID_SESS_PID)
#echo "PID: [$WAYDROID_SESS_ACTIVE] is running"
if [[ -z "$WAYDROID_SESS_ACTIVE" || "$WAYDROID_SESS_ACTIVE" -ne "$WAYDROID_SESS_PID" ]]; then
echo "Failed: Something went wrong with Waydroid's session."
cat $WAYDROID_SESS_LOG
exit 99
fi
grep --quiet --no-messages --regexp 'Android.*is ready$' $WAYDROID_SESS_LOG
if [[ "$?" -eq 0 ]]; then
waydroid show-full-ui
exit 0
fi
#ps -p $WAYDROID_SESS_PID
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment