<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Proot-Distro on Ivon's Blog</title><link>https://ivonblog.com/en-us/tags/proot-distro/</link><description>Recent content in Proot-Distro on Ivon's Blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</managingEditor><webMaster>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</webMaster><copyright>You are welcome to share articles of Ivon's Blog (ivonblog.com). Please include the original URL when citing articles, and abide by CC BY-NC-ND 4.0 license. For commercial use, please write an e-mail to me.</copyright><lastBuildDate>Fri, 11 Apr 2025 01:00:00 +0800</lastBuildDate><atom:link href="https://ivonblog.com/en-us/tags/proot-distro/index.xml" rel="self" type="application/rss+xml"/><item><title>Launch X11 graphical programs from proot-distro on Termux's XFCE desktop</title><link>https://ivonblog.com/en-us/posts/termux-desktop-with-proot-distro/</link><pubDate>Fri, 11 Apr 2025 01:00:00 +0800</pubDate><author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author><guid>https://ivonblog.com/en-us/posts/termux-desktop-with-proot-distro/</guid><description>&lt;!-- Co-translated by ChatGPT --&gt;
&lt;p&gt;Allow apps in proot-distro to draw windows on XFCE desktop in Termux. Integrate X11 GUI apps in proot-distro with Termux host desktop environment.&lt;/p&gt;
&lt;p&gt;By default, use Termux&amp;rsquo;s native packages to run the XFCE desktop environment, and through X11 network transparency, allow X11 program windows inside proot-distro to be displayed on the XFCE desktop.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/termux-desktop-with-proot-distro/images/tt.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 width="1080"
 height="607"&gt;&lt;figcaption&gt;This image shows Termux and the proot-distro environment running at the same time. The XFCE desktop runs directly in Termux, while LibreOffice starts from inside proot-distro&lt;/figcaption&gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Here, the side responsible for running native XFCE programs can be called the Termux host for now, while proot-distro is naturally the container. The process is shown below:
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/termux-desktop-with-proot-distro/images/mermaid-1744306451038.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 width="1024"
 height="942"&gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;This usage is a bit like the Linux desktop container tool &lt;a href="https://ivonblog.com/posts/distrobox-usage/" target="_blank" rel="noreferrer"&gt;Distrobox&lt;/a&gt;. It allows X11 graphical programs inside Docker to be displayed on the host desktop.&lt;/p&gt;
&lt;p&gt;You might think: why not just start XFCE directly from proot-distro? Why use Termux&amp;rsquo;s XFCE packages?&lt;/p&gt;
&lt;p&gt;Because it is faster. Processes inside proot are emulated with ptrace, so they are inherently slower than programs compiled natively for Termux. Termux now has more and more packages, even the Chromium browser (included in TUR Repo), so in the future there is less need to let the guest usurp the host by running the desktop environment in proot-distro. If most commonly used programs can run as Termux native versions, there is no need to use proot-distro; only start proot-distro when necessary to run programs that are only included in Debian repositories.&lt;/p&gt;

&lt;h2 class="relative group"&gt;1. Install a desktop environment for Termux
 &lt;div id="1-install-a-desktop-environment-for-termux" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-install-a-desktop-environment-for-termux" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;See &lt;a href="https://ivonblog.com/en-us/posts/termux-desktop-environment/" target="_blank" rel="noreferrer"&gt;Termux Install XFCE4&lt;/a&gt;. For graphical display, either Termux X11 or VNC is fine.&lt;/p&gt;
&lt;p&gt;Here we also need to add one extra package, used to control X client permissions for connecting to the X server:&lt;/p&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pkg install xorg-xhost&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Test whether the Termux desktop environment can start.&lt;/p&gt;
&lt;p&gt;In addition, we can open XFCE&amp;rsquo;s file manager, open the &lt;code&gt;storage/shared&lt;/code&gt; directory, and read files from Android internal storage.&lt;/p&gt;

&lt;h2 class="relative group"&gt;2. Configure proot-distro
 &lt;div id="2-configure-proot-distro" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-configure-proot-distro" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;I installed &lt;a href="https://ivonblog.com/en-us/posts/termux-proot-distro-debian/" target="_blank" rel="noreferrer"&gt;proot Debian&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It is recommended to add a normal user and configure Chinese localization inside proot-distro.&lt;/p&gt;
&lt;p&gt;Termux lacks the &lt;code&gt;locales&lt;/code&gt; package and cannot configure Chinese.&lt;/p&gt;
&lt;p&gt;Also install graphical programs inside proot-distro, such as LibreOffice:&lt;/p&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt install libreoffice&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 class="relative group"&gt;3. Launch programs inside proot-distro from the Termux desktop
 &lt;div id="3-launch-programs-inside-proot-distro-from-the-termux-desktop" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-launch-programs-inside-proot-distro-from-the-termux-desktop" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;First run &lt;code&gt;xhost&lt;/code&gt; to allow programs inside proot-distro to draw windows on the X server of the Termux desktop. Because proot processes are started by the Termux user, use the &lt;code&gt;whoami&lt;/code&gt; command to pass in the current username and allow this user to connect.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;xhost +SI:localuser:&lt;span class="k"&gt;$(&lt;/span&gt;whoami&lt;span class="k"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;Log in to proot-distro. You must use &lt;code&gt;--shared-tmp&lt;/code&gt; to share X server resources, and add &lt;code&gt;--termux-home&lt;/code&gt; to mount Termux&amp;rsquo;s home directory as well (if you do not want files to be messed up by programs inside proot, you can skip mounting it)&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;proot-distro login debian --user user --shared-tmp --termux-home&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;Specify the &lt;code&gt;DISPLAY&lt;/code&gt; environment variable. The value should be the address of the Termux X server, generally &lt;code&gt;:0&lt;/code&gt;. Then run a program, such as LibreOffice:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;DISPLAY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;:0
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;libreoffice&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;
&lt;p&gt;You will then see the LibreOffice window start.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/termux-desktop-with-proot-distro/images/Screenshot_20250411_005538.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 width="1357"
 height="767"&gt;&lt;/figure&gt;&lt;/p&gt;</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://ivonblog.com/en-us/posts/termux-desktop-with-proot-distro/featured.webp"/></item><item><title>How to connect remotely to Termux's Linux desktop with VNC</title><link>https://ivonblog.com/en-us/posts/vncserver-termux/</link><pubDate>Thu, 10 Apr 2025 01:00:00 +0800</pubDate><author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author><guid>https://ivonblog.com/en-us/posts/vncserver-termux/</guid><description>&lt;!-- Co-translated by ChatGPT --&gt;
