3 minutes
Install Debian with Xfce on termux using proot-distro
1 Background
Termux’s x11-repo support running xorg server and xfce on android directly, but it is not a normal GNU/Linux environment and lacks some usual graphical applications, which limit its usage under many circumstances. Luckily, people can workaround this by running a fake GNU/Linux system with proot technology provided by termux, and a xfce environment live in proot is supported as well.
2 What proot can do
I can use libreoffice, openconnect (a VPN client likes Cisco’s anyconnect), firefox in proot environment and it works well.
3 General steps
-
Install
proot proot-distroin termux -
Install latest debian stable version by
proot-distro install debian -
Login into debian proot environment by
proot-distro login debianand:- install xfce and related packages:
apt-get install dialog xfce4 xfce4-goodies - install tigervnc server:
apt-get install tigervnc-standalone-server dbus-x11, note generally you still need to install dbus-x11, otherwise strange problem might happen during vnc server running - (Optional) install some common packages:
apt-get install dialog apt-utils less netcat-openbsd openssh-client
- install xfce and related packages:
-
Setup tigervnc server in proot environment, edit file ~/.vnc/Xtigervnc-session, and write below lines in it:
xfce4-session # or # dbus-launch --exit-with-session xfce4-sessionrun
tigervncpasswdto set vnc passwordedit ~/.vnc/tigervnc.conf and write below lines in it:
$rfbport = "5900"; $geometry = "1280x720"; $depth = "32"; $localhost = "no"; $SecurityTypes = "TLSVnc"; $UseBlacklist = "yes"; $BlacklistThreshold = "2"; $BlacklistTimeout = "86400"; $IdleTimeout = "0"; $QueryConnect = "no"; $AcceptSetDesktopSize = "yes"; $PasswordFile = "/root/.vnc/passwd"; $AlwaysShared = "yes"; -
Exit from debian proot session, and execute
proot-distro login debian -- tigervncserver :1 -fgto run vnc server in foreground
4 Daemonize
It is possible to make vnc server running in proot environment as a daemon by termux-service, consider steps below:
-
Create a new sv directory according to its wiki, for example: you can use
debian-vncas service name -
Create a file named
runat it, content (we assume running vnc server at display :2):exec proot-distro login debian -- bash -c 'rm /tmp/.X11-unix/X2 ; rm /tmp/.X11-lock/X2 ; rm /tmp/.X2-lock ; tigervncserver :2 -fg' 2>&1 -
Then you can launch service by
sv up debian-vnc
5 Using termux-x11
Termux-x11 is worth when your mobile device screen is large enough (for example you have a tablet), otherwise I think it is useless.
6 Troubleshooting
- Disable
settings_enable_monitor_phantom_procson android when you get[Process completed (signal 9) - press Enter]error - Remove power management plugin from xfce panel if xfce consume too many memory and cause OOM of android
- Go back to termux and install packages from
proot-distro loginif you face apt errorunable to open '/usr/share/applications/htop.desktop.dpkg-new': Permission denied
7 Limitation
It is seems that impossible to launch vnc server in debian correctly by termux-service, becausevnc server process can run at foreground and be managed bysvcommand can not manage processes which running at backgroundtermux-service