VNC
VNC (Virtual Network Computing) is a remote display protocol that lets you view and interact with a graphical desktop over a network connection. In the ADL context, VNC runs a desktop session inside your proot Linux distribution and streams it to a VNC viewer app on Android.
For local use on the same device, Termux:X11 provides significantly better performance than VNC โ lower latency, no compression artifacts, and native Android input handling. Use VNC when Termux:X11 is not available, when you need remote access from another device, or when running on older hardware that has compatibility issues with Termux:X11.
When to use VNCโ
VNC is the right choice when you need to access your desktop from another device, cannot run the Termux:X11 app, have an older Android version with Termux:X11 compatibility issues, or want a headless server with occasional graphical access.
How VNC works in ADLโ
The VNC server runs inside your proot distribution, renders the desktop to a virtual framebuffer, and streams the pixels to a VNC viewer app. The viewer sends your inputs back to the server. Everything happens over localhost, so no network traffic leaves your device when running locally.
Installing TigerVNCโ
ADL uses TigerVNC, the most widely used VNC server on Linux. Install it inside your Ubuntu distribution:
proot-distro login ubuntu -- apt update && proot-distro login ubuntu -- apt install -y tigervnc-standalone-serverOr, if you are already logged into the distribution:
apt update && apt install -y tigervnc-standalone-serverAPT downloads and installs TigerVNC and its dependencies. When finished, the vncserver command becomes available.
Initial configurationโ
Setting a VNC passwordโ
The first time you start the VNC server, set a password:
vncpasswdYou are prompted to enter and confirm a password (minimum 6 characters). You are also asked whether to set a view-only password โ enter n unless you specifically want one.
VNC password storage uses legacy DES encryption. For local-only use (localhost connections on the same device) this is acceptable, but never expose a VNC server to the open internet without additional security layers like SSH tunneling.
Configuring the xstartup fileโ
The ~/.vnc/xstartup file tells the VNC server which desktop environment to launch. Create or edit it:
#!/bin/bash
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
export PULSE_SERVER=tcp:127.0.0.1:4713
exec startxfce4
Make it executable:
chmod +x ~/.vnc/xstartupReplace startxfce4 with the launch command for your desktop environment if you are not using XFCE. For example, use mate-session for MATE or startlxde for LXDE.
Starting and stopping the VNC serverโ
Starting the serverโ
vncserver :1 -geometry 1920x1080 -depth 24Output similar to: New Xtigervnc server 'localhost:1' started. The :1 means the server is listening on display 1, which corresponds to port 5901.
Common vncserver flagsโ
| Flag | Purpose | Example |
|---|---|---|
:N | Display number (port = 5900 + N) | :1 (port 5901) |
-geometry WxH | Screen resolution | -geometry 1920x1080 |
-depth D | Color depth in bits | -depth 24 (true color) |
-localhost yes | Only accept local connections | -localhost yes |
-SecurityTypes | Authentication type | -SecurityTypes VncAuth |
Match the -geometry value to your actual screen or window size. Oversized resolutions waste processing power on scaling; undersized ones leave you with a small, cramped desktop. For a phone screen, 1280x720 or 1600x900 work well. For Samsung DeX on an external monitor, use the monitor's native resolution.
Stopping the serverโ
vncserver -kill :1To stop all running VNC servers:
vncserver -kill :*Listing active sessionsโ
vncserver -listA table showing each running VNC session with its display number, PID, and the port it is listening on.
VNC viewer apps for Androidโ
You need a VNC viewer app on Android to connect to the server. Here are the main options:
| App | Cost | Notes |
|---|---|---|
| AVNC | Free, open source | Recommended. Available on F-Droid. Best touch controls, good performance. |
| bVNC | Free, open source | Solid alternative. Also on F-Droid. |
| RealVNC Viewer | Free (basic) | Available on Play Store. Proprietary but polished. |
Install AVNC from F-Droid. It is open source, actively maintained, has excellent touch gesture support, and integrates well with the ADL workflow.
Connecting the viewerโ
- Start your VNC server inside the distribution (see above).
- Open your VNC viewer app on Android.
- Create a new connection with these settings:
- Address:
127.0.0.1orlocalhost - Port:
5901(or 5900 + your display number)
- Address:
- Enter the VNC password you set earlier.
- You should see your Linux desktop.
If the viewer asks about encoding, choose Tight encoding for the best balance of quality and performance over a local connection.
Setting resolution and color depthโ
You can change the resolution without restarting the server by editing the VNC configuration, but the simplest approach is to stop and restart with new parameters:
vncserver -kill :1 && vncserver :1 -geometry 1280x720 -depth 24Higher resolutions require more processing power and memory. If you experience lag, reduce the resolution (try 1280x720) or lower the color depth from 24 to 16 bits. For Samsung DeX on an external monitor, match the monitor's native resolution.
Autostarting the VNC serverโ
To start VNC automatically when you log into the distribution, add a check to ~/.bashrc inside Ubuntu that starts the server only if it is not already running:
echo 'vncserver -list 2>/dev/null | grep -q ":1" || vncserver :1 -geometry 1920x1080 -depth 24' >> ~/.bashrcAutostarting VNC means every login launches a graphical session, which uses memory and CPU. If you sometimes log in just to run terminal commands, consider starting VNC manually instead.
Performance: VNC vs Termux:X11โ
| Aspect | VNC | Termux:X11 |
|---|---|---|
| Latency | Noticeable (compression/decompression) | Near-native |
| Image quality | Compression artifacts possible | Pixel-perfect |
| CPU usage | Higher (encoding frames) | Lower |
| Input handling | Translated through viewer | Native Android input |
| Remote access | Yes (any VNC client) | No (local only) |
| Setup complexity | Moderate | Simple |
For day-to-day desktop use on the same device, Termux:X11 is the clear winner. VNC adds value when you need remote access or as a reliable fallback.
See Termux:X11 for setup instructions on the recommended display method, and What is Wayland? for background on display protocols.