&lt;p&gt;This article explains how to set up a VNC server so that we can access the Linux system desktop in Termux. It applies to Linux systems installed through proot or chroot.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/vncserver-termux/images/IMG_0357.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 width="1040"
 height="585"&gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Termux can run Linux on an Android phone. After setting up the environment, the next concern is how to connect to the desktop (graphical environment). To connect to Termux&amp;rsquo;s Linux system desktop, there are three methods: &lt;a href="https://ivonblog.com/en-us/posts/termux-x11/" target="_blank" rel="noreferrer"&gt;Termux X11&lt;/a&gt;, &lt;a href="https://ivonblog.com/en-us/posts/android-xserver-xsdl/" target="_blank" rel="noreferrer"&gt;XSDL&lt;/a&gt;, and VNC.&lt;/p&gt;
&lt;p&gt;The first two run an X server on the phone. The latter is the remote desktop concept: run a VNC server on the phone, start a virtual Xvnc server, then connect with a VNC client. This VNC client can be local or a client on another computer.&lt;/p&gt;
&lt;p&gt;In terms of graphics performance, an X server is better than VNC, and it is easier to achieve 3D hardware acceleration.&lt;/p&gt;
&lt;p&gt;When I first learned Termux, I saw many people using VNC, but as Termux X11 gradually matured, I gradually abandoned VNC.&lt;/p&gt;
&lt;p&gt;If all three run on the same phone, since they are all localhost, there is no latency issue, and VNC really has no performance advantage over an X server.&lt;/p&gt;
&lt;p&gt;VNC&amp;rsquo;s strength is remote access from other computers! Compared with SSH X server forwarding, VNC can lower image quality to reduce bandwidth, and can even start headlessly. Its performance advantages appear when viewing remotely.&lt;/p&gt;
&lt;p&gt;So VNC is suitable for the scenario of &amp;ldquo;using a computer to connect to the phone&amp;rsquo;s Termux desktop&amp;rdquo;. You do not like staring at a tiny screen and typing commands like crazy, right? Then, besides text-only SSH access, graphical VNC is a good choice.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/vncserver-termux/images/IMG_0360.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 width="1080"
 height="693"&gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;VNC and Termux X11 can coexist and should not affect each other.&lt;/p&gt;

&lt;h2 class="relative group"&gt;1. Choose a VNC client
 &lt;div id="1-choose-a-vnc-client" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-choose-a-vnc-client" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;On phones, I recommend &lt;a href="https://github.com/gujjwal00/avnc" target="_blank" rel="noreferrer"&gt;AVNC&lt;/a&gt; or &lt;a href="https://www.realvnc.com/en/connect/download/viewer/" target="_blank" rel="noreferrer"&gt;RealVNC Viewer&lt;/a&gt;. The latter has more features, but it is proprietary software.&lt;/p&gt;
&lt;p&gt;On computers, I recommend &lt;a href="https://remmina.org/" target="_blank" rel="noreferrer"&gt;Remmina&lt;/a&gt;&lt;/p&gt;

&lt;h2 class="relative group"&gt;2. Configure the VNC server
 &lt;div id="2-configure-the-vnc-server" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-configure-the-vnc-server" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;Choose one of the two.&lt;/p&gt;

&lt;h3 class="relative group"&gt;Run the VNC server directly in Termux
 &lt;div id="run-the-vnc-server-directly-in-termux" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#run-the-vnc-server-directly-in-termux" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h3&gt;
&lt;p&gt;In fact, proot-distro is not required. Termux itself provides a native VNC server package. But if you want to open the desktop of a Linux distribution inside proot-distro, do not use this method.&lt;/p&gt;
&lt;p&gt;Also, the desktop environment packages included in Termux are not as rich as those in proot-distro. The most complete one at present is XFCE.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://ivonblog.com/en-us/posts/termux-desktop-environment/" target="_blank" rel="noreferrer"&gt;Install the XFCE desktop&lt;/a&gt; for Termux, but do not install Termux X11.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install the TigerVNC package. The current version is 1.13.0.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pkg install tigervnc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;Set the VNC server password&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vncpasswd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;Add the program to execute after the VNC server starts by editing &lt;code&gt;~/.vnc/xstartup&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mkdir ~/.vnc/
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vim ~/.vnc/xstartup&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="5"&gt;
&lt;li&gt;Fill in the following content&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cp"&gt;#!/bin/bash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;unset&lt;/span&gt; SESSION_MANAGER
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;unset&lt;/span&gt; DBUS_SESSION_BUS_ADRESS
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Start the PulseAudio sound server; audio will come out from Termux&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pulseaudio --start --exit-idle-time&lt;span class="o"&gt;=&lt;/span&gt;-1
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pacmd load-module module-native-protocol-tcp auth-ip-acl&lt;span class="o"&gt;=&lt;/span&gt;127.0.0.1 auth-anonymous&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Run the desktop environment, XFCE here&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;exec&lt;/span&gt; startxfce4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="6"&gt;
&lt;li&gt;Grant execute permission to xstartup&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;chmod +x ~/.vnc/xstartup&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="7"&gt;
&lt;li&gt;Define the VNC server configuration file. Edit &lt;code&gt;~/.vnc/tigervnc.conf&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vim ~/.vnc/tigervnc.conf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="8"&gt;
&lt;li&gt;Fill in the following content:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Current session XFCE&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$session&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;xfce-session&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Resolution; higher values use more bandwidth&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$geometry&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;1920x1080&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Bit depth, values are 8/16/24/32; larger numbers look better but use more bandwidth&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$depth&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;32&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Allow external networks to connect&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$localhost&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;no&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 class="relative group"&gt;Run the VNC server inside proot-distro
 &lt;div id="run-the-vnc-server-inside-proot-distro" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#run-the-vnc-server-inside-proot-distro" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h3&gt;
