I would like to set up Canonical hosted Ubuntu Base image for arm on my Android phone.

I need a simple step by step answer on how to get started.

I would like to be able to use Ubuntu to run apps on my phone, without rooting it.

See this question for app installation.

  • This is two separate questions rolled into one (setting up Ubuntu somehow, installing Foliate in Ubuntu). I'm voting to close as too broad until the question is narrowed to be either one.
    – muru
    Apr 18 at 9:25
  • Now that the reference to Foliate has been removed, I don't see why it should be closed. (I am working on a detailed answer, which would take some time to complete). If this question is "too broad", then questions like "How to install Ubuntu?" or "How to dual boot Ubuntu with Windows" should also be classified as too broad, but we have excellent answers to such questions on this website. Apr 18 at 13:43
  • @ Archisman Panigrahi I am looking forward to your answer. Even my attempts with Ubuntu Base on AMD has not gone far There is very little on Ask Ubuntu about it. Apr 18 at 14:19
  • 1
    Please let me know if my answer seems too complicated, or if some of the steps are not clear. Once you are done installing Ubuntu and XFCE (for the first time, I suggest using the simplest method), please ask a new question about Foliate and I will answer it (Foliate requires some special workarounds to prevent sandboxing in Webkit, which Android does not allow for some reason). Apr 19 at 6:05
  • Please let me know if you don't want to ask the original question (about Foliate) for some reason. Then I will ask the question and answer it myself. I have started writing the draft of that answer. :-) Apr 20 at 19:04

Setting up Ubuntu in Termux involves three parts,

  1. Installing the base image
  2. Installing a DE (I will use XFCE in this answer, as it is user friendly but not heavy) and a VNC server
  3. (optional) Enabling sound, because VNC protocol does not support sound

Simplest method - If you don't want to get your hands dirty, install Termux, and simply download either Andronix (Website, GitHub) or AnLinux, and install Ubuntu 20.04 with them. These apps provide the scripts to download and extract the base image, to install desktop environments (e.g. XFCE), and setup the VNC server, which you simply need to copy-paste in Termux.

enter image description here enter image description here enter image description here

User interface of Andronix

How to use it?

When done, enter the command ./start-ubuntu20.sh to open Ubuntu, and the command exit to leave Ubuntu. Once you start Ubuntu, enter the command vncserver-start to start the VNC server (with the XFCE desktop), and the command vncserver-stop to stop it. (unfortunately, it is named ubuntu20, although it is actually Ubuntu 20.04, not Ubuntu Core 20. Once you get an idea how the script works, you can rename everything to ubuntu20.04, or anything else)

enter image description here Some of the entries (e.g. uptime) are wrong due to fake /proc entries, otherwise recent versions of Android would not let Ubuntu work.

How to access XFCE desktop with VNC Viewer?

Install a VNC viewer app in Android, e.g. VNC Viewer - Remote Desktop, or androidVNC. And open the address localhost:5901 to connect to the VNC Server. Tip: Choose quality: high, or 24-bit color (4 bpp) for better picture quality. Also, VNC Viewer - Remote Desktop supports the portrait as well as landscape mode very well. Other VNC viewers don't seem to have good support for the portrait mode.

xfce foliate Applications running in XFCE desktop. I installed Tango icon theme and Arc GTK theme

However, these apps will download the Ubuntu Base from their GitHub repo (where they have saved a copy), not from Canonical's website. All the scripts in these apps are available in their GitHub repositories under free licenses.

What does this script do?

This script downloads the Ubuntu rootfs image for the architecture of your device, and then sets it up to work with proot. Recent versions of Android (v10, v11) impose some restrictions, and that is why this script creates fake entries in /proc to fool Ubuntu and Android into functioning normally.

Enabling Sound

Andronix has made a script to enable sound. Run the following command in a termux (Not Ubuntu) shell.

 pkg install wget && wget https://andronixos.sfo2.cdn.digitaloceanspaces.com/OS-Files/setup-audio.sh && chmod +x setup-audio.sh && ./setup-audio.sh

To use sound

