Run full Ubuntu Desktop (XFCE/GNOME) on Android using Termux and Udroid. This repository provides scripts to automate the setup and fix common audio/display issues, but also includes full manual instructions below.
- One-Click Setup: Installs dependencies (X11, Audio) automatically.
- Auto-Fix Script: Clears "Access Denied" or "Display Locked" errors.
- Audio Support: Enables PulseAudio for sound in Linux (fixes Firefox audio).
- No Root Required.
This guide is based on the official Udroid documentation. If you encounter any issues not covered here, please check the official guide: https://docs.udroid.org/
Before you begin, you must install these two apps on your Android device:
- Termux (Download from F-Droid) - Do not use the Play Store version.
- Termux-X11 (Download from GitHub Actions) - Install the debug APK.
If you just want to get it running quickly, use the included scripts.
-
Open Termux and clone this repo:
pkg install git -y git clone https://github.com/jarvesusaram99/ubuntu-on-android.git cd ubuntu-on-android chmod +x setup.sh launch.sh -
Run the installer:
./setup.sh
-
To Start Ubuntu (Every time): Run the launch script. It automatically fixes audio and display locks.
./launch.sh
If you prefer to run the commands yourself, follow these steps exactly.
Open Termux and run:
pkg update && pkg upgrade -y
pkg install x11-repo -y
pkg install termux-x11-nightly -y
pkg install proot pulseaudio -yRun the official installer:
. <(curl -Ls https://bit.ly/udroid-installer)- Select
install->jammy(Ubuntu 22.04) ->xfce4(Recommended) orgnome.
If you are not using the launch.sh script, you must run these commands manually every time you want to use Linux. This ensures audio works and the display doesn't crash.
First, clear any old sessions to avoid "Display :0 is already in use" errors:
killall -9 termux-x11
rm -rf /tmp/.X11-unix
rm -rf /tmp/.X0-lockEnable sound support (PulseAudio) before starting the desktop:
export LD_PRELOAD=/system/lib64/libskcodec.so
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1Start the X11 display in the background:
termux-x11 :0 &(Make sure you have opened the Termux:X11 app in the background first!)
Log into your installed system:
udroid login jammy:xfce4(Use jammy:gnome if you installed GNOME)
Once you see the root@localhost prompt, run:
export DISPLAY=:0
export PULSE_SERVER=127.0.0.1
startxfce4If you have no sound in Firefox:
- Open Firefox inside Ubuntu.
- Type
about:configin the address bar. - Search for:
security.sandbox.content.level - Change the value to
0. - Restart Firefox.
- Black Screen?
Make sure
termux-x11app is open. Run the "Kill Stuck Processes" commands and try again. - Audio not working?
Ensure you ran the
pulseaudiocommand before logging into Udroid.