&lt;p&gt;First install Termux proot-distro, such as &lt;a href="https://ivonblog.com/en-us/posts/termux-proot-distro-debian/" target="_blank" rel="noreferrer"&gt;Debian&lt;/a&gt;. Then install a desktop environment inside proot-distro. XFCE uses the fewest resources, but KDE Plasma is also worth trying.&lt;/p&gt;</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://ivonblog.com/en-us/posts/vncserver-termux/featured.webp"/></item><item><title>Solutions when Termux proot cannot use the systemctl command</title><link>https://ivonblog.com/en-us/posts/termux-systemd-issues/</link><pubDate>Sat, 31 Aug 2024 23:00:00 +0800</pubDate><author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author><guid>https://ivonblog.com/en-us/posts/termux-systemd-issues/</guid><description>&lt;!-- Co-translated by ChatGPT --&gt;
&lt;p&gt;Systemd is an init program. Almost all Linux distributions use Systemd to manage system services, and common commands include &lt;code&gt;systemctl&lt;/code&gt;, &lt;code&gt;journalctl&lt;/code&gt;, and so on.&lt;/p&gt;
&lt;p&gt;However, Termux cannot use Systemd. If you run commands related to &lt;code&gt;systemctl start&lt;/code&gt; inside a Termux proot-distro or chroot container environment, you will see this error: &lt;code&gt;System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This is because the container environment does not support Systemd.&lt;/p&gt;
&lt;p&gt;There is actually no real solution, unless the Termux development team learns from Microsoft WSL and finds a way to make Systemd run. However, we do have some alternatives to address this problem.&lt;/p&gt;

&lt;h2 class="relative group"&gt;Method 1: Start the program directly from the executable path
 &lt;div id="method-1-start-the-program-directly-from-the-executable-path" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#method-1-start-the-program-directly-from-the-executable-path" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;First, understand that Systemd is just an init program for managing system services. It is responsible for starting programs after Linux boots and letting users turn programs on and off. But simply starting a program does not actually require &lt;code&gt;systemctl&lt;/code&gt;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;For example, to start the SSH service in proot Debian, the Systemd way is to run the following command:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl start sshd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;If we find Systemd&amp;rsquo;s service file &lt;code&gt;/etc/systemd/system/sshd.service&lt;/code&gt; (most Systemd service files are here), we will see that what follows &lt;code&gt;ExecStart=&lt;/code&gt; is the command it really executes:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;Service&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;EnvironmentFile&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;-/etc/default/ssh
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;ExecStartPre&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/sbin/sshd -t
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;ExecStart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/sbin/sshd -D&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;Therefore, the SSH service can be started directly with this command and run in the background:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mkdir -p /run/sshd
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/usr/sbin/sshd -D&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Note: programs inside Termux proot-distro cannot use ports below 1000. When logging in to proot-distro, add the &lt;code&gt;--fix-low-ports&lt;/code&gt; parameter to redirect SSH port 22 to 2022.&lt;/p&gt;
&lt;p&gt;If you want to automatically start a specific program after logging in to proot-distro, the simplest way is to add the command you want to run to &lt;code&gt;~/.bashrc&lt;/code&gt; in the user&amp;rsquo;s home directory.&lt;/p&gt;

&lt;h2 class="relative group"&gt;Method 2: Switch to a distribution that uses OpenRC
 &lt;div id="method-2-switch-to-a-distribution-that-uses-openrc" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#method-2-switch-to-a-distribution-that-uses-openrc" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;OpenRC and runit are more traditional init programs. They are not as complex as Systemd, and they can run and manage services in proot. Users unfamiliar with OpenRC commands can refer to the Systemd and OpenRC command comparison table below.&lt;/p&gt;
&lt;p&gt;At present, the proot-distro distribution that uses OpenRC is Alpine Linux, while Artix Linux and Void Linux use runit.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Install Alpine Linux&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;proot-distro install alpine
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;proot-distro login alpine&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;Install the OpenRC package&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;apk add openrc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;After that, append this command when logging in to proot, and the OpenRC program will start&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;proot-distro login alpine --fix-low-ports -- /bin/ash -c &lt;span class="s2"&gt;&amp;#34;/sbin/openrc default; /bin/ash -l&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;After that, you can use OpenRC to manage services. For example, SSH can be managed with the &lt;code&gt;rc-service&lt;/code&gt; command, without typing the executable path&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo rc-service sshd start&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="5"&gt;
&lt;li&gt;You can also configure the SSH service to start automatically after logging in to proot-distro.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo rc-update add sshd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 class="relative group"&gt;Method 3: Run a full Linux system virtual machine
 &lt;div id="method-3-run-a-full-linux-system-virtual-machine" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#method-3-run-a-full-linux-system-virtual-machine" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;The ultimate solution is to emulate a full Linux system so that Systemd can run.&lt;/p&gt;</description></item><item><title>Use Termux qemu-user to emulate x86_64 Ubuntu on ARM64 Android</title><link>https://ivonblog.com/en-us/posts/termux-proot-distro-qemu-emulation/</link><pubDate>Thu, 16 Nov 2023 18:00:00 +0800</pubDate><author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author><guid>https://ivonblog.com/en-us/posts/termux-proot-distro-qemu-emulation/</guid><description>&lt;!-- Co-translated by ChatGPT --&gt;
&lt;p&gt;This explains how to emulate an x86_64 Ubuntu system on an ARM64 (Aarch64) Android phone through Termux proot-distro.&lt;/p&gt;

&lt;h2 class="relative group"&gt;1. Explanation
 &lt;div id="1-explanation" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-explanation" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;You may say: most Android devices are ARM64, right? Why not just install the ARM version of Ubuntu? Some programs are just obnoxious and are not compiled for ARM.&lt;/p&gt;
&lt;p&gt;So on the road of force-running x86 programs, we have three choices:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run an ARM64 system and install the &lt;a href="https://ivonblog.com/en-us/posts/termux-proot-box86-box64/" target="_blank" rel="noreferrer"&gt;Box64 translator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Use qemu-system to start a complete x86_64 emulator, such as &lt;a href="https://ivonblog.com/en-us/posts/termux-qemu-system-linux" target="_blank" rel="noreferrer"&gt;Ubuntu x86_64 + QEMU&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Use qemu-user to emulate an x86_64 system.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;qemu-system runs a virtual machine, emulating complete hardware devices so Linux can run as if it were on a real computer. Of course, it consumes a lot of resources.&lt;/p&gt;
&lt;p&gt;qemu-user, on the other hand, is a userspace emulator that can emulate x86 executables on ARM64 devices without needing the resources of an entire virtual machine.&lt;/p&gt;
&lt;p&gt;QEMU supports emulating many architectures. Besides x86_64, emulating 32-bit x86, RISC-V, and other architectures is also possible.&lt;/p&gt;
&lt;p&gt;In Termux, as long as we have a rootfs, we can get a Linux system running without using qemu-system virtual machine emulation.&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://ivonblog.com/en-us/posts/termux-proot-distro" &gt;proot-distro&lt;/a&gt; tool has built-in qemu support. This article discusses using the proot-distro tool together with qemu-user to run an x86_64 system.&lt;/p&gt;
&lt;p&gt;Because it is emulated, program execution is naturally slower than native. Add proot&amp;rsquo;s performance overhead and it becomes even slower. At the end of the article, we will compare the speed of Proot native vs Box64 vs qemu-user.&lt;/p&gt;

&lt;h2 class="relative group"&gt;2. Test environment
 &lt;div id="2-test-environment" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-test-environment" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Phone: Sony Xperia 10 V, Android 13&lt;/li&gt;
&lt;li&gt;Linux kernel version: 5.4&lt;/li&gt;
&lt;li&gt;Termux version: 0.118.0&lt;/li&gt;
&lt;li&gt;qemu-user version: 8.1.0&lt;/li&gt;
&lt;li&gt;Ubuntu version: 20.04 (Ubuntu 22.04 runs into a problem where apt pub_key cannot be imported)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 class="relative group"&gt;3. Create an x86_64 proot Ubuntu
 &lt;div id="3-create-an-x86_64-proot-ubuntu" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-create-an-x86_64-proot-ubuntu" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Refer to &lt;a href="https://ivonblog.com/en-us/posts/termux-proot-distro-add-custom-distro" &gt;proot-distro rootfs&lt;/a&gt; and add the &lt;code&gt;Ubuntu 20.04_x86_64.sh&lt;/code&gt; script. But here we need to change the content a little.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vim &lt;span class="nv"&gt;$PREFIX&lt;/span&gt;/etc/proot-distro/ubuntu20.04_x86_64.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;Modify it as follows&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Specify the architecture as x86_64&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;DISTRO_ARCH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;x86_64
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;DISTRO_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Ubuntu20.04 x86_64&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;DISTRO_COMMENT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Ubuntu 20.04 Focal x86_64&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;TARBALL_STRIP_OPT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Download the x86_64 Ubuntu base&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;TARBALL_URL&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;x86_64&amp;#39;&lt;/span&gt;&lt;span class="o"&gt;]=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;https://cdimage.ubuntu.com/ubuntu-base/focal/daily/current/focal-base-amd64.tar.gz&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;TARBALL_SHA256&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;x86_64&amp;#39;&lt;/span&gt;&lt;span class="o"&gt;]=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;16c831cc71b8ab79e5156451558df4a025783ba335047f6343518e7225416929&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;Install &lt;code&gt;qemu-user-x86-64&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pkg install qemu-user-x86-64&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;Install Ubuntu&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;proot-distro install ubuntu20.04_x86_64&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="5"&gt;
&lt;li&gt;Log in to Ubuntu. proot-distro will automatically execute it with QEMU.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;proot-distro login ubuntu20.04_x86_64&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="6"&gt;
&lt;li&gt;
&lt;p&gt;Through the &lt;code&gt;uname -a&lt;/code&gt; command, you can see that the architecture is x86_64, and no &lt;code&gt;Exec format error&lt;/code&gt; appears.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/termux-proot-distro-qemu-emulation/images/Screenshot_20231116-223629.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 width="1080"
 height="391"&gt;&lt;/figure&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If a &lt;code&gt;signal 11 Segmentfault&lt;/code&gt; error appears while installing packages, just run &lt;code&gt;dpkg --configure -a&lt;/code&gt; once.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 class="relative group"&gt;4. Compare native and emulated execution speed
 &lt;div id="4-compare-native-and-emulated-execution-speed" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#4-compare-native-and-emulated-execution-speed" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;Note: qemu-user in the table below refers to the method in this article&lt;/p&gt;
&lt;p&gt;native represents the arm64 executables installed in proot Ubuntu&lt;/p&gt;
&lt;p&gt;Box64 means using the &lt;code&gt;box64&lt;/code&gt; command in proot Ubuntu to translate and run x86_64 executables&lt;/p&gt;
&lt;p&gt;Use 7z to extract a 133MB zip file, and use &lt;code&gt;time&lt;/code&gt; to measure how long it takes to complete.&lt;/p&gt;</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://ivonblog.com/en-us/posts/termux-proot-distro-qemu-emulation/featured.webp"/></item><item><title>Use a custom rootfs in Termux proot-distro to create a Linux container</title><link>https://ivonblog.com/en-us/posts/termux-proot-distro-add-custom-distro/</link><pubDate>Thu, 16 Nov 2023 16:00:00 +0800</pubDate><author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author><guid>https://ivonblog.com/en-us/posts/termux-proot-distro-add-custom-distro/</guid><description>&lt;!-- Co-translated by ChatGPT --&gt;
&lt;p&gt;This article demonstrates how to add your preferred Linux distribution to the proot-distro tool in Android Termux.&lt;/p&gt;
&lt;p&gt;Using Ubuntu as an example, we will install the older &lt;code&gt;Ubunut 22.04 LTS&lt;/code&gt; proot Ubuntu.&lt;/p&gt;

&lt;h2 class="relative group"&gt;1. proot vs proot-distro
 &lt;div id="1-proot-vs-proot-distro" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-proot-vs-proot-distro" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;proot is a userspace implementation of chroot, allowing chroot-like functionality without root privileges.&lt;/p&gt;
&lt;p&gt;Some developers distribute Termux proot distributions by brute-forcing it with the &lt;code&gt;proot&lt;/code&gt; command. For example, &lt;a href="https://github.com/Ilya114/Box64Droid/tree/main" target="_blank" rel="noreferrer"&gt;Box64Droid&lt;/a&gt; downloads a custom rootfs, then uses a long chain of commands to log in to the proot distribution.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/termux-proot-distro-add-custom-distro/images/Screenshot_20231116_165037.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 width="915"
 height="292"&gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;But since we have the useful proot-distro script, why not make good use of it? It is a wrapper script for proot, integrating the processes of downloading, logging in to, and logging out of proot distributions, while also making it convenient to execute commands.&lt;/p&gt;
&lt;p&gt;I explained its usage in &lt;a href="https://ivonblog.com/en-us/posts/termux-proot-distro" &gt;proot-distro usage&lt;/a&gt;, but what if the distributions provided by the proot-distro maintainers do not meet your needs? For example:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;You need a rootfs for a specific Linux version, such as an LTS version of Ubuntu, but proot-distro&amp;rsquo;s Ubuntu is always the latest version.&lt;/li&gt;
&lt;li&gt;You need a rootfs for a specific architecture, such as 32-bit x86 Manjaro&lt;/li&gt;
&lt;li&gt;You want to run an x86_64 system on an ARM64 device&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Fortunately, proot-distro allows us to &amp;ldquo;register&amp;rdquo; proot distributions. We can add our own rootfs and then operate it with the &lt;code&gt;proot-disro&lt;/code&gt; command.&lt;/p&gt;

&lt;h2 class="relative group"&gt;2. How to build a custom Linux rootfs
 &lt;div id="2-how-to-build-a-custom-linux-rootfs" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-how-to-build-a-custom-linux-rootfs" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;Most distributions have their own rootfs building tools. Note that packages like &lt;code&gt;debootstrap&lt;/code&gt; included in Termux may have permission issues, so it is safer to create the rootfs on a Linux computer and then move it to the phone.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ubuntu: &lt;a href="https://ivonblog.com/en-us/posts/debootstrap-create-rootfs-for-android" &gt;debootstrap&lt;/a&gt; or download an &lt;a href="https://cdimage.ubuntu.com/ubuntu-base/releases/jammy/release/" target="_blank" rel="noreferrer"&gt;automatically built rootfs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Debian：&lt;a href="https://ivonblog.com/en-us/posts/debootstrap-create-rootfs-for-android" &gt;debootstrap&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Fedora：&lt;a href="https://github.com/libguestfs/supermin" target="_blank" rel="noreferrer"&gt;supermin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;openSUSE: download an &lt;a href="https://en.opensuse.org/HCL:Chroot" target="_blank" rel="noreferrer"&gt;automatically built rootfs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Alpine：&lt;a href="https://wiki.alpinelinux.org/wiki/Bootstrapping_Alpine_Linux" target="_blank" rel="noreferrer"&gt;Bootstrapping Alpine Linux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Arch：&lt;a href="https://wiki.archlinux.org/title/Pacstrap" target="_blank" rel="noreferrer"&gt;pacstrap&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Manjaro：&lt;a href="https://wiki.archlinux.org/title/Pacstrap" target="_blank" rel="noreferrer"&gt;pacstrap&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Void：&lt;a href="https://docs.voidlinux.org/installation/guides/chroot.html" target="_blank" rel="noreferrer"&gt;Installation via chroot&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can also refer to &lt;a href="https://github.com/termux/proot-distro/tree/master/distro-build" target="_blank" rel="noreferrer"&gt;the proot-distro author&amp;rsquo;s scripts&lt;/a&gt; to understand how to create a custom rootfs.&lt;/p&gt;

&lt;h2 class="relative group"&gt;3. Register a new Ubuntu proot-distro
 &lt;div id="3-register-a-new-ubuntu-proot-distro" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-register-a-new-ubuntu-proot-distro" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Open Termux and install proot-distro&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pkg install proot-distro&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;
