Skip to content

Instantly share code, notes, and snippets.

@1kko
Last active April 15, 2025 15:45
Show Gist options
  • Save 1kko/7fd1621f29aad88ea4fc3643a6f3e832 to your computer and use it in GitHub Desktop.
Save 1kko/7fd1621f29aad88ea4fc3643a6f3e832 to your computer and use it in GitHub Desktop.
Guide: Ubuntu 24.04 + XFCE on Meta Quest 2 via Termux & VNC (with Tailscale & Firefox ESR)

Guide: Ubuntu 24.04 + XFCE on Meta Quest 2 via Termux & VNC (with Tailscale & Firefox ESR)

Date: Tuesday, April 15, 2025 at 10:20:59 PM KST

This guide details the steps to set up the Quest 2 host environment and then install Ubuntu (expected to be 24.04 LTS) with the XFCE4 desktop environment inside Termux on a Meta Quest 2 headset. Access to the graphical desktop is achieved using a VNC client connecting over a Tailscale secure network. It includes instructions for Firefox ESR and Korean language support.

Disclaimer:

  • Performance: Expect sluggish performance compared to a native PC setup. This runs via compatibility layers (proot) within Android. Firefox ESR, while stable, can still be demanding.
  • Usability: Interacting with a desktop UI in VR can be challenging. A Bluetooth keyboard and mouse connected to the Quest 2 are highly recommended.
  • Third-Party Software: This guide involves SideQuest and, optionally, APKPure. Use third-party sources and sideloading responsibly and at your own risk. Getting Termux directly from F-Droid or GitHub is strongly recommended over using APKPure.
  • Ubuntu Version: Using proot-distro install ubuntu typically installs the latest LTS version (24.04 as of this writing). Use proot-distro list in Termux to confirm available aliases if needed.

Section A: Quest 2 Host Setup (ADB & SideQuest)

These steps prepare your Quest 2 headset. You need a PC for SideQuest and ADB commands.

A1. Enable Developer Mode on Quest 2

  1. Register as a developer on the Meta Quest developer website: https://developer.oculus.com/
  2. Open the Meta Quest App on your phone connected to your headset.
  3. Go to Menu -> Devices -> Select your Headset -> Headset Settings -> Developer Mode.
  4. Toggle Developer Mode ON.
  5. Reboot your Quest 2 headset.

A2. Install SideQuest on PC

  1. Download and install SideQuest (Advanced Installer) on your Windows PC from the official site: https://sidequestvr.com/setup-howto
  2. Follow their setup instructions, which involve connecting your Quest 2 to your PC via USB cable.
  3. Inside the headset, Allow USB Debugging and trust the connected computer when prompted. SideQuest should show "Connected" status.

A3. Sideload APKPure via SideQuest

  1. WARNING: APKPure is an unofficial app source. Proceed with caution and understand the security risks. Download the latest APKPure APK file from their official website (e.g., apkpure.com) onto your PC.
  2. In SideQuest on your PC, look for an icon that looks like a box with a down arrow, usually labelled "Install APK file from folder".
  3. Click this icon, navigate to, and select the downloaded APKPure .apk file.
  4. SideQuest will install the APKPure app onto your Quest 2.