Start Ubuntu in a Termux shell, and open another Termux shell (don't open Ubuntu there). Run pulseaudio --start in the new Termux shell (not in Ubuntu), and now Ubuntu would be able to play audio. Audio demonstration - Youtube Video

Note that the file setup-audio.sh is cryptic (probably so that the competitor's of Andronix cannot use it), and its human readable form can be found here. It is so cryptic that people at Unix & Linux Stack Exchange thought that it could be a malware, but I have verified that it is not.

Slightly complex method - combine step 1. and 2. in one go (but download the images from Canonical, not from Andronix's GitHub repo).

Andronix has an automated script for downloading the rootfs, installing the DE, and then setting up the VNC server.

However, the Andronix script downloads the rootfs from their GitHub repo (a renamed version of the Ubuntu 20.04 (not 20.04.2) rootfs), not from Canonical's server.

We will modify the script to use the image from the Canonical's server instead. First install wget and nano in Termux (if already not installed), and then download the script.

pkg install wget nano

wget https://github.com/AndronixApp/AndronixOrigin/blob/master/Installer/Ubuntu20/ubuntu20-xfce.sh

Now open the script in Nano.

nano ubuntu20-xfce.sh

Change the contents of line 29 (use either Hacker's keyboard or scrcpy - see Tips:#6. Otherwise it is hard to edit in a mobile device),

wget "https://github.com/AndronixApp/AndronixOrigin/raw/master/Rootfs/Ubuntu20/focal-${archurl}.tar.gz" -O $tarball

to the following

wget "https://cdimage.ubuntu.com/ubuntu-base/releases/20.04/release/ubuntu-base-20.04.2-base-${archurl}.tar.gz" -o $tarball

Now save the file (ctrl + x), and run it.

sh ubuntu20-xfce.sh

Now head on to How to use it? and How to access XFCE desktop? (in previous parts of the answer). You can optionally follow Enabling sound to enable sound.

Complicated method

  1. Installing the base image

  • The first step is to install Termux in Android. It is available in Google Play(not anymore updated) as well as in F-Droid.

  • Installing the rootfs. It involves a lot of steps, so I would take help from scripts available in GitHub (otherwise it would be reinventing the wheel). Some of such projects are, Andronix, AnLinux, Ubuntu-on-Termux (there are many more). Among these, AnLinux (also available on F-Droid) and Andronix are available as Android apps, to help copy-pasting the installation commands. The script in Ubuntu-on-Termux has to be downloaded and manually run in Termux. You can edit these scripts to suit your needs.

Andronix has an automatic script for downloading the rootfs, installing the DE, and then setting up the VNC server. To use this, install the Andronix app, choose Ubuntu 20.04, and install the XFCE version.

However, the Andronix script downloads the rootfs from their GitHub repo (a renamed version of the Ubuntu 20.04 (not 20.04.2) rootfs), not from Canonical's server.

To use the version from Canonical's server, we will use the script in Ubuntu-on-Termux instead.

Open a Termux window, and enter the following commands one by one. The first command installs wget in Termux, the second fetches the ubuntu.sh file using wget, and the third executes ubuntu.sh.

pkg install wget

wget https://raw.githubusercontent.com/MFDGaming/ubuntu-in-termux/master/ubuntu.sh

sh ubuntu.sh

What does ubuntu.sh do?

It installs proot in Termux, downloads and extracts the Ubuntu 20.04.1 base image, and sets up a script (startubuntu.sh) to run Ubuntu afterwards.

Once done, enter the command ./startubuntu.sh to start the Ubuntu session, and the command exit to exit from the Ubuntu session. (If you use Andronix or AnLinux instead, you may have to run ./start-ubuntu.sh or ./start-ubuntu20.sh instead.)

  1. Installing XFCE desktop and VNC server

You can manually install xfce4, xfce4-goodies and tigervnc-standalone-server ,tigervnc-common, and dbus-x11, and then set up the vncserver (create a password, add startxfce4 to .vnc/xstartup and run vncserver :1. To close, run vncserver -kill :1).

However, we can use the script by Andronix to set up XFCE desktop and VNC Server.

Open Termux, and start Ubuntu. First we will install wget and download the script.

apt update && apt install wget
wget https://raw.githubusercontent.com/AndronixApp/AndronixOrigin/master/APT/XFCE4/xfce19.sh
sh xfce19.sh

You can provide a password for VNC (or provide no password, if you wish so). Now, you can start the vncserver with the command vncserver-start, and stop it with the command vncserver-stop.

System requirements:

  • Recent versions of Termux work with Android 7 and higher. However, you can download slightly older versions of Termux which work with Android 5 and 6 (I have verified that they function correctly).
  • The Ubuntu rootfs + XFCE desktop consume ~ 1 GB of disk space, and ~ 300 MB of RAM.


By default, Ubuntu rootfs cannot access the files in your Android phone. Data in Termux is isolated from other data in Android. And you can easily delete all files in Termux (including Ubuntu) by deleting the application data in Android settings. However, I bear no responsibility for any kind of issue arising from following this answer. The number of stars in GitHub would give you an idea about how many people are using these scripts. They are not malware.


  1. One can change the screen resolution in VNCServer. I found that the resolution 700x1500 (in portrait mode) works very well in my 6.5 inch phone screen.
  2. Vanilla XFCE is boring, you can install your favorite icon themes and GTK themes.
  3. You can edit start-ubuntu20.sh/startubuntu.sh to access the internal storage and sdcard of your phone.
  4. By default, it uses the root account. However, you can create non-root account with su -s username, and give them sudo access.
  5. Choose quality: high, or 24-bit color (4 bpp) in the VNC Viewer for better picture quality.
  6. To edit files in Termux, install Hacker's Keyboard(Google Play, F-Droid) in Android, or use scrcpy to use your computer's keyboard for editing.
  7. Containerized apps (e.g. snaps and flatpak) are known not to work in this method. Quoting from the Andronix Docs

SNAP/Docker/Flatpak packages cannot be installed on any Linux environment. It is mainly due to two reasons. Primary being that both require kernel and bus modeules which are unavailable in PRoot environment and second being that both are mainly focused on Intel/AMD based architectures and not for arm architecture.

Feel free to edit this answer to make it better.

  • Disclaimer: I am not affiliated with any of the apps/GitHub projects mentioned in this answer. Apr 19 at 6:09
  • Plenty of detail, thank you it is an acceptable answer. Installing Ubuntu is on-topic in Ask Ubuntu and this is about installing Ubuntu. Apr 19 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.