&lt;p&gt;Go to &lt;a href="https://cdimage.ubuntu.com/ubuntu-base/releases/22.04/release/?C=M;O=D" target="_blank" rel="noreferrer"&gt;Ubuntu daily builds&lt;/a&gt; and copy the Ubuntu base 22.04 URL. This is a minimal system.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Temporarily download it to the Termux home directory&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pkg install wget
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wget https://cdimage.ubuntu.com/ubuntu-base/releases/22.04/release/ubuntu-base-22.04.3-base-arm64.tar.gz&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;Calculate the SHA256 checksum, then remove it&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pkg install coreutils
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sha256sum ubuntu-base-22.04.3-base-arm64.tar.gz
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rm ubuntu-base-22.04.3-base-arm64.tar.gz&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="5"&gt;
&lt;li&gt;Switch to &lt;code&gt;$PREFIX/etc/proot-distro&lt;/code&gt;, where proot scripts are stored, copy the sample script, and name it &lt;code&gt;ubuntu22.04.sh&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;$PREFIX&lt;/span&gt;/etc/proot-distro
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cp distro.sh.sample ubuntu22.04.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="6"&gt;
&lt;li&gt;Edit it&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vim ubuntu22.04.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="7"&gt;
&lt;li&gt;Add the following content. I omitted the original comments.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# The architecture should match the phone processor architecture&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;DISTRO_ARCH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;aarch64
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Display name of the distribution&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;DISTRO_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Ubuntu 22.04 LTS&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Comment&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;DISTRO_COMMENT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Ubuntu 22.04 LTS Jammy Jellyfish&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Directory depth of the archive, default is 1, which ignores the root directory. But Ubuntu base extracts directly as the filesystem, so set 0 here&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;TARBALL_STRIP_OPT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Each architecture in the array corresponds to a rootfs URL. You can also upload the rootfs to your own Github instead&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;TARBALL_URL&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;aarch64&amp;#39;&lt;/span&gt;&lt;span class="o"&gt;]=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;https://cdimage.ubuntu.com/ubuntu-base/releases/22.04/release/ubuntu-base-22.04.3-base-arm64.tar.gz&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Fill in the archive&amp;#39;s SHA256 checksum&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;TARBALL_SHA256&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;aarch64&amp;#39;&lt;/span&gt;&lt;span class="o"&gt;]=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;bdae94b05d0fca7decbe164010af2ac1b772a9dda21ed9fb5552b5674ad634a3&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Commands to run after installation&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;distro_setup&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; run_proot_cmd touch /etc/hello-world
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="8"&gt;
&lt;li&gt;
&lt;p&gt;Try running &lt;code&gt;proot-distro list&lt;/code&gt;; you can see that the Ubuntu 22.04 LTS we just added has appeared in the list
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/termux-proot-distro-add-custom-distro/images/Screenshot_20231116-163707.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 width="512"
 height="527"&gt;&lt;/figure&gt;&lt;/p&gt;</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://ivonblog.com/en-us/posts/termux-proot-distro-add-custom-distro/featured.webp"/></item><item><title>Install Linux distributions on an Android phone: Termux proot-distro tutorial</title><link>https://ivonblog.com/en-us/posts/termux-proot-distro/</link><pubDate>Thu, 16 Nov 2023 15:00:00 +0800</pubDate><author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author><guid>https://ivonblog.com/en-us/posts/termux-proot-distro/</guid><description>&lt;!-- Co-translated by ChatGPT --&gt;
&lt;p&gt;This article discusses how to use proot-distro to install Linux distributions.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://ivonblog.com/en-us/posts/how-to-use-termux/" target="_blank" rel="noreferrer"&gt;Termux&lt;/a&gt;, as a terminal emulator, can install Linux distributions on a phone with the &lt;code&gt;proot-distro&lt;/code&gt; tool, without root privileges.&lt;/p&gt;
&lt;p&gt;For example, you can install Ubuntu, Arch Linux, Alpine Linux, Fedora, Debian, openSUSE, and so on.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/termux-proot-distro/images/5AoFyAZ.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 width="1080"
 height="462"&gt;&lt;figcaption&gt;Running Debian 11 on a Sony Xperia 5 II&lt;/figcaption&gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Linux distributions installed by proot-distro only have a text interface. The graphical interface has to be configured yourself.&lt;/p&gt;
&lt;p&gt;If you find that troublesome, you can refer to the automated scripts provided at the end of the article.&lt;/p&gt;

&lt;h2 class="relative group"&gt;1. What are proot &amp;amp; proot-distro?
 &lt;div id="1-what-are-proot--proot-distro" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-what-are-proot--proot-distro" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;On a GNU/Linux computer system, we can use the &lt;a href="https://zh.wikipedia.org/zh-tw/Chroot" target="_blank" rel="noreferrer"&gt;chroot command&lt;/a&gt; to create an isolated Linux environment. This is the earliest container concept, which appeared before cgroups. After switching into it through the chroot command, it feels as if you have entered another system. For example, using debootstrap on Ubuntu to create a Debian environment, then running a Debian environment.&lt;/p&gt;
&lt;p&gt;chroot is neither a virtual machine nor an emulator, because the inside of a chroot container shares the Linux kernel with the host and shares many system resources.&lt;/p&gt;
&lt;p&gt;Related article: &lt;a href="https://ivonblog.com/en-us/posts/termux-chroot-ubuntu/" target="_blank" rel="noreferrer"&gt;Termux chroot Ubuntu&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;But chroot always requires root privileges. The Termux terminal on Android includes the &lt;code&gt;proot&lt;/code&gt; package as an alternative.&lt;/p&gt;
&lt;p&gt;According to the &lt;a href="https://github.com/proot-me/PRoot/" target="_blank" rel="noreferrer"&gt;PRoot official site&lt;/a&gt;, proot is a usersapce implementation of chroot. It uses ptrace to emulate system calls, including bind, binfmt, and other features.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/termux-proot-distro/images/proot.png"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 width="200"
 height="200"&gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Because it uses ptrace, programs under proot inevitably run slower than under chroot, but the advantage is that you can run a Linux environment without root privileges.&lt;/p&gt;