A4. Install Apps via APKPure (on Quest 2)

  1. Put on your Quest 2 headset.
  2. Navigate to your App Library.
  3. In the top-right filter dropdown, select Unknown Sources.
  4. Launch the APKPure app.
  5. Inside APKPure, search for and install the following apps:
    • Tailscale: (Needed for the secure network connection)
    • Termux: (WARNING: Installing Termux this way is not recommended. Use the official F-Droid or GitHub release instead for verified builds: https://github.com/termux/termux-app#installation)
    • Gboard - the Google Keyboard: (Needed for the ADB input method steps below).

A5. Configure via ADB

  1. Ensure your Quest 2 is still connected via USB to your PC, Developer Mode is ON, and USB Debugging is allowed for the PC.
  2. Ensure you have ADB (Android Debug Bridge) working on your PC (part of Android SDK Platform Tools).
  3. Verify ADB connection: Run adb devices. You should see your Quest 2 listed as 'device'.
  4. Set Gboard as Default Input Method: This can improve keyboard input within Termux/VNC and is required for the next command.
    # (Run on PC Command Prompt/PowerShell)
    adb shell ime enable com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME
    adb shell ime set com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME
    • Explanation: Enables Gboard and sets it as the active default keyboard. This may allow easier IME switching (like for Korean input later using Ctrl+Space, if Gboard handles it).
  5. Apply Android 12 Phantom Process Fix: Helps prevent Android from aggressively killing background processes like Termux.
    # (Run on PC Command Prompt/PowerShell)
    adb shell device_config put activity_manager max_phantom_processes 214181594
    • Explanation: Sets the background process limit very high, effectively disabling the Android 12+ feature that could prematurely kill Termux.

Your Quest 2 host environment should now be prepared.


Section B: Termux Environment and Ubuntu/XFCE Setup

Now we proceed with setting up Termux itself and installing Ubuntu.

B1. Initial Termux Setup

  1. Open Termux on your Quest 2.
  2. Update Termux packages:
    # (Termux)
    pkg update && pkg upgrade -y
  3. Install proot-distro:
    # (Termux)
    pkg install proot-distro -y

B2. Install Ubuntu

  1. Install the Ubuntu root filesystem using proot-distro. Using ubuntu typically installs the latest LTS (currently 24.04).
    # (Termux)
    proot-distro install ubuntu
    (This may take some time. If ubuntu installs an unexpected version, use proot-distro list to find the specific alias for 24.04, e.g., ubuntu-24.04 or ubuntu-noble, then remove and reinstall using that alias).

B3. Ubuntu Initial Configuration

  1. Log into the Ubuntu environment:
    # (Termux)
    proot-distro login ubuntu
  2. All subsequent commands are run inside Ubuntu unless noted.
  3. Update Ubuntu's package list:
    # (Ubuntu)
    apt update
  4. Install essential utilities and sudo:
    # (Ubuntu)
    apt install -y sudo nano wget curl software-properties-common apt-utils dialog locales dbus-x11 gpg apt-transport-https ca-certificates
  5. Configure basic English locale:
    # (Ubuntu)
    locale-gen en_US.UTF-8
    update-locale LANG=en_US.UTF-8

B4. Install XFCE4 Desktop

  1. Install the XFCE4 core packages and extras:
    # (Ubuntu)
    sudo apt update # Ensure lists are fresh before big install
    sudo apt install -y xfce4 xfce4-goodies xfce4-terminal

B5. Install Firefox ESR (Extended Support Release - PPA Method)

This method uses the Mozilla Team PPA to install the ESR version, which prioritizes stability.

  1. Add the Mozilla Team PPA: (software-properties-common was installed in B3).
    # (Ubuntu)
    sudo add-apt-repository ppa:mozillateam/ppa -y
  2. Update your package list:
    # (Ubuntu)
    sudo apt update
  3. Install Firefox ESR:
    # (Ubuntu)
    sudo apt install firefox-esr
    (If this fails with "no installation candidate", the PPA may not support Ubuntu 24.04/arm64 yet for ESR. In that case, you might have to reconsider Firefox stable via the Mozilla Repo method detailed previously or try manual installation.)
  4. (Optional) Install ESR Language Packs: (Example for Korean)
    # (Ubuntu)
    sudo apt install firefox-esr-l10n-ko

B6. Enable Korean Language Support

  1. Install Korean language packs:
    # (Ubuntu)
    sudo apt install -y language-pack-ko language-pack-gnome-ko
  2. Install necessary fonts:
    # (Ubuntu)
    sudo apt install -y fonts-noto-cjk fonts-nanum
  3. Install the Fcitx5 Input Method Engine (IME) and Hangul support:
    # (Ubuntu)
    sudo apt install -y fcitx5 fcitx5-hangul fcitx5-config-qt # Or fcitx5-configtool
  4. Configure environment variables for IME. Edit /etc/environment:
    # (Ubuntu)
    sudo nano /etc/environment
    Add these lines:
    GTK_IM_MODULE=fcitx
    QT_IM_MODULE=fcitx
    XMODIFIERS=@im=fcitx
    
    Save and exit (Ctrl+X, Y, Enter). Changes apply on next login/session start.
  5. (Optional) Set Default System Locale to Korean: Changes UI language.
    # (Ubuntu)
    # sudo locale-gen ko_KR.UTF-8
    # sudo update-locale LANG=ko_KR.UTF-8
  6. Using Korean Input: In the XFCE session, use the panel keyboard icon or shortcut (e.g., Ctrl+Space) to toggle input. Configure via fcitx5-config-qt or fcitx5-configtool.

B7. Install TigerVNC Server

  1. Install the TigerVNC standalone server:
    # (Ubuntu)
    sudo apt install -y tigervnc-standalone-server tigervnc-common
    (Remember: Ignore the setpriv: setresgid failed error during install)

B8. Configure VNC Server

  1. Set your VNC password (as root or your user ikko if created and granted sudo):
    # (Ubuntu)
    vncpasswd
    (Run this as the user who will start the vncserver)
  2. Create the VNC configuration directory for that user:
    # (Ubuntu - run as the user who will start vncserver, e.g., root or ikko)
    mkdir -p ~/.vnc
  3. Create and edit the VNC startup script (~/.vnc/xstartup):
    # (Ubuntu - run as the user who will start vncserver)
    nano ~/.vnc/xstartup
  4. Paste the following content (using dbus-launch):
    #!/bin/bash
    unset SESSION_MANAGER
    unset DBUS_SESSION_BUS_ADDRESS
    [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
    dbus-launch --exit-with-session startxfce4
  5. Save and exit (Ctrl+X, Y, Enter).
  6. Make the script executable:
    # (Ubuntu - run as the user who will start vncserver)
    chmod +x ~/.vnc/xstartup
    (Troubleshooting Note: If VNC server exits early, ensure this script uses dbus-launch... and has execute permissions for the correct user)

B9. Setup Tailscale & Find IP

  1. Ensure Tailscale is installed, logged in, and active on both your Windows PC and your Quest 2 (Android app).
  2. Find the Tailscale IP address of your Quest 2 (e.g., 100.x.y.z). Use the Tailscale app on Quest, tailscale status on Windows, or the Admin Console.

B10. Start VNC Server for Tailscale Access

  1. Log into your Ubuntu environment on the Quest 2 (as the user who configured ~/.vnc/xstartup, e.g., root or ikko).
  2. Kill any old VNC server instance for display :1:
    # (Ubuntu)
    vncserver -kill :1
  3. Start the VNC server using display :1 (port 5901) and crucial flags:
    # (Ubuntu)
    vncserver :1 -localhost no -geometry 1280x720 -depth 24
    • -localhost no: Essential for Tailscale access.

B11. Connect from Windows VNC Client via Tailscale

  1. Open your VNC client software on Windows 11.
  2. Enter the Quest 2's Tailscale IP and port (5901 for display :1): 100.x.y.z:5901 (Use actual IP).
  3. Connect and enter the VNC password set in Step B8. (Troubleshooting Note: If connection is refused, double-check the server is running inside Ubuntu and the -localhost no flag was used)

B12. Stopping the VNC Server

  1. Stop the VNC server from within the Ubuntu environment:
    # (Ubuntu)
    vncserver -kill :1
  2. You can then exit Ubuntu and Termux/SSH.

B13. Recommended Windows VNC Clients (Open Source)


Section C: Termux-X11 Method (Local Display on Quest 2)

This method uses the Termux-X11 app (acting as an X server on Android) to display the XFCE desktop directly on the Quest 2 screen without needing a separate VNC client app. Often provides better performance than VNC.

C1: Install Termux-X11 Components

  1. In Termux (Host Environment): Install the X11 repo and companion package.
    # (Termux)
    pkg install x11-repo -y
    pkg install termux-x11-nightly -y
  2. On Quest 2 (Android): Download and install the Termux:X11 Android app APK from the official GitHub releases page: https://github.com/termux/termux-x11/releases. (Requires sideloading via SideQuest or similar).

C2: Ensure Ubuntu Prerequisites

The necessary dbus-x11 package should already be installed as part of the XFCE setup.

C3: Launch the XFCE Session

  1. Start the Termux:X11 Android app on your Quest 2. It will likely show a black screen initially and may display a notification indicating the display number (usually :0).
  2. Open Termux and log into your Ubuntu proot environment: Use the flags recommended for Termux-X11 compatibility.
    # (Termux)
    proot-distro login ubuntu --user root --shared-tmp --no-sysvipc
    (Adjust --user root if you prefer to log in as a different user like ikko, ensuring that user exists)
  3. Inside the Ubuntu session, set the DISPLAY variable and launch XFCE:
    # (Ubuntu - run as the logged-in user)
    export DISPLAY=:0 # Use the display number from Termux:X11 notification if different
    dbus-launch --exit-with-session xfce4-session
  4. Switch focus back to the Termux:X11 app window on your Quest 2. The XFCE desktop should load.

C4: Stop the Session

You can usually stop the session by:

  • Logging out from the XFCE menu inside the Termux-X11 window.
  • Closing the Termux:X11 app.
  • Killing the xfce4-session process from the Termux/Ubuntu terminal.

Section D: SSH X11 Forwarding Method (Display on Separate PC)

This method runs graphical applications inside Ubuntu but displays their windows on an X server running on a separate computer (Windows/macOS/Linux) connected via SSH. Good for running individual applications remotely, less ideal for a full desktop session due to potential slowness.

D1: Install SSH Server & Xauth (Inside Ubuntu)

If not already installed:

# (Ubuntu)
sudo apt update
sudo apt install -y openssh-server xauth

D2: Configure SSH Server (Inside Ubuntu)

  1. Edit the SSH daemon configuration:
    # (Ubuntu)
    sudo nano /etc/ssh/sshd_config
    
  2. Ensure the following line exists and is set to yes (uncomment if needed):
    X11Forwarding yes
    
  3. Save and exit ( Ctrl+X, Y, Enter).
  4. Restart the SSH service:
    # (Ubuntu)
    sudo systemctl restart sshd
    # Or if systemctl is problematic in proot:
    # sudo service ssh restart
    

D3: Prepare Client PC

Ensure you have an X server application installed and running on the PC you will connect from:

Linux: Usually built-in.

macOS: Install XQuartz.

Windows: Install and run VcXsrv or Xming.

D4: Connect via SSH with X11 Forwarding Open a terminal on your PC and connect to your Quest 2 (using its local network IP or Tailscale IP) using the -X flag:

# (On PC Terminal)
ssh -X your_user@<Quest_IP_Address>

(Replace your_user with your username inside Ubuntu, e.g., ikko or root, and <Quest_IP_Address>).

D5: Launch Graphical Applications

Once connected via SSH, simply run graphical commands from the terminal. Their windows should appear on your PC's desktop via the X server.

# (SSH Session connected to Ubuntu)
xfce4-terminal &
firefox-esr &
mousepad &

(Running startxfce4 for the full desktop via SSH -X is possible but often slow and may have rendering issues).

Coexistence

The packages required for all three methods (TigerVNC Server, Termux-X11 components in Termux, OpenSSH Server/Xauth in Ubuntu) can be installed simultaneously without conflicting.

You can choose which method to use at any time:

  • Start vncserver to enable VNC connections.
  • Start the Termux-X11 app and launch the session via dbus-launch for local display.
  • Connect via ssh -X to use X11 forwarding to your PC.

While technically possible to run VNC (on :1) and Termux-X11 (on :0) concurrently, it's usually less confusing to use one primary graphical access method at a time.


This document provides the complete walkthrough focusing on Firefox ESR and incorporating the requested host setup steps. Remember the cautions about unofficial software sources and potential performance limits. Good luck!

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