&lt;p&gt;Like chroot, proot only needs a Linux rootfs (root filesystem), then uses Termux to load a fake Linux kernel, making programs think they are running in a real Linux environment.&lt;/p&gt;
&lt;p&gt;But note that a proot environment only counts as a container, not a complete Linux system!&lt;/p&gt;
&lt;p&gt;Why use proot instead of running commands directly in Termux? Termux itself includes fewer packages. By installing a Linux system through proot, we can make good use of desktop Linux packages to achieve specific goals. For example, Termux has never included &amp;ldquo;Chromium&amp;rdquo;, while most Linux distributions provide it.&lt;/p&gt;
&lt;p&gt;Running desktop software in a Proot environment is not much of a problem. GIMP, LibreOffice, and Firefox can all run normally. But the &lt;code&gt;systemctl&lt;/code&gt; system administration command cannot be used, because Android does not have Systemd and it is difficult to port.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Termux includes the &lt;code&gt;proot&lt;/code&gt; package, which can be used to set up a proot environment. Linux distributions installed with proot are what we call &amp;ldquo;Proot Distro&amp;rdquo;&lt;/p&gt;
&lt;p&gt;Linux distributions installed with proot are at most &amp;ldquo;containers&amp;rdquo;, not complete systems like virtual machines.&lt;/p&gt;
&lt;p&gt;But do not confuse &amp;ldquo;Proot Distro&amp;rdquo; with &amp;ldquo;proot-distro&amp;rdquo;; the latter is a tool.&lt;/p&gt;
&lt;p&gt;Because proot requires you to prepare a Linux system rootfs yourself, and the commands are complex, Termux provides a wrapper script called &lt;code&gt;proot-distro&lt;/code&gt;. It can automatically install Linux distribution rootfs images maintained by the official Termux project and handle proot-related environment issues, making it much easier to use.&lt;/p&gt;</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://ivonblog.com/en-us/posts/termux-proot-distro/featured.png"/></item><item><title>Udroid: A script for quickly installing Ubuntu in Termux (Termux Proot)</title><link>https://ivonblog.com/en-us/posts/install-proot-ubuntu-on-android/</link><pubDate>Tue, 25 Jul 2023 17:00:00 +0800</pubDate><author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author><guid>https://ivonblog.com/en-us/posts/install-proot-ubuntu-on-android/</guid><description>&lt;!-- Co-translated by ChatGPT --&gt;
&lt;p&gt;Ubuntu is a well-known Linux distribution. Besides using it on computers, Android devices can also install Linux distributions without root privileges through Termux Proot container technology.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/install-proot-ubuntu-on-android/images/Screenshot_20230725-204710_AVNC.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 width="1080"
 height="540"&gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;The lazy solution used below is &amp;ldquo;Udroid&amp;rdquo;. Compared with &lt;a href="https://ivonblog.com/en-us/posts/termux-proot-distro/" target="_blank" rel="noreferrer"&gt;manually entering proot-distro commands&lt;/a&gt;, this version of the Linux installation process only requires a few lines of commands. It installs an Ubuntu 22.04 LTS system for you, with a browser and office software built in. GNOME, XFCE, and Mate are available as desktop environment choices.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/install-proot-ubuntu-on-android/images/chadtux.png"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 width="200"
 height="200"&gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Because Termux itself is a text-only interface, after installing Ubuntu you can also skip starting the graphical environment and simply run programs and scripts.&lt;/p&gt;
&lt;p&gt;See also: &lt;a href="https://ivonblog.com/en-us/posts/termux-proot-distro-ubuntu/" target="_blank" rel="noreferrer"&gt;proot Ubuntu&lt;/a&gt;&lt;/p&gt;

&lt;h2 class="relative group"&gt;1. Prerequisites
 &lt;div id="1-prerequisites" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-prerequisites" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;See &lt;a href="http://ivonblog.com/en-us/posts/termux-proot-distro" target="_blank" rel="noreferrer"&gt;Linux Proot-distro&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To run Udroid, the phone needs at least 4GB RAM, and the graphical interface needs at least 6GB. Prepare 10GB of storage space.&lt;/p&gt;
&lt;p&gt;Install Termux and VNC Viewer. Udroid does not seem to be compatible with Termux X11.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Install Termux: &lt;a href="http://ivonblog.com/en-us/posts/how-to-use-termux/" target="_blank" rel="noreferrer"&gt;How to Use Termux&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install &lt;a href="https://f-droid.org/packages/com.gaurav.avnc/" target="_blank" rel="noreferrer"&gt;AVNC Viewer&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 class="relative group"&gt;2. Run the Udroid installation script
 &lt;div id="2-run-the-udroid-installation-script" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-run-the-udroid-installation-script" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Open Termux and configure the audio server to start automatically&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;pulseaudio --start --exit-idle-time=-1&amp;#39;&lt;/span&gt; &amp;gt; ~/.profile
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;pacmd load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1&amp;#39;&lt;/span&gt; &amp;gt; ~/.profile&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;Copy these lines of commands, long-press in Termux to paste them, press Enter, and wait for the 2GB file to finish downloading, installing, and extracting. Yes, Udroid really is quite huge.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pkg install git
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git clone https://github.com/RandomCoderOrg/fs-manager-udroid
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; fs-manager-udroid
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bash install.sh
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;udroid install jammy:xfce4
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;udroid login jammy:xfce4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;
&lt;p&gt;It will automatically log in afterward. At first, you may encounter zsh asking whether to update; enter &lt;code&gt;y&lt;/code&gt; and wait for it to finish. When the prompt becomes &lt;code&gt;~&lt;/code&gt;, that means you have entered text-mode proot Ubuntu. Try using the &lt;code&gt;apt update&lt;/code&gt; command to update the package list.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/install-proot-ubuntu-on-android/images/Screenshot_20230725-200652_Termux.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 width="1080"
 height="350"&gt;&lt;/figure&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Udroid logs in as root by default. You need to create a normal user account yourself:&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;apt install openssl
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;username&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;user&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;password&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;password&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;useradd -m &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -p &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;openssl passwd -1 &lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;password&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -G sudo &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -d /home/&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;username&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -k /etc/skel &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -s /bin/bash &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nv"&gt;$username&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="5"&gt;
&lt;li&gt;However, Udroid&amp;rsquo;s normal user will show the &lt;code&gt;The &amp;quot;no new privileges&amp;quot; flag is set&lt;/code&gt; error. Reinstall &lt;code&gt;sudo&lt;/code&gt; to solve it:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;apt reinstall sudo&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 class="relative group"&gt;3. Set time zone, Chinese, input method, and disable Snap
 &lt;div id="3-set-time-zone-chinese-input-method-and-disable-snap" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-set-time-zone-chinese-input-method-and-disable-snap" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Set the time zone to Taipei, Taiwan&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;Install locales, the Fcitx5 input method, and Chinese fonts&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt install locales fcitx5* fonts-noto fonts-noto-cjk&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;Generate Chinese locales&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo locale-gen zh_TW
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo locale-gen zh_TW.UTF-8
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo dpkg-reconfigure locales
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo update-locale &lt;span class="nv"&gt;LANG&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;zh_TW.UTF-8&amp;#34;&lt;/span&gt; &lt;span class="nv"&gt;LANGUAGE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;zh_TW&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;Edit &lt;code&gt;.profile&lt;/code&gt; with VIM&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vim ~/.profile&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="5"&gt;
&lt;li&gt;Add the following content to set the language to Traditional Chinese and specify Fcitx5 as the input method. Configure Fcitx5 and PulseAudio to start automatically after login&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;LANG&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;zh_TW.UTF-8
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;LC_CTYPE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;zh_TW.UTF-8
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;LC_NUMERIC&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;zh_TW.UTF-8
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;LC_TIME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;zh_TW.UTF-8
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;LC_COLLATE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;zh_TW.UTF-8
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;LC_MONETARY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;zh_TW.UTF-8
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;LC_MESSAGES&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;zh_TW.UTF-8
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;LC_PAPER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;zh_TW.UTF-8
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;LC_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;zh_TW.UTF-8
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;LC_ADDRESS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;zh_TW.UTF-8
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;LC_TELEPHONE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;zh_TW.UTF-8
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;LC_MEASUREMENT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;zh_TW.UTF-8
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;LC_IDENTIFICATION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;zh_TW.UTF-8
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;LC_ALL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;GTK_IM_MODULE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;fcitx
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;QT_IM_MODULE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;fcitx
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;XMODIFIERS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;@im&lt;span class="o"&gt;=&lt;/span&gt;fcitx
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;SDL_IM_MODULE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;fcitx
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;GLFW_IM_MODULE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ibus
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;PULSE_SERVER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;tcp:127.0.0.1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="6"&gt;
&lt;li&gt;Finally, disable Snap, because Snap cannot work in a Proot environment&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt purge snapd
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo cat &lt;span class="s"&gt;&amp;lt;&amp;lt;EOF | sudo tee /etc/apt/preferences.d/nosnap.pref
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;Package: snapd
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;Pin: release a=*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;Pin-Priority: -10
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 class="relative group"&gt;4. Start the desktop environment
 &lt;div id="4-start-the-desktop-environment" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#4-start-the-desktop-environment" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Change the root password&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;passwd root&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;Change the VNC password&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vncpasswd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;
&lt;p&gt;Enter the &lt;code&gt;startvnc&lt;/code&gt; command to start the VNC server&lt;/p&gt;</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://ivonblog.com/en-us/posts/install-proot-ubuntu-on-android/featured.png"/></item><item><title>Andronix: Quickly install a fully featured Proot Ubuntu</title><link>https://ivonblog.com/en-us/posts/andronix-proot-distro/</link><pubDate>Fri, 29 Jul 2022 03:33:46 +0800</pubDate><author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author><guid>https://ivonblog.com/en-us/posts/andronix-proot-distro/</guid><description>&lt;!-- Co-translated by ChatGPT --&gt;
&lt;p&gt;Do you always run into all kinds of problems when installing Proot distributions yourself in &lt;a href="https://ivonblog.com/en-us/posts/how-to-use-termux/" target="_blank" rel="noreferrer"&gt;Termux&lt;/a&gt;? Andronix provides lazy-install distribution systems that set up audio and graphics with one click. If you want better quality, you can also buy a tuned version.&lt;/p&gt;
&lt;p&gt;Andronix is actually an assistant app. Through a guided interface, it lets users choose the Linux distribution they want to install, then copy and paste the provided commands or one-click installation scripts into Termux and run them. Its pitch is out-of-the-box usability.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://i.postimg.cc/bwVR5wht/Screenshot-2021-11-05-11-00-05.png"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;/figure&gt;&lt;/p&gt;

&lt;h2 class="relative group"&gt;1. Download and install
 &lt;div id="1-download-and-install" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-download-and-install" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Download &lt;a href="https://play.google.com/store/apps/details?id=studio.com.techriz.andronix&amp;amp;hl=zh_TW&amp;amp;gl=US" target="_blank" rel="noreferrer"&gt;Andronix&lt;/a&gt;. This app has a graphical interface that guides users through installing a Proot distribution. After selecting the required options, paste the generated command into Termux, and it will automatically execute the script and install the corresponding distribution + desktop environment.
&lt;img src="https://i.postimg.cc/6ptmVgp7/Screenshot-20211105-104824.png" width=300&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In addition to free scripts, Andronix also sells modified Linux distributions (Modded OS). For about NT$100, the installation script automatically solves audio output and graphics issues and includes a nice desktop. You need to register an Andronix account before purchasing.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The purchase screen. Although payment is made through Google Play, the purchased license follows the Andronix account.
&lt;img src="https://i.postimg.cc/wjSM1XVj/Screenshot-20211105-105051.png" width=300&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;After pressing &lt;code&gt;Proceed&lt;/code&gt;, you will get a URL and command. Paste them into Termux and press Enter to download and install automatically. For example, I bought Ubuntu 20.04 + XFCE.
&lt;img src="https://i.postimg.cc/vZhS0h40/Screenshot-20211105-024844.png" width=300&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;After the script finishes, run this in Termux:&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./start-andronix.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="6"&gt;
&lt;li&gt;
&lt;p&gt;Then set the time zone, keyboard layout, and create a user account. You will use this script to start it in the future as well.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then use a command to start &lt;code&gt;vncserver&lt;/code&gt;, and you can enter the desktop with &lt;a href="https://play.google.com/store/apps/details?id=com.realvnc.viewer.android&amp;amp;hl=zh_TW&amp;amp;gl=US" target="_blank" rel="noreferrer"&gt;VNC Viewer&lt;/a&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vncserver&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="8"&gt;
&lt;li&gt;Proot can only be logged out of. Enter the &lt;code&gt;logout&lt;/code&gt; command in Termux to close Proot.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 class="relative group"&gt;2. Usage experience
 &lt;div id="2-usage-experience" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-usage-experience" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The XFCE desktop is deeply customized, with Chromium and Firefox preinstalled.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://i.postimg.cc/YCdXwx1j/Screenshot-2021-11-05-10-52-30.png"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;/figure&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;There is also LibreOffice, GIMP, VS Code OSS, and other windowed programs such as blender can also open normally.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://i.postimg.cc/zfM0yX2r/Screenshot-2021-11-05-10-55-57.png"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;/figure&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Supports Pulse Audio output and Open GL (without hardware acceleration)
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://i.postimg.cc/CKZ4pph6/Screenshot-2021-11-05-10-57-57.png"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;/figure&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install Chinese fonts (Google Noto Sans)&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt-get install language-pack-zh* fonts-noto-cjk&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</description></item></channel></rss>