<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"
     xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Termux-Tutorials on Ivon&#39;s Blog</title>
    <link>https://ivonblog.com/en-us/termux-tutorials/</link>
    <description>Recent content in Termux-Tutorials on Ivon&#39;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 from Ivon&#39;s blog (ivonblog.com). Please cite the source article URL when sharing. All article content is licensed under a Creative Commons Attribution-ShareAlike 4.0 license, unless otherwise stated. For commercial use, please contact me first.</copyright>
    <lastBuildDate>Sun, 31 May 2026 17:00:00 +0800</lastBuildDate><atom:link href="https://ivonblog.com/en-us/termux-tutorials/index.xml" rel="self" type="application/rss+xml" />
    <follow_challenge>
      <feedId>56005902658351104</feedId>
      <userId>1132431067563556864</userId>
    </follow_challenge>
    
    
    <item>
      <title>How to install Arch Linux ARM on Android phone (Termux Proot-distro)</title>
      <link>https://ivonblog.com/en-us/posts/termux-proot-distro-archlinux/</link>
      <pubDate>Sun, 31 May 2026 17:00:00 +0800</pubDate>
      <author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author>
      <guid>https://ivonblog.com/en-us/posts/termux-proot-distro-archlinux/</guid>
      
      <description>&lt;p&gt;Proot-distro of Termux allows you to install Linux distributions on your Android phone. No root required. Proot-distros are containers, which are limited but still possible to run some dekstop appliations in it.&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/termux-proot-distro-archlinux/images/Screenshot_20230725-185235_Termux_X11.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Arch Linux is a Linux distribution that emphasizes simplicity, requiring users to install the system according to their own needs, so the installation process requires manual command-line input. Here, Arch Linux ARM is being installed, a branch of the original Arch Linux. The original version focuses on the x86 architecture, and some x86-based packages may not be available on ARM, but the AUR is still available.&lt;/p&gt;</description>
      <content:encoded>&lt;p&gt;Proot-distro of Termux allows you to install Linux distributions on your Android phone. No root required. Proot-distros are containers, which are limited but still possible to run some dekstop appliations in it.&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/termux-proot-distro-archlinux/images/Screenshot_20230725-185235_Termux_X11.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Arch Linux is a Linux distribution that emphasizes simplicity, requiring users to install the system according to their own needs, so the installation process requires manual command-line input. Here, Arch Linux ARM is being installed, a branch of the original Arch Linux. The original version focuses on the x86 architecture, and some x86-based packages may not be available on ARM, but the AUR is still available.&lt;/p&gt;&#xA;&lt;p&gt;In this article, I will guide you to install Proot Arch Linux ARM with a Desktop Environment from scratch (kind of) in Termux.&lt;/p&gt;&#xA;&lt;p&gt;&lt;font color=RED&gt;You would have to install the whole system from command lines.&lt;/font&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;1. Prerequisites&#xA;    &lt;div id=&#34;1-prerequisites&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#1-prerequisites&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Make sure your device has 10GB+ storage and 4GB+ RAM.&lt;/p&gt;&#xA;&lt;p&gt;My Device:Sony Xperia 10 V (Android 16)&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Install &lt;a href=&#34;https://ivonblog.com/en-us/posts/how-to-use-termux/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Install &lt;a href=&#34;https://ivonblog.com/en-us/posts/termux-x11/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux X11&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Install &lt;a href=&#34;https://ivonblog.com/en-us/posts/termux-virglrenderer/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;virglrenderer&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;2. Install Proot Arch Linux base system&#xA;    &lt;div id=&#34;2-install-proot-arch-linux-base-system&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#2-install-proot-arch-linux-base-system&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Scroll down the top menu, press &lt;code&gt;ACQUIRE WAKELOCK&lt;/code&gt; to keep Termux running in the background.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Install proot-distro, pulseaudio, vim&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pkg update&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pkg install proot-distro pulseaudio vim&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;Install Proot Arch Linux (base system)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;proot-distro install archlinux/archlinux:latest&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;Login to Arch Linux&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;proot-distro login archlinux  --user root --shared-tmp&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;3. Switch mirrors and update system pacakges&#xA;    &lt;div id=&#34;3-switch-mirrors-and-update-system-pacakges&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#3-switch-mirrors-and-update-system-pacakges&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;(Optional) Go to &lt;a href=&#34;https://archlinux.org/mirrors/status/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;mirror list&lt;/a&gt; to pick a fastest mirror in your country. Then edit &lt;code&gt;/etc/pacman.d/mirrorlist&lt;/code&gt; with &lt;code&gt;vi&lt;/code&gt;. Replace every link before &lt;code&gt;$repo&lt;/code&gt; to the mirror link.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Update system&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pacman -Syu&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;4. Add a normal user&#xA;    &lt;div id=&#34;4-add-a-normal-user&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#4-add-a-normal-user&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Change password of root&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;passwd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;Add a new user&lt;code&gt;user&lt;/code&gt;. Then add him to group &lt;code&gt;wheel&lt;/code&gt; and change his password.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pacman -S sudo vim&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;useradd -m -g users -G wheel,audio,video,storage -s /bin/bash user&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;passwd user&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;Add user &lt;code&gt;user&lt;/code&gt; to sudoers. Edit&lt;code&gt;/etc/sudoers&lt;/code&gt;with &lt;code&gt;vi&lt;/code&gt;, add following lines beneath&lt;code&gt;&amp;quot;root ALL=(ALL) ALL&amp;quot;&lt;/code&gt;:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;user &lt;span class=&#34;nv&#34;&gt;ALL&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=(&lt;/span&gt;ALL&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; ALL&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;4&#34;&gt;&#xA;&lt;li&gt;Make sure you login to Arch as a normal user. Never login as root.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;su user&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;cd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;5. Install a Desktop Environment and common tools&#xA;    &lt;div id=&#34;5-install-a-desktop-environment-and-common-tools&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#5-install-a-desktop-environment-and-common-tools&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Install Firefox, Noto Fonts, SSH and other common tools&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo pacman -S vim firefox networkmanager xorg xorg-server pulseaudio noto-fonts git openssh fakeroot base-devel&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;Install yay - the AUR helper:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo pacman -S --needed git base-devel &lt;span class=&#34;o&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; git clone https://aur.archlinux.org/yay.git &lt;span class=&#34;o&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;cd&lt;/span&gt; yay &lt;span class=&#34;o&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; makepkg -si&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Edit &lt;code&gt;/etc/makepkg.conf&lt;/code&gt; with vim. Uncomment &lt;code&gt;MAKEFLAGS=&amp;quot;-j2&amp;quot;&lt;/code&gt;. Change &lt;code&gt;-j2&lt;/code&gt; to &lt;code&gt;-j&lt;/code&gt; + (2 x phone processor cores). This could speed up AUR compiling time.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Install XFCE4 Desktop environment&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo pacman -S xfce4 xfce4-goodies lightdm&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;6. Timezone &amp;amp; hostname &amp;amp; locales&#xA;    &lt;div id=&#34;6-timezone--hostname--locales&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#6-timezone--hostname--locales&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Setup timezone&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Edit &lt;code&gt;/etc/hostname&lt;/code&gt; and &lt;code&gt;/etc/hosts&lt;/code&gt; to rename your machine.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Edit &lt;code&gt;/etc/locale.gen&lt;/code&gt;, uncomment your language, for example &lt;code&gt;en_US.UTF-8&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Generating locales&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo locale-gen&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;LANG=en_US.UTF-8&amp;#34;&lt;/span&gt; &amp;gt;&amp;gt; /etc/locale.conf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;7.  Start desktop enviornment manually&#xA;    &lt;div id=&#34;7--start-desktop-enviornment-manually&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#7--start-desktop-enviornment-manually&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Congrats! Now you have installed Arch Linux on your Android phone! Read below to learn how to desktop enviornment manully.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Relaunch Termux&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Launch Termux X11 app, keep it opening in the background. Go back to Termux and type the following commands to run Termux X11.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pulseaudio --start --exit-idle-time&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;-1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pacmd load-module module-native-protocol-tcp auth-ip-acl&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;127.0.0.1 auth-anonymous&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;m&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;export&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;DISPLAY&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;:0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;termux-x11 :0 &lt;span class=&#34;p&#34;&gt;&amp;amp;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;virgl_test_server_android &lt;span class=&#34;p&#34;&gt;&amp;amp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;Login to Arch Linux as a normal user.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;proot-distro login archlinux --user user --shared-tmp&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;4&#34;&gt;&#xA;&lt;li&gt;Start desktop environment&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;export&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;DISPLAY&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;:0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;PULSE_SERVER&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;tcp:127.0.0.1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;dbus-launch --exit-with-session startxfce4 &lt;span class=&#34;p&#34;&gt;&amp;amp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;5&#34;&gt;&#xA;&lt;li&gt;You shall see XFCE4 desktop showing at Termux X11. Tap floating window and revoke permission to make it go full screen.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;8. Start desktop environment in one-click&#xA;    &lt;div id=&#34;8-start-desktop-environment-in-one-click&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#8-start-desktop-environment-in-one-click&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;We can use Termux Widget to start everything automatically. Thanks to Korean developers&amp;rsquo; tutorial!&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Install &lt;a href=&#34;https://f-droid.org/zh_Hant/packages/com.termux.widget/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux Widget&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Go to system settings → all apps, turn on &amp;ldquo;Permit Drawing Over Other Apps&amp;rdquo; for Termux.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Restart Termux. Create a shortcut in Termux (not in proot-distro)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mkdir .shortcuts&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;vim .shortcuts/startproot_arch.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;4&#34;&gt;&#xA;&lt;li&gt;Type these&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;cp&#34;&gt;#!/bin/bash&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;killall -9 termux-x11 pulseaudio virgl_test_server_android termux-wake-lock&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;am start --user &lt;span class=&#34;m&#34;&gt;0&lt;/span&gt; -n com.termux.x11/com.termux.x11.MainActivity&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;XDG_RUNTIME_DIR&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;TMPDIR&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;termux-x11 :0 -ac &lt;span class=&#34;p&#34;&gt;&amp;amp;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sleep &lt;span class=&#34;m&#34;&gt;3&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pulseaudio --start --exit-idle-time&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;-1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pacmd load-module module-native-protocol-tcp auth-ip-acl&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;127.0.0.1 auth-anonymous&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;m&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;virgl_test_server_android &lt;span class=&#34;p&#34;&gt;&amp;amp;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;proot-distro login archlinux --user user --shared-tmp -- bash -c &lt;span class=&#34;s2&#34;&gt;&amp;#34;export DISPLAY=:0 PULSE_SERVER=tcp:127.0.0.1; dbus-launch --exit-with-session startxfce4&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;5&#34;&gt;&#xA;&lt;li&gt;Make it executable.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;chmod +x .shortcuts/startproot_arch.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;6&#34;&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Go to your home screen, long press and add widgets → select &amp;ldquo;Termux Widget&amp;rdquo;. You would see the shortcut we made is on the list.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Click &amp;ldquo;startproot_arch.sh&amp;rdquo; then the XFCE desktop would opened automatically.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Swipe down the notification bar, click &lt;code&gt;Preferences&lt;/code&gt; of Termux X11. Then you can switch touch screen mode to simulating touchpad.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;To use soft keyboard of phone in Termux X11, swipe the bar at the bottom and you will see a field for inputing texts.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;If the fonts are too small in Termux X11, click Settings Manager at top-left → Appearance and change font size or select 2x window scaling.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;To stop the XFCE session, press CTRL+C in Termux. Then logout of proot Arch Linux.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;exit&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;Further readings&#xA;    &lt;div id=&#34;further-readings&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#further-readings&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/termux/proot-distro&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Proot-distro on Github&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://wiki.archlinux.org/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Arch Linux Wiki&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</content:encoded>
      <media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://ivonblog.com/en-us/posts/termux-proot-distro-archlinux/featured.webp" />
    </item>
    
    <item>
      <title>Accelerate QEMU virtual machines in Termux with pKVM</title>
      <link>https://ivonblog.com/en-us/posts/termux-qemu-system-tensor-linux/</link>
      <pubDate>Tue, 23 Dec 2025 11:00:00 +0800</pubDate>
      <author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author>
      <guid>https://ivonblog.com/en-us/posts/termux-qemu-system-tensor-linux/</guid>
      
      <description>&lt;!-- Co-translated by ChatGPT --&gt;&#xA;&lt;p&gt;I discussed the problem of running virtual machines on Android phones with Termux in &lt;a href=&#34;https://ivonblog.com/en-us/posts/termux-qemu-system-linux/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux + QEMU Linux VM&lt;/a&gt;. The conclusion: it is slow as hell.&lt;/p&gt;&#xA;&lt;p&gt;Without KVM, everything depends on software emulation. The result is that you can only run 20-year-old Windows XP systems; modern operating systems are simply too heavy.&lt;/p&gt;&#xA;&lt;p&gt;Phones equipped with Google Tensor processors introduced pKVM after Android 15, which is the technology supported underneath the AVF framework.&lt;/p&gt;&#xA;&lt;p&gt;At the moment, except for Android 16&amp;rsquo;s experimental Debian Linux Terminal, ordinary apps cannot access pKVM. You need root privileges to enable pKVM.&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;1. Install packages&#xA;    &lt;div id=&#34;1-install-packages&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#1-install-packages&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;With KVM acceleration, you should run a virtual machine of the same architecture. According to Termux developers, using the &lt;code&gt;qemu-system-aarch64-headless&lt;/code&gt; package can give you a pKVM-accelerated virtual machine.&lt;/p&gt;</description>
      <content:encoded>&lt;!-- Co-translated by ChatGPT --&gt;&#xA;&lt;p&gt;I discussed the problem of running virtual machines on Android phones with Termux in &lt;a href=&#34;https://ivonblog.com/en-us/posts/termux-qemu-system-linux/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux + QEMU Linux VM&lt;/a&gt;. The conclusion: it is slow as hell.&lt;/p&gt;&#xA;&lt;p&gt;Without KVM, everything depends on software emulation. The result is that you can only run 20-year-old Windows XP systems; modern operating systems are simply too heavy.&lt;/p&gt;&#xA;&lt;p&gt;Phones equipped with Google Tensor processors introduced pKVM after Android 15, which is the technology supported underneath the AVF framework.&lt;/p&gt;&#xA;&lt;p&gt;At the moment, except for Android 16&amp;rsquo;s experimental Debian Linux Terminal, ordinary apps cannot access pKVM. You need root privileges to enable pKVM.&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;1. Install packages&#xA;    &lt;div id=&#34;1-install-packages&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#1-install-packages&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;With KVM acceleration, you should run a virtual machine of the same architecture. According to Termux developers, using the &lt;code&gt;qemu-system-aarch64-headless&lt;/code&gt; package can give you a pKVM-accelerated virtual machine.&lt;/p&gt;&#xA;&lt;p&gt;Install the following packages. On ARM machines, it is best to enable UEFI.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pkg install qemu-system-aarch64-headless qemu-utils qemu-common ovmf sudo&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;There is no Virt Manager in the graphical interface, and the Libvirt service probably will not run, so we have to use &lt;a href=&#34;github.com/gujjwal00/avnc&#34; &gt;AVNC&lt;/a&gt; to access the virtual machine display.&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;2. Create a Linux virtual machine in Termux&#xA;    &lt;div id=&#34;2-create-a-linux-virtual-machine-in-termux&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#2-create-a-linux-virtual-machine-in-termux&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Download the &lt;a href=&#34;https://ubuntu.com/download/server/arm&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Ubuntu ARM&lt;/a&gt; ISO and put it in Termux&amp;rsquo;s home directory&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Confirm that KVM exists&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo ls /dev/kvm&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;Create a virtual disk&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;qemu-img create -f qcow2 ubuntu.qcow2 32G&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;4&#34;&gt;&#xA;&lt;li&gt;Create files to store UEFI&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;truncate -s 64m varstore.img&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;truncate -s 64m efi.img&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;dd &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$PREFIX&lt;/span&gt;/share/qemu/edk2-aarch64-code.fd &lt;span class=&#34;nv&#34;&gt;of&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;efi.img &lt;span class=&#34;nv&#34;&gt;conv&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;notrunc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;5&#34;&gt;&#xA;&lt;li&gt;Add a boot script&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;touch startubuntu.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;chmod +x  startubuntu.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;vim startubuntu.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;6&#34;&gt;&#xA;&lt;li&gt;The contents are as follows&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;qemu-system-aarch64 -M virt &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;-enable-kvm  &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;-drive &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;pflash,format&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;raw,file&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;efi.img&amp;#34;&lt;/span&gt;,readonly &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;-drive &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;pflash,format&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;raw,file&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;varstore.img&amp;#34;&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;-smp &lt;span class=&#34;nv&#34;&gt;cpus&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;m&#34;&gt;2&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;-m &lt;span class=&#34;m&#34;&gt;1024&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;-cpu host &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;-nographic &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;-netdev user,id&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;n1,hostfwd&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;tcp::2222-:22 -device virtio-net,netdev&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;n1 &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;-drive &lt;span class=&#34;nv&#34;&gt;file&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;ubuntu.qcow2 &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;-boot d &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;-vnc :0 &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;-cdrom ubuntu-24.04.3-live-server-arm64.iso&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;7&#34;&gt;&#xA;&lt;li&gt;Add &lt;code&gt;sudo&lt;/code&gt; when running it.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo ./startubuntu.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;If everything goes smoothly, you can open &lt;code&gt;localhost:59000&lt;/code&gt; in AVNC and see the virtual machine display.&lt;/p&gt;&#xA;&lt;p&gt;The strange thing is that it can boot without enabling KVM, but once KVM is enabled it hits the &lt;code&gt;qemu-system-aarch64: Failed to put registers after init: Invalid argument&lt;/code&gt; error.&lt;/p&gt;&#xA;&lt;p&gt;If you switch to chroot and run KVM inside it, maybe the success rate will go up?&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;References&#xA;    &lt;div id=&#34;references&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#references&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.reddit.com/r/termux/comments/169lzsf/running_a_pkvm_in_termux/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;running a pKVM in Termux? - Reddit&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.reddit.com/r/termux/comments/1fa6w9w/running_linux_vm_on_pixel_7/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt; Running Linux VM on pixel 7 - Reddit&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</content:encoded>
      
    </item>
    
    <item>
      <title>Android&#39;s new Debian Linux Terminal may not become a Termux killer</title>
      <link>https://ivonblog.com/en-us/posts/termux-vs-android-linux-terminal/</link>
      <pubDate>Fri, 12 Dec 2025 11:00:00 +0800</pubDate>
      <author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author>
      <guid>https://ivonblog.com/en-us/posts/termux-vs-android-linux-terminal/</guid>
      
      <description>&lt;!-- Co-translated by ChatGPT --&gt;&#xA;&lt;p&gt;Android 16&amp;rsquo;s Linux Terminal may not become a Termux killer.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://ivonblog.com/en-us/posts/how-to-use-termux/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux&lt;/a&gt; is an Android terminal app developed by a group of open source software enthusiasts, with its own package repository.&lt;/p&gt;&#xA;&lt;p&gt;After playing with the &lt;a href=&#34;https://ivonblog.com/en-us/posts/android-linux-terminal/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Debian Terminal on Pixel phones&lt;/a&gt;, I have temporarily reached this conclusion. It uses the AVF framework to run a Debian environment, with technology similar to ChromeOS crosvm. It is a complete virtual machine environment isolated from Android, capable of running Systemd and Docker.&lt;/p&gt;&#xA;&lt;p&gt;However, startup takes some time. And isolation between the virtual machine and the host causes performance degradation.&lt;/p&gt;&#xA;&lt;p&gt;Although GPU acceleration may be possible, its efficiency probably will not be much higher than Termux. They also have to deal with displaying Linux Wayland windows on Android&amp;rsquo;s compositor.&lt;/p&gt;</description>
      <content:encoded>&lt;!-- Co-translated by ChatGPT --&gt;&#xA;&lt;p&gt;Android 16&amp;rsquo;s Linux Terminal may not become a Termux killer.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://ivonblog.com/en-us/posts/how-to-use-termux/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux&lt;/a&gt; is an Android terminal app developed by a group of open source software enthusiasts, with its own package repository.&lt;/p&gt;&#xA;&lt;p&gt;After playing with the &lt;a href=&#34;https://ivonblog.com/en-us/posts/android-linux-terminal/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Debian Terminal on Pixel phones&lt;/a&gt;, I have temporarily reached this conclusion. It uses the AVF framework to run a Debian environment, with technology similar to ChromeOS crosvm. It is a complete virtual machine environment isolated from Android, capable of running Systemd and Docker.&lt;/p&gt;&#xA;&lt;p&gt;However, startup takes some time. And isolation between the virtual machine and the host causes performance degradation.&lt;/p&gt;&#xA;&lt;p&gt;Although GPU acceleration may be possible, its efficiency probably will not be much higher than Termux. They also have to deal with displaying Linux Wayland windows on Android&amp;rsquo;s compositor.&lt;/p&gt;&#xA;&lt;p&gt;If you only want to run CLI programs, Termux is simpler and more efficient, because it has no virtualization layer. All packages are compiled for ARM64. If you suddenly need to open an SSH remote connection, Termux starts the fastest.&lt;/p&gt;&#xA;&lt;p&gt;Termux&amp;rsquo;s GPU acceleration can still use Turnip and VriGL.&lt;/p&gt;&#xA;&lt;p&gt;The more fundamental difference is that their technical architectures are completely different. Termux has always been a native Android app. It merely creates a userspace program, directly executes ARM64 ELF binaries, and has no real virtualization at all. It can access the filesystem with near-native performance and directly use resources provided by the Android system, so startup time is fast, I/O latency is low, and the experience of launching CLI tools is excellent.&lt;/p&gt;&#xA;&lt;p&gt;Android 16 Linux Terminal takes another path. Judging from its current design, it uses full pKVM virtualization + VirtIO interfaces. Therefore, every launch is effectively booting a Linux virtual machine, and I/O has to go through VirtIO. GPU graphics processing has to handle the long data path of guest -&amp;gt; host -&amp;gt; Android SurfaceFlinger. If the virtual machine wants to use host hardware interfaces (camera, USB, GPU), it needs another translation layer, or may simply be forbidden from accessing them. This complete isolation is of course safe, but the price is that it is hard to expect the experience of &amp;ldquo;tap and open instantly, enter shell in seconds.&amp;rdquo;&lt;/p&gt;&#xA;&lt;p&gt;In terms of performance, if you are only running CLI programs such as Python scripts, SSH, git, or compiling small to medium-sized codebases, Termux will probably be faster, because it interacts directly with the Android kernel and has no virtualization overhead. GPU acceleration is similar: Termux uses Android&amp;rsquo;s OpenGL and Vulkan acceleration through Turnip/VirGL. Although it is very hacky, at least it runs, and latency is lower after bypassing the virtualization layer.&lt;/p&gt;&#xA;&lt;p&gt;On security, the objective advantage of the Linux virtual machine is obvious. No matter how Termux is sandboxed, in essence it still runs at the Android app layer, and its attack surface is similar to that of a normal app. AVF is hardware-level isolation, and pKVM can restrict a virtual machine&amp;rsquo;s DMA privileges, memory visibility, and define which peripherals are available. This should be very helpful for enterprise, tablet, and education markets.&lt;/p&gt;&#xA;&lt;p&gt;I think this Linux Terminal is more about paving the way for Android tablets to become ChromeOS-like. This way, AVF technology can provide a unified interface for virtualization on ARM processors.&lt;/p&gt;&#xA;</content:encoded>
      
    </item>
    
    <item>
      <title>Write Python on an Android phone: setting up a Termux Python development environment</title>
      <link>https://ivonblog.com/en-us/posts/termux-python/</link>
      <pubDate>Sat, 12 Apr 2025 17:00:00 +0800</pubDate>
      <author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author>
      <guid>https://ivonblog.com/en-us/posts/termux-python/</guid>
      
      <description>&lt;!-- Co-translated by ChatGPT --&gt;&#xA;&lt;p&gt;Sharing how to write Python programs with the Android phone app &amp;ldquo;Termux&amp;rdquo;, plus a bit of Ivon&amp;rsquo;s personal experience.&lt;/p&gt;&#xA;&lt;p&gt;Many Android apps for writing Python on phones are awkward. They can only install packages written in pure python, and they fall over as soon as they encounter wheels. Perhaps their goal is more like Duolingo, for beginners to practice, rather than building a serious Python development environment.&lt;/p&gt;&#xA;&lt;p&gt;Among them, only Termux keeps evolving. Although &lt;code&gt;pip install&lt;/code&gt; still cannot run 100% like a normal Linux environment, more and more packages are being compiled as Termux-specific versions! Through the Python packages provided by Termux, you can run some simple&#xA;Python programs and process files on your phone. Root privileges are not required.&lt;/p&gt;</description>
      <content:encoded>&lt;!-- Co-translated by ChatGPT --&gt;&#xA;&lt;p&gt;Sharing how to write Python programs with the Android phone app &amp;ldquo;Termux&amp;rdquo;, plus a bit of Ivon&amp;rsquo;s personal experience.&lt;/p&gt;&#xA;&lt;p&gt;Many Android apps for writing Python on phones are awkward. They can only install packages written in pure python, and they fall over as soon as they encounter wheels. Perhaps their goal is more like Duolingo, for beginners to practice, rather than building a serious Python development environment.&lt;/p&gt;&#xA;&lt;p&gt;Among them, only Termux keeps evolving. Although &lt;code&gt;pip install&lt;/code&gt; still cannot run 100% like a normal Linux environment, more and more packages are being compiled as Termux-specific versions! Through the Python packages provided by Termux, you can run some simple&#xA;Python programs and process files on your phone. Root privileges are not required.&lt;/p&gt;&#xA;&lt;p&gt;For example, install Pillow through pip and write a small program that batch-processes EXIF photo information. It reads all photos in the phone&amp;rsquo;s DCIM folder, prints the date on each photo according to EXIF information, and outputs them to another folder. (This program really works; the &lt;a href=&#34;https://gist.github.com/ivon852/7cfa3e3e4f56ee8d52eec1124d9be028&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;source code&lt;/a&gt; is here)&#xA;&lt;img src=&#34;https://static.ivonblog.com/posts/termux-python/images/2.webp&#34; width=300&gt;&lt;/p&gt;&#xA;&lt;p&gt;Or use &lt;code&gt;term-image&lt;/code&gt;, written in Python, to display images from the phone in the terminal.&#xA;&lt;img src=&#34;https://static.ivonblog.com/posts/termux-python/images/1.webp&#34; width=300&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;1. Text-only or graphical interface?&#xA;    &lt;div id=&#34;1-text-only-or-graphical-interface&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#1-text-only-or-graphical-interface&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Termux is a text-interface terminal emulator by default. You need to type commands to run Python programs. Although a graphical interface can be run through Termux X11, is it really necessary?&lt;/p&gt;&#xA;&lt;p&gt;Text-based Python programs can only output plain text, including operations such as calculating numbers, arranging stars, batch-processing files, downloading files, and so on. To write programs in a text interface, you need to learn to edit with Vim or Emacs. This is a good chance to practice operating text editors.&lt;/p&gt;&#xA;&lt;p&gt;With a graphical interface, you can run Python programs that need to display windows, draw charts, and so on. There are many choices for programming in a graphical interface, including VS Code and Jupyter Notebook, but they consume more phone resources.&lt;/p&gt;&#xA;&lt;p&gt;A graphical interface is not necessary. If you only want to write small programs, you do not necessarily need an IDE; Vim is enough.&lt;/p&gt;&#xA;&lt;p&gt;This article focuses primarily on the text environment, with graphics second.&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;2. Run Python in Termux or proot-distro?&#xA;    &lt;div id=&#34;2-run-python-in-termux-or-proot-distro&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#2-run-python-in-termux-or-proot-distro&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Python can run directly in Termux, or you can use &lt;a href=&#34;https://ivonblog.com/en-us/posts/termux-proot-distro/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;proot-distro to create a Debian environment&lt;/a&gt; and then run Python inside it.&lt;/p&gt;&#xA;&lt;p&gt;What is the difference between the two? Termux&amp;rsquo;s Python packages are versions compiled for the Termux environment and run with native performance. But Termux is not a standard Linux environment, so some Python packages may not work.&lt;/p&gt;&#xA;&lt;p&gt;As for proot-distro, the environment is closer to a Linux system, so installing Python inside it has better compatibility, and Debian&amp;rsquo;s repositories have more ready-made Python packages available without relying on pip wheels. But proot-distro runs more slowly.&lt;/p&gt;&#xA;&lt;p&gt;This article focuses on the Termux environment.&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;3. How to install Python in Termux?&#xA;    &lt;div id=&#34;3-how-to-install-python-in-termux&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#3-how-to-install-python-in-termux&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Install &lt;a href=&#34;https://ivonblog.com/en-us/posts/how-to-use-termux/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Install Python and pip, including the Python-venv module:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pkg install python3 python-pip&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;Confirm the Python version. At the time of writing, it should be 3.12&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;python3 --version&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;The full path to the Python package executable is &lt;code&gt;$PREFIX/usr/bin/python3&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Packages installed by pip install go to &lt;code&gt;$PREFIX/lib/python3.x&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;According to &lt;a href=&#34;https://wiki.termux.com/wiki/Python&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux Wiki information&lt;/a&gt;, because Termux is rolling-release, Python always upgrades along with &lt;code&gt;pkg upgrade&lt;/code&gt;. After Python is upgraded to the next major version, packages installed by pip install have to be manually reinstalled.&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;4. Switch Python versions&#xA;    &lt;div id=&#34;4-switch-python-versions&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#4-switch-python-versions&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Because Termux is rolling-release, it only provides the latest version of Python packages. The path is &lt;code&gt;$PREFIX/usr/bin/python3&lt;/code&gt;. Packages installed with pip install also correspond to the Python version above.&lt;/p&gt;&#xA;&lt;p&gt;How do you switch Python versions? Although the Python version manager &amp;ldquo;uv&amp;rdquo; has a Termux package, its functionality is not normal. If you plan to install Anaconda, Termux probably cannot install it directly; it needs to be installed inside proot-distro. See &lt;a href=&#34;https://ivonblog.com/en-us/posts/android-termux-anaconda/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux proot-distro Anaconda&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So the remaining method is to use old Python versions provided by &lt;a href=&#34;https://ivonblog.com/en-us/posts/termux-tur-repo/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;TUR Repo&lt;/a&gt;. The Termux main repository cannot provide old Python versions, so TUR Repo fills that gap.&lt;/p&gt;&#xA;&lt;p&gt;For example, if the current version is Python 3.12 and you need the older Python 3.9, install it from TUR Repo:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pkg install tur-repo&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pkg search python3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pkg install python3.9&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;After installation, use the following path to execute it: &lt;code&gt;$PREFIX/usr/bin/python3.9&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;For example, &lt;code&gt;python3 main.py&lt;/code&gt; becomes &lt;code&gt;python3.9 main.py&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;To install Python packages for a specific version, use &lt;code&gt;python3.9 -m pip install &amp;lt;套件名稱&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;To create virtual environments for different versions, use &lt;code&gt;python3.9 venv -m venv&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;5. Tips for pip install&#xA;    &lt;div id=&#34;5-tips-for-pip-install&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#5-tips-for-pip-install&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Usually, to use external Python modules, you must install packages with pip install before you can import modules in Python programs.&lt;/p&gt;&#xA;&lt;p&gt;When installing Python packages, if the Termux repository has a packaged version (usually starting with &lt;code&gt;python-*&lt;/code&gt;), use &lt;code&gt;pkg install&lt;/code&gt; to install it from the Termux repository. If that does not work, then use &lt;code&gt;pip install&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Because the Termux environment is not exactly the same as a desktop Linux environment, pip install sometimes fails when it encounters packages that need wheel compilation. So I recommend using versions packaged by Termux developers.&lt;/p&gt;&#xA;&lt;p&gt;For example, the Pillow package can be installed from the Termux repository&lt;/p&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pkg install python-pillow&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;If you need an older version of Pillow, then consider installing it with pip install&lt;/p&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pip install &lt;span class=&#34;nv&#34;&gt;pillow&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;==&lt;/span&gt;9.5.0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;6. Install Vim and Python plugins&#xA;    &lt;div id=&#34;6-install-vim-and-python-plugins&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#6-install-vim-and-python-plugins&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Turn the text editor Vim into an environment suitable for editing Python.&lt;/p&gt;&#xA;&lt;p&gt;Install Vim:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pkg install vim&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;Search online for Vim basics. Termux provides many shortcut keys on the screen, enough for you to operate Vim and type.&lt;/p&gt;&#xA;&lt;p&gt;Vim itself only has very basic code highlighting, which may be a bit insufficient for editing Python programs. So install plugins to strengthen its functionality.&lt;/p&gt;&#xA;&lt;p&gt;There are many Vim plugins. How do you decide which ones to install? I think Real Python&amp;rsquo;s article &lt;a href=&#34;https://realpython.com/vim-and-python-a-match-made-in-heaven/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;VIM and Python – A Match Made in Heaven&lt;/a&gt; gives a very detailed explanation. The Vundle package manager mentioned there can also be installed in the Termux environment.&lt;/p&gt;&#xA;&lt;p&gt;However, the YouCompleteMe autocompletion system needs some patches before it works. See &lt;a href=&#34;https://gist.github.com/micjabbour/ef6181f9a2cf17f90a5744fcf909438a&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;How to install YouCompleteMe on Termux by micjabbour&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;7. Basic Python command-line execution&#xA;    &lt;div id=&#34;7-basic-python-command-line-execution&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#7-basic-python-command-line-execution&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Introducing how to write a simple Python program, then execute it with a command and output the result.&lt;/p&gt;&#xA;&lt;p&gt;If the Python program needs to write files, you need to understand Termux path conventions. See &lt;a href=&#34;https://ivonblog.com/en-us/posts/termux-file-management/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux Files Management&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It is recommended to create a project directory and put all Python programs used in the same directory&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mkdir project1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;cd&lt;/span&gt; project1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;(Optional) Create a Python virtual environment here to isolate it from system packages&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;python3 -m venv venv&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;source&lt;/span&gt; ./venv/bin/activate&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;Create a Python program file&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;touch main.py&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;4&#34;&gt;&#xA;&lt;li&gt;Edit the file with Vim&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;vim main.py&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;5&#34;&gt;&#xA;&lt;li&gt;Fill in simple Hello World code&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;print&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;Hello World!&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;5&#34;&gt;&#xA;&lt;li&gt;Run the program, and it should output the result.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;python3 main.py&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;8. Write Python with a graphical IDE&#xA;    &lt;div id=&#34;8-write-python-with-a-graphical-ide&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#8-write-python-with-a-graphical-ide&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;For this operation, a keyboard and mouse are recommended.&lt;/p&gt;&#xA;&lt;p&gt;Writing programs with a graphical IDE saves the trouble of typing commands.&lt;/p&gt;&#xA;&lt;p&gt;When talking about graphical IDEs, many people probably think of VS Code. Unfortunately, Termux only has the &lt;code&gt;code-server&lt;/code&gt; package, not the desktop version of VS Code.&lt;/p&gt;&#xA;&lt;p&gt;Although Termux provides the &lt;code&gt;code-server&lt;/code&gt; package, allowing you to run the web version of VS Code in the phone&amp;rsquo;s browser, I think that since you are already using a graphical interface, it is better to run a complete X server with Termux X11. This way, you can not only open VS Code, but also let Python programs use PyQT to draw windows.&lt;/p&gt;&#xA;&lt;p&gt;Considering that Termux does not include the desktop version of VS Code, I recommend &lt;a href=&#34;https://ivonblog.com/en-us/posts/visual-studio-code-termux/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;installing VS Code inside proot-distro&lt;/a&gt; and then starting the graphical interface.&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;9. Notes on using Python inside proot-distro&#xA;    &lt;div id=&#34;9-notes-on-using-python-inside-proot-distro&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#9-notes-on-using-python-inside-proot-distro&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;When you run the &lt;code&gt;proot-distro login&lt;/code&gt; command, Termux mounts its own PATH into it as well, so sometimes when running the python command, you may execute the Termux version instead of the version inside the container.&lt;/p&gt;&#xA;&lt;p&gt;How do you confirm? Use &lt;code&gt;which python&lt;/code&gt; and &lt;code&gt;which python3&lt;/code&gt; to confirm the Python path. If it is not &lt;code&gt;/usr/bin/python3&lt;/code&gt;, then you are executing the Termux version.&lt;/p&gt;&#xA;&lt;p&gt;Add the following content to &lt;code&gt;~/.bashrc&lt;/code&gt; inside proot-distro to solve this problem:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;alias&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;python&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;/usr/bin/python3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;alias&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;python3&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;/usr/bin/python3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;alias&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;pip&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;/usr/bin/pip&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;alias&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;pip3&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;/usr/bin/pip3&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;</content:encoded>
      <media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://ivonblog.com/en-us/posts/termux-python/featured.webp" />
    </item>
    
    <item>
      <title>Launch X11 apps from proot-distro on Termux&#39;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;&#xA;&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;&#xA;&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.&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/termux-desktop-with-proot-distro/images/tt.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &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;&#xA;&lt;/p&gt;&#xA;&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:&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://ivonblog.com/en-us/posts/termux-desktop-with-proot-distro/images/diagram-en-us.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    width=&#34;1024&#34;&#xA;      height=&#34;942&#34;&gt;&lt;/figure&gt;&#xA;&lt;/p&gt;</description>
      <content:encoded>&lt;!-- Co-translated by ChatGPT --&gt;&#xA;&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;&#xA;&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.&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/termux-desktop-with-proot-distro/images/tt.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &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;&#xA;&lt;/p&gt;&#xA;&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:&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://ivonblog.com/en-us/posts/termux-desktop-with-proot-distro/images/diagram-en-us.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    width=&#34;1024&#34;&#xA;      height=&#34;942&#34;&gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This usage is a bit like the Linux desktop container tool &lt;a href=&#34;https://ivonblog.com/posts/distrobox-usage/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Distrobox&lt;/a&gt;. It allows X11 graphical programs inside Docker to be displayed on the host desktop.&lt;/p&gt;&#xA;&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;&#xA;&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;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;1. Install a desktop environment for Termux&#xA;    &lt;div id=&#34;1-install-a-desktop-environment-for-termux&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#1-install-a-desktop-environment-for-termux&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;See &lt;a href=&#34;https://ivonblog.com/en-us/posts/termux-desktop-environment/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux Install XFCE4&lt;/a&gt;. For graphical display, either Termux X11 or VNC is fine.&lt;/p&gt;&#xA;&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;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pkg install xorg-xhost&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;Test whether the Termux desktop environment can start.&lt;/p&gt;&#xA;&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;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;2. Configure proot-distro&#xA;    &lt;div id=&#34;2-configure-proot-distro&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#2-configure-proot-distro&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;I installed &lt;a href=&#34;https://ivonblog.com/en-us/posts/termux-proot-distro-debian/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;proot Debian&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;It is recommended to add a normal user and configure Chinese localization inside proot-distro.&lt;/p&gt;&#xA;&lt;p&gt;Termux lacks the &lt;code&gt;locales&lt;/code&gt; package and cannot configure Chinese.&lt;/p&gt;&#xA;&lt;p&gt;Also install graphical programs inside proot-distro, such as LibreOffice:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo apt install libreoffice&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;3. Launch programs inside proot-distro from the Termux desktop&#xA;    &lt;div id=&#34;3-launch-programs-inside-proot-distro-from-the-termux-desktop&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#3-launch-programs-inside-proot-distro-from-the-termux-desktop&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&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;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;xhost +SI:localuser:&lt;span class=&#34;k&#34;&gt;$(&lt;/span&gt;whoami&lt;span class=&#34;k&#34;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&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;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&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;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&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;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;export&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;DISPLAY&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;:0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;libreoffice&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;4&#34;&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;You will then see the LibreOffice window start.&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/termux-desktop-with-proot-distro/images/Screenshot_20250411_005538.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Files on the Termux desktop can be dragged directly into the LibreOffice window to open them.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;But if you open the file picker from LibreOffice, by default you can only see directories inside proot-distro. However, because the Termux home directory was mounted above, the user&amp;rsquo;s home directory &lt;code&gt;/home&lt;/code&gt; inside proot-distro becomes shared with the Termux home directory.&lt;/p&gt;&#xA;&lt;p&gt;You can also read Android internal storage directories from &lt;code&gt;/sdcard&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;4. Add a graphical shortcut on the Termux desktop&#xA;    &lt;div id=&#34;4-add-a-graphical-shortcut-on-the-termux-desktop&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#4-add-a-graphical-shortcut-on-the-termux-desktop&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Make it a Desktop Entry, and you will not need to manually log in to proot-distro and type commands.&lt;/p&gt;&#xA;&lt;p&gt;XFCE has a quick way to generate a Deskop Entry: right-click the desktop -&amp;gt; Create Launcher&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/termux-desktop-with-proot-distro/images/Screenshot_20250411_005027.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Enter the following command in the Command section. Log in to Debian proot and start LibreOffice with bash.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;proot-distro login debian  --shared-tmp -- bash -c &lt;span class=&#34;s2&#34;&gt;&amp;#34;DISPLAY=:1 libreoffice&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;For the icon file, you can choose an image from any directory, but I choose to use the original one. Click Icon, select Image Files, open the file picker, and enter the path &lt;code&gt;/data/data/com.termux/files/var/lib/proot-distro/installed-rootfs/debian/usr/share/icons/hicolor/&lt;/code&gt;. Then you can find the icon files inside Termux proot-distro.&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/termux-desktop-with-proot-distro/images/Screenshot_20250411_005253.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Save it, double-click, and LibreOffice starts directly. Other programs can be handled the same way.&lt;/p&gt;&#xA;</content:encoded>
      <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&#39;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;&#xA;&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.&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/vncserver-termux/images/IMG_0357.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&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=&#34;https://ivonblog.com/en-us/posts/termux-x11/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux X11&lt;/a&gt;, &lt;a href=&#34;https://ivonblog.com/en-us/posts/android-xserver-xsdl/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;XSDL&lt;/a&gt;, and VNC.&lt;/p&gt;&#xA;&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;</description>
      <content:encoded>&lt;!-- Co-translated by ChatGPT --&gt;&#xA;&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.&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/vncserver-termux/images/IMG_0357.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&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=&#34;https://ivonblog.com/en-us/posts/termux-x11/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux X11&lt;/a&gt;, &lt;a href=&#34;https://ivonblog.com/en-us/posts/android-xserver-xsdl/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;XSDL&lt;/a&gt;, and VNC.&lt;/p&gt;&#xA;&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;&#xA;&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;&#xA;&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;&#xA;&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;&#xA;&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;&#xA;&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.&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/vncserver-termux/images/IMG_0360.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;VNC and Termux X11 can coexist and should not affect each other.&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;1. Choose a VNC client&#xA;    &lt;div id=&#34;1-choose-a-vnc-client&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#1-choose-a-vnc-client&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;On phones, I recommend &lt;a href=&#34;https://github.com/gujjwal00/avnc&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;AVNC&lt;/a&gt; or &lt;a href=&#34;https://www.realvnc.com/en/connect/download/viewer/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;RealVNC Viewer&lt;/a&gt;. The latter has more features, but it is proprietary software.&lt;/p&gt;&#xA;&lt;p&gt;On computers, I recommend &lt;a href=&#34;https://remmina.org/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Remmina&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;2. Configure the VNC server&#xA;    &lt;div id=&#34;2-configure-the-vnc-server&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#2-configure-the-vnc-server&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Choose one of the two.&lt;/p&gt;&#xA;&#xA;&lt;h3 class=&#34;relative group&#34;&gt;Run the VNC server directly in Termux&#xA;    &lt;div id=&#34;run-the-vnc-server-directly-in-termux&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#run-the-vnc-server-directly-in-termux&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h3&gt;&#xA;&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;&#xA;&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;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://ivonblog.com/en-us/posts/termux-desktop-environment/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Install the XFCE desktop&lt;/a&gt; for Termux, but do not install Termux X11.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Install the TigerVNC package. The current version is 1.13.0.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pkg install tigervnc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;Set the VNC server password&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;vncpasswd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;4&#34;&gt;&#xA;&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;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mkdir ~/.vnc/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;vim ~/.vnc/xstartup&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;5&#34;&gt;&#xA;&lt;li&gt;Fill in the following content&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;cp&#34;&gt;#!/bin/bash&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;unset&lt;/span&gt; SESSION_MANAGER&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;unset&lt;/span&gt; DBUS_SESSION_BUS_ADRESS&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Start the PulseAudio sound server; audio will come out from Termux&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pulseaudio --start --exit-idle-time&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;-1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pacmd load-module module-native-protocol-tcp auth-ip-acl&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;127.0.0.1 auth-anonymous&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;m&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Run the desktop environment, XFCE here&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;exec&lt;/span&gt; startxfce4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;6&#34;&gt;&#xA;&lt;li&gt;Grant execute permission to xstartup&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;chmod +x ~/.vnc/xstartup&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;7&#34;&gt;&#xA;&lt;li&gt;Define the VNC server configuration file. Edit &lt;code&gt;~/.vnc/tigervnc.conf&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;vim ~/.vnc/tigervnc.conf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;8&#34;&gt;&#xA;&lt;li&gt;Fill in the following content:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Current session XFCE&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;$session&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;xfce-session&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Resolution; higher values use more bandwidth&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;$geometry&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;1920x1080&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Bit depth, values are 8/16/24/32; larger numbers look better but use more bandwidth&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;$depth&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;32&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Allow external networks to connect&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;$localhost&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;no&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h3 class=&#34;relative group&#34;&gt;Run the VNC server inside proot-distro&#xA;    &lt;div id=&#34;run-the-vnc-server-inside-proot-distro&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#run-the-vnc-server-inside-proot-distro&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h3&gt;&#xA;&lt;p&gt;First install Termux proot-distro, such as &lt;a href=&#34;https://ivonblog.com/en-us/posts/termux-proot-distro-debian/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&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;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Log in to proot-distro and make sure you are currently a normal user, not root&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;whoami&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# If it is root, type su &amp;#34;username&amp;#34; to switch to a normal user&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;Install the TigerVNC package. The current version is 1.13.0&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo apt install tigervnc-standalone-server tigervnc-xorg-extension&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;Set the VNC server password&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;vncpasswd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;4&#34;&gt;&#xA;&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;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mkdir ~/.vnc/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;vim ~/.vnc/xstartup&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;5&#34;&gt;&#xA;&lt;li&gt;Fill in the following content&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;cp&#34;&gt;#!/bin/bash&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;unset&lt;/span&gt; SESSION_MANAGER&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;unset&lt;/span&gt; DBUS_SESSION_BUS_ADRESS&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Start the PulseAudio sound server; audio will come out from Termux&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;export&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;PULSE_SERVER&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;127.0.0.1 &lt;span class=&#34;o&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; pulseaudio --start --disable-shm&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;m&#34;&gt;1&lt;/span&gt; --exit-idle-time&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;-1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Run the desktop environment, XFCE here&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;exec&lt;/span&gt; startxfce4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;6&#34;&gt;&#xA;&lt;li&gt;Grant execute permission to xstartup&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;chmod +x ~/.vnc/xstartup&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;7&#34;&gt;&#xA;&lt;li&gt;Define the VNC server configuration file. Edit &lt;code&gt;~/.vnc/tigervnc.conf&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;vim ~/.vnc/tigervnc.conf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;8&#34;&gt;&#xA;&lt;li&gt;Fill in the following content:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Current session XFCE&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;$session&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;xfce-session&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Resolution; higher values use more bandwidth&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;$geometry&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;1920x1080&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Bit depth, values are 8/16/24/32; larger numbers look better but use more bandwidth&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;$depth&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;32&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Allow external networks to connect&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;$localhost&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;no&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;3. Connect to the VNC server&#xA;    &lt;div id=&#34;3-connect-to-the-vnc-server&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#3-connect-to-the-vnc-server&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Enter the &lt;code&gt;tigervncserver&lt;/code&gt; or &lt;code&gt;vncserver&lt;/code&gt; command in Termux to start the VNC server. Observe the port number output on the screen; it usually starts from 1. Since VNC server ports count from 5900, the port here is 5901&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/vncserver-termux/images/Screenshot_20231104-223649.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;h3 class=&#34;relative group&#34;&gt;Local connection&#xA;    &lt;div id=&#34;local-connection&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#local-connection&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h3&gt;&#xA;&lt;p&gt;For a local connection: open the AVNC app on the phone, add a host connection, enter &lt;code&gt;localhost&lt;/code&gt; for the address, and &lt;code&gt;5901&lt;/code&gt; for the port&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/vncserver-termux/images/Screenshot_20231104-223726.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;For AVNC operation, I recommend tapping the left button to switch to touchpad mode. If the Linux desktop font is too small, lower the resolution or adjust DPI in that desktop environment&amp;rsquo;s settings.&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/vncserver-termux/images/Screenshot_20231104-223934.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Remember that after exiting the VNC server connection, you need to return to Termux and stop the server; otherwise, the next start will run on a new port.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;vncserver -kill :1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h3 class=&#34;relative group&#34;&gt;Remote connection from a computer&#xA;    &lt;div id=&#34;remote-connection-from-a-computer&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#remote-connection-from-a-computer&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h3&gt;&#xA;&lt;p&gt;First put the phone and computer on the same Wi-Fi network&lt;/p&gt;&#xA;&lt;p&gt;In Termux, run &lt;code&gt;sudo apt install net-tools &amp;amp; ifconfig&lt;/code&gt; to get the phone&amp;rsquo;s local IP, and look at the Wlan line&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/vncserver-termux/images/Screenshot_20231104-224647.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Then in the Reminna address field on the computer, switch to VNC and enter &lt;code&gt;phone IP:5901&lt;/code&gt; to connect.&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/vncserver-termux/images/Screenshot_20231104_230813.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In Reminna, you can press the left button to fit the remote desktop size. Although typing can only use the remote input method, the clipboards on both sides synchronize automatically.&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/vncserver-termux/images/Screenshot_20231104_230608.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Remember that after exiting the VNC server connection, you need to return to Termux and stop the server; otherwise, the next start will run on a new port.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;vncserver -kill :1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;See also&#xA;    &lt;div id=&#34;see-also&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#see-also&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://ivonblog.com/posts/termux-x11/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux X11 Usage&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://ivonblog.com/posts/android-xserver-xsdl/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;XSDL Usage&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</content:encoded>
      <media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://ivonblog.com/en-us/posts/vncserver-termux/featured.webp" />
    </item>
    
    <item>
      <title>Use a phone as a computer: run desktop Linux software with iPad &#43; Android Termux</title>
      <link>https://ivonblog.com/en-us/posts/android-termux-as-linux-desktop-ipad-as-client/</link>
      <pubDate>Thu, 21 Nov 2024 21:00:00 +0800</pubDate>
      <author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author>
      <guid>https://ivonblog.com/en-us/posts/android-termux-as-linux-desktop-ipad-as-client/</guid>
      
      <description>&lt;!-- Co-translated by ChatGPT --&gt;&#xA;&lt;p&gt;iPad is too limited, Android is too tiny. So why not combine then together?&lt;/p&gt;&#xA;&lt;p&gt;Use Android + Termux Proot Debian + KasmVNC + Safari on the iPad to build a mobile working environment that runs desktop software.&lt;/p&gt;&#xA;&lt;p&gt;What the iPad cannot do, let the Android phone do!&lt;/p&gt;&#xA;&lt;p&gt;Use the Android phone as a computer through Termux Proot, run Linux desktop software, and control it through the iPad.&lt;/p&gt;&#xA;&lt;p&gt;The iPad remotes into the Linux container on Android for operation. What the iPad cannot do, let the Android phone do!&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/android-termux-as-linux-desktop-ipad-as-client/images/joplin.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;figcaption&gt;Joplin organizing notes&lt;/figcaption&gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/android-termux-as-linux-desktop-ipad-as-client/images/vscode.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;figcaption&gt;Visual Studio Code launching pygame&lt;/figcaption&gt;&lt;/figure&gt;&#xA;&lt;/p&gt;</description>
      <content:encoded>&lt;!-- Co-translated by ChatGPT --&gt;&#xA;&lt;p&gt;iPad is too limited, Android is too tiny. So why not combine then together?&lt;/p&gt;&#xA;&lt;p&gt;Use Android + Termux Proot Debian + KasmVNC + Safari on the iPad to build a mobile working environment that runs desktop software.&lt;/p&gt;&#xA;&lt;p&gt;What the iPad cannot do, let the Android phone do!&lt;/p&gt;&#xA;&lt;p&gt;Use the Android phone as a computer through Termux Proot, run Linux desktop software, and control it through the iPad.&lt;/p&gt;&#xA;&lt;p&gt;The iPad remotes into the Linux container on Android for operation. What the iPad cannot do, let the Android phone do!&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/android-termux-as-linux-desktop-ipad-as-client/images/joplin.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;figcaption&gt;Joplin organizing notes&lt;/figcaption&gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/android-termux-as-linux-desktop-ipad-as-client/images/vscode.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;figcaption&gt;Visual Studio Code launching pygame&lt;/figcaption&gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Do not understand what the title means? This is the usage scenario I want:&#xA;&#xA;&#xA;&#xA;&#xA;&lt;div style=&#34;position: relative; padding-bottom: 56.25%; overflow: hidden;&#34;&gt;&#xA;    &lt;iframe style=&#34;position: absolute; width: 100%; height: 100%;&#34;&#xA;        src=&#34;http://www.youtube.com/embed/voHH5BnVe0M&#34; allowfullscreen frameborder=&#34;0&#34; loading=&#34;lazy&#34;&gt;&#xA;    &lt;/iframe&gt;&#xA;&lt;/div&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;1. Motivation&#xA;    &lt;div id=&#34;1-motivation&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#1-motivation&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;My current mobile work setup is an Android phone paired with an iPad. Although they are different ecosystems, with the help of free software such as LocalSend, the two get along quite pleasantly. Thanks to the large battery of the Android phone, it seems I can share a hotspot to the iPad for 6 hours without running out of power.&lt;/p&gt;&#xA;&lt;p&gt;All of this is to run desktop software on the iPad. Some software is very smart on the desktop version, but becomes idiotic after being ported to mobile. This is true for both free software and proprietary software.&lt;/p&gt;&#xA;&lt;p&gt;Take the note-taking software Joplin, for example. Joplin on the iPad is only an enlarged iPhone version, with overly crude functionality, and many desktop features have not been ported, such as the note relationship graph. When dealing with notes, it always feels shackled, and many things have to be handled on a computer. So I started thinking about how to run desktop Joplin.&lt;/p&gt;&#xA;&lt;p&gt;Sell the iPad and switch to a Surface? I have thought about it, but I do not want to cut off my toes to fit the shoes, so I took out Termux on the Android phone. Termux can run a Linux desktop environment container without root, and it can be accessed by the iPad through VNC.&lt;/p&gt;&#xA;&lt;p&gt;I previously shared methods for mirroring Android to a large screen with &lt;a href=&#34;https://ivonblog.com/posts/scrcpy-for-ios/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Scrcpy&lt;/a&gt; and &lt;a href=&#34;https://ivonblog.com/posts/rustdesk-remote-control-phone-from-another-phone/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Rustdesk&lt;/a&gt;, but I do not need the entire Android screen! Linux alone is enough. Run the VNC server headlessly; as long as Android has enough RAM, it will not be easily killed in the background, so the Android phone can still be used while Linux programs are running.&lt;/p&gt;&#xA;&lt;p&gt;The iPad&amp;rsquo;s network is shared from Android, so the local connection latency for the remote desktop is low. The iPad becomes the screen for Android&amp;rsquo;s Linux container.&lt;/p&gt;&#xA;&lt;p&gt;If I could choose, the Android phone should be replaced with a Raspberry Pi. I have written about &lt;a href=&#34;https://ivonblog.com/posts/ipad-raspberrypi-usb-c-connection/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;using a Raspberry Pi with an iPad&lt;/a&gt;, after all, its I/O is more complete, and the Raspberry Pi&amp;rsquo;s size is also suitable for carrying around. But if the phone has a large battery and a powerful processor, why not use what is already there? For example, my Sony Xperia 10 V has only one third of the performance of an iPad Air 6, but it does not heat up when sharing a hotspot and has extremely long battery life, so let&amp;rsquo;s squeeze it a bit and run Linux on it!&lt;/p&gt;&#xA;&lt;p&gt;Hey, you say this is a bit putting the cart before the horse: the iPad is so powerful, yet it is only used as a remote desktop client, while all the heavy computation it should handle is pushed onto Android? Nothing I can do. Who told iOS to struggle even with running iSH Shell, and virtual machines still refuse to open up? So even if Android is slow, it can still run more diverse things than the iPad, and it is more computer-like than the iPad. When Android has been squeezed until it runs out of power, charge it from your iPad through Type-C.&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;2. Setup process&#xA;    &lt;div id=&#34;2-setup-process&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#2-setup-process&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;To simplify the login process, I use KasmVNC&amp;rsquo;s web VNC server solution, so no app needs to be prepared on the iPad side; a browser is enough to log in.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Configure &lt;a href=&#34;https://ivonblog.com/en-us/posts/termux-proot-distro-debian/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux Proot Debian&lt;/a&gt; and install the XFCE desktop&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Install the &lt;a href=&#34;https://ivonblog.com/posts/kasmvnc-setup&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;ARM64 KasmVNC package&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Start the KasmVNC server, add a user according to the instructions, and configure it to use XFCE&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;vncserver&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;4&#34;&gt;&#xA;&lt;li&gt;Start the KasmVNC server&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;vncserver&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;5&#34;&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Turn on the hotspot and share the network to the iPad&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Obtain Android&amp;rsquo;s local IP&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;ifconfig&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;7&#34;&gt;&#xA;&lt;li&gt;In Safari on the iPad, enter &lt;code&gt;https://手機區域IP:8444&lt;/code&gt;, log in to the account, and you can connect&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;3. Install software in Termux&amp;rsquo;s Linux&#xA;    &lt;div id=&#34;3-install-software-in-termuxs-linux&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#3-install-software-in-termuxs-linux&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Most free software has ARM64 packages, so you can install them with APT.&lt;/p&gt;&#xA;&lt;p&gt;For Joplin, I use &lt;a href=&#34;https://github.com/leaguecn/joplin-arm64-build&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;the deb package compiled by leaguecn&lt;/a&gt;. I happened to meet someone like-minded; he also runs desktop Joplin on Android!&lt;/p&gt;&#xA;&lt;p&gt;When launching Chromium-based software inside Proot, you need to edit the &lt;code&gt;Exec==&lt;/code&gt; option in &lt;code&gt;/usr/share/applications/*.desktop&lt;/code&gt; and add the &lt;code&gt;--no-sandbox&lt;/code&gt; parameter before it can start. Visual Studio Code is the same.&lt;/p&gt;&#xA;&lt;p&gt;Although iPadOS&amp;rsquo;s AssistiveTouch dot can emulate a touchpad, it is still recommended to connect a Bluetooth keyboard to operate the Linux desktop.&lt;/p&gt;&#xA;&lt;p&gt;Although KasmVNC can use the iOS input method to type Chinese, it is not very stable, so I install Fcitx5 input inside the Termux container.&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;4. Unresolved issues&#xA;    &lt;div id=&#34;4-unresolved-issues&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#4-unresolved-issues&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;It cannot stream Linux desktop audio to the iPad. KasmVNC alone cannot do it. Because iOS has no PulseAudio server, sound can only come from Termux on the Android side. But if you are outside, you probably will not casually blast music anyway; plugging in headphones solves it.&lt;/p&gt;&#xA;&lt;p&gt;As for the poor graphical efficiency of VNC, KasmVNC is already a server redesigned for modern technology. At least its quality is better than TigerVNC, so do not ask for too much.&lt;/p&gt;&#xA;&lt;p&gt;There is one option worth considering here: run an X server on the iPad, then project the Linux container&amp;rsquo;s screen through X11 Forwarding, similar to how Termux X11 is used, except remotely. But the only X Server app on the App Store, &lt;a href=&#34;https://apps.apple.com/tw/app/mocha-x11/id1440418243&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Mocha X11&lt;/a&gt;, is so expensive&amp;hellip; and when I tested the trial version, VirGL 3D acceleration had problems.&lt;/p&gt;&#xA;</content:encoded>
      <media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://ivonblog.com/en-us/posts/android-termux-as-linux-desktop-ipad-as-client/featured.webp" />
    </item>
    
    <item>
      <title>Manage auto-starting services: how to use Termux-services &amp; Termux:Boot</title>
      <link>https://ivonblog.com/en-us/posts/termux-services/</link>
      <pubDate>Mon, 18 Nov 2024 06:00:00 +0800</pubDate>
      <author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author>
      <guid>https://ivonblog.com/en-us/posts/termux-services/</guid>
      
      <description>&lt;!-- Co-translated by ChatGPT --&gt;&#xA;&lt;p&gt;Manage auto-startup services in Termux.&lt;/p&gt;&#xA;&lt;p&gt;Here I share two Termux extensions. The first is Termux-services, which manages services after the Termux app is started. The second is Termux:Boot, which configures Termux services to start automatically after Android boots.&lt;/p&gt;&#xA;&lt;p&gt;Why would you need Termux-services?&lt;/p&gt;&#xA;&lt;p&gt;If you want to start and stop services in Termux, and configure services to start automatically after opening the app, but Termux has no Systemd, are you stuck writing auto-start services into &lt;code&gt;~/.bashrc&lt;/code&gt; or &lt;code&gt;~/.profile&lt;/code&gt;, then killing processes with the &lt;code&gt;kill&lt;/code&gt; command when you want to stop them?&lt;/p&gt;&#xA;&lt;p&gt;At this point, Termux-services is a pretty good tool.&lt;/p&gt;</description>
      <content:encoded>&lt;!-- Co-translated by ChatGPT --&gt;&#xA;&lt;p&gt;Manage auto-startup services in Termux.&lt;/p&gt;&#xA;&lt;p&gt;Here I share two Termux extensions. The first is Termux-services, which manages services after the Termux app is started. The second is Termux:Boot, which configures Termux services to start automatically after Android boots.&lt;/p&gt;&#xA;&lt;p&gt;Why would you need Termux-services?&lt;/p&gt;&#xA;&lt;p&gt;If you want to start and stop services in Termux, and configure services to start automatically after opening the app, but Termux has no Systemd, are you stuck writing auto-start services into &lt;code&gt;~/.bashrc&lt;/code&gt; or &lt;code&gt;~/.profile&lt;/code&gt;, then killing processes with the &lt;code&gt;kill&lt;/code&gt; command when you want to stop them?&lt;/p&gt;&#xA;&lt;p&gt;At this point, Termux-services is a pretty good tool.&lt;/p&gt;&#xA;&lt;p&gt;Termux-services lets you use a set of commands to control service execution, so you can freely start and stop services. It is very useful for programs that need daemons, such as &lt;code&gt;sshd&lt;/code&gt;, &lt;code&gt;apache2&lt;/code&gt;, and &lt;code&gt;bitcoin&lt;/code&gt;, which can be started automatically through Termux-services after the Termux app opens.&lt;/p&gt;&#xA;&lt;p&gt;Termux-services uses &amp;ldquo;runit&amp;rdquo; to manage system services. This is a very simple init service manager, now used by only a small number of Linux distributions. Speaking of Linux distributions that use runit, the most famous are probably Artix Linux and Void Linux.&lt;/p&gt;&#xA;&lt;p&gt;First I will introduce how to use Termux-service, then explain how to use Termux: Boot.&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;1. Termux-services auto-start&#xA;    &lt;div id=&#34;1-termux-services-auto-start&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#1-termux-services-auto-start&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Install the Termux-services package&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pkg install termux-services&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;When installing some packages, Termux will also install runit service files. The files for all services are located at &lt;code&gt;$PREFIX/var/service/sv&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;For example, after installing the &lt;code&gt;openssh&lt;/code&gt; package, Termux-services will automatically install the SSHD service file. &lt;code&gt;$PREFIX/var/service/sv/sshd/run&lt;/code&gt; defines the command executed after the service starts, and &lt;code&gt;$PREFIX/var/service/sv/sshd/down&lt;/code&gt; defines the command executed after the service stops.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;To start and stop the SSHD service, use the following commands:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Start&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sv up sshd&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Stop&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sv down sshd&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Auto-start after opening the app &lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sv-enable sshd&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Disable auto-start after opening the app &lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sv-disable sshd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;5&#34;&gt;&#xA;&lt;li&gt;By analogy, if you want to execute other programs after Termux starts, create a service file in the same way. Refer to the &lt;a href=&#34;https://smarden.org/runit/runscripts&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;official runit templates&lt;/a&gt; when writing scripts. I will use running a custom script as an example:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Edit content&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;echo &amp;#39;Hello world&amp;#39; &amp;#34;&lt;/span&gt;&amp;gt;&amp;gt; ~/run.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;chmod +x ~/run.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Add service file&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;vim &lt;span class=&#34;nv&#34;&gt;$PREFIX&lt;/span&gt;/var/service/sv/myscript/run&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Fill in:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;bash ~/run.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Configure auto-start after starting the Termux app&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sv-enable myscript&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;2. Termux:Boot auto-start on boot&#xA;    &lt;div id=&#34;2-termuxboot-auto-start-on-boot&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#2-termuxboot-auto-start-on-boot&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Termux:Boot automatically executes the scripts you write after the Android system boots.&lt;/p&gt;&#xA;&lt;p&gt;Actually, you do not have to use it together with Termux-service. Termux:Boot can call Termux to execute arbitrary commands, but I think system services are better managed centrally. So the architecture becomes: first add the services you want to run through Termux-services, then use Termux:Boot to automatically start Termux, and all the services you wrote will start with it.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Install the Termux: Boot APK&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Tap the icon once to launch it, so it will start automatically after boot&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Create a directory in Termux and add a boot script&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mkdir -p ~/.termux/boot/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;vim ~/.termux/boot/run.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;4&#34;&gt;&#xA;&lt;li&gt;Fill in the following content to configure all runit auto-start services to run automatically after boot&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;cp&#34;&gt;#!/data/data/com.termux/files/usr/bin/sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;termux-wake-lock&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;. &lt;span class=&#34;nv&#34;&gt;$PREFIX&lt;/span&gt;/etc/profile&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;References&#xA;    &lt;div id=&#34;references&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#references&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://blog.csdn.net/YiBYiH/article/details/127294017&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux-services - Termux Wiki&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://wiki.termux.com/wiki/Termux:Boot&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux:Boot&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://wiki.artixlinux.org/Main/Runit&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Main / runit - Artix Wiki&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</content:encoded>
      
    </item>
    
    <item>
      <title>Running postmarketOS on Android Termux proot without flashing a custom rom</title>
      <link>https://ivonblog.com/en-us/posts/postmarketos-in-termux-proot/</link>
      <pubDate>Sat, 16 Nov 2024 21:00:00 +0800</pubDate>
      <author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author>
      <guid>https://ivonblog.com/en-us/posts/postmarketos-in-termux-proot/</guid>
      
      <description>&lt;p&gt;&lt;a href=&#34;https://ivonblog.com/posts/postmarketos-in-termux-proot/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;閱讀中文版&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Running postmarketOS and Phosh on Android phone without rooting or flashing a custom ROM.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve taken the unofficial and weird approach of running postmarketOS on Termux Proot, so that we can run mobile Linux on Android.&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/postmarketos-in-termux-proot/images/title1.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/postmarketos-in-termux-proot/images/title2.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;A video demonstration. Phosh + postmarketOS runs on Sony Xperia 10 V Android 14.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;div style=&#34;position: relative; padding-bottom: 56.25%; overflow: hidden;&#34;&gt;&#xA;    &lt;iframe style=&#34;position: absolute; width: 100%; height: 100%;&#34;&#xA;        src=&#34;http://www.youtube.com/embed/2O8DXNuinUs&#34; allowfullscreen frameborder=&#34;0&#34; loading=&#34;lazy&#34;&gt;&#xA;    &lt;/iframe&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;1. Motivation&#xA;    &lt;div id=&#34;1-motivation&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#1-motivation&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Why do I do this? To explore the possibilities of running mobile Linux on an Android phone. And we needed a desktop environment designed for touchscreens.&lt;/p&gt;</description>
      <content:encoded>&lt;p&gt;&lt;a href=&#34;https://ivonblog.com/posts/postmarketos-in-termux-proot/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;閱讀中文版&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Running postmarketOS and Phosh on Android phone without rooting or flashing a custom ROM.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve taken the unofficial and weird approach of running postmarketOS on Termux Proot, so that we can run mobile Linux on Android.&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/postmarketos-in-termux-proot/images/title1.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;img&#xA;    class=&#34;my-0 rounded-md&#34;&#xA;    loading=&#34;lazy&#34;&#xA;    decoding=&#34;async&#34;&#xA;    fetchpriority=&#34;low&#34;&#xA;    alt=&#34;&#34;&#xA;    src=&#34;https://static.ivonblog.com/posts/postmarketos-in-termux-proot/images/title2.webp&#34;&#xA;    onerror=&#34;this.onerror=null;this.src=&#39;https://ivonblog.com/images/unable-to-load-the-image-pepe.webp&#39;&#34;&#xA;    &gt;&lt;/figure&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;A video demonstration. Phosh + postmarketOS runs on Sony Xperia 10 V Android 14.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;div style=&#34;position: relative; padding-bottom: 56.25%; overflow: hidden;&#34;&gt;&#xA;    &lt;iframe style=&#34;position: absolute; width: 100%; height: 100%;&#34;&#xA;        src=&#34;http://www.youtube.com/embed/2O8DXNuinUs&#34; allowfullscreen frameborder=&#34;0&#34; loading=&#34;lazy&#34;&gt;&#xA;    &lt;/iframe&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;1. Motivation&#xA;    &lt;div id=&#34;1-motivation&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#1-motivation&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Why do I do this? To explore the possibilities of running mobile Linux on an Android phone. And we needed a desktop environment designed for touchscreens.&lt;/p&gt;&#xA;&lt;p&gt;It&amp;rsquo;s my personal wish to run mobile Linux on my Sony Xperia 5 &amp;amp; 10 series, but not many people have ported postmarketOS for them, and I didn&amp;rsquo;t succeed myself. So I&amp;rsquo;m just using Termux to taste the sweetness of the mobile Linux OS. I would like to share this highly experimental method of running postmarketOS on Android with you.&lt;/p&gt;&#xA;&lt;p&gt;postmarketOS is a GNU/Linux system designed for out-of-season mobile phones. Based on Alpine Linux, it has full Linux functionality and is able to run Linux pc applications, and it has become one of the most popular distro choice among PinePhone users. However, postmarketOS is not available for all Android phones, see &lt;a href=&#34;https://ivonblog.com/posts/postmarketos-general-installation/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;postmarketOS pmbootstrap installation instruction&lt;/a&gt;. In order to port a postmarketOS to an Android phone, you need to pacth the Linux kernel a lot, and since many drivers are not compatible between Android and Linux, it is more difficult to create a postmarketOS ROM than to port LineageOS. Even if you finally get it up and running, there will be lots of missing proprietary drivers, which makes the system unpleasant to use.&lt;/p&gt;&#xA;&lt;p&gt;Moreover, the entry barrier for installing postmarketOS is very high, and for many mobile phone users, they can&amp;rsquo;t even unlock the bootloader, so it&amp;rsquo;s impossible to flash a custom ROM. This makes Termux a good option to consider, as it allows you to run Linux containers on your Android without rooting, and display the Linux container X server screen with Termux X11. The first question we have to ask is whether pmbootstrap can be run on Termux. According to &lt;a href=&#34;https://github.com/termux/termux-packages/issues/4333&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;this Github issue&lt;/a&gt;, chroot is hard to run on Android without rooting. So we use a slower proot instead.&lt;/p&gt;&#xA;&lt;p&gt;Termux provides rootfs for Alpine Linux, and postmarketOS is originally based on Alpine Linux, so if you do a little trick to convert Alpine Linux to postmarketOS, you can get those packages designed for mobile Linux. Why don&amp;rsquo;t we use Alpine Linux directly, because some packages of postmarketOS are not being upstreamed, some packages are not found in Alpine Linux&amp;rsquo;s repsitory.&lt;/p&gt;&#xA;&lt;p&gt;Finally, let&amp;rsquo;s talk about &lt;a href=&#34;https://phosh.mobi/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Phosh&lt;/a&gt;, a desktop environment developed by Purism, a free software company, designed for Linux phones. Its Wayland compositor, Phoc, is based on wlroots. In the PinePhone community, Phosh is one of the best rated interfaces. According to my personal experience of using PinePhone, I think Phosh is the most stable interface although the interface is very simple, and Phosh is very resource-saving. The animation of Phosh is still very smooth even running on the underpowered PinePhone which equipped with Allwinner A64 processor. I think Phosh is very useful for users who want to interact with Linux system in Termux X11. Because most Android phones don&amp;rsquo;t have keyboard and mouse, so if you run XFCE, KDE Plasma, GNOME and other traditional Linux desktops in Termux X11, it would be very awkward. So that , the touchscreen-optimized Phosh would be an excellent choice.&lt;/p&gt;&#xA;&lt;p&gt;However, you may ask, Phosh is a Wayland compositor, how can it run on Termux X11? Although we cannot use Wayland directly, the nested Wayland session under X11 is still possible. Some compositors can do this, such as &lt;a href=&#34;https://gitlab.freedesktop.org/wayland/weston&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Weston&lt;/a&gt; or &lt;a href=&#34;https://github.com/cage-kiosk/cage&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Cage&lt;/a&gt;. Some features of Wayland can still be used even running under X11 environment. However, simply running cage will result in an incomplete X session and no way to detect the resolution of the phone. So before running cage, I will start a X window manager in the first place. I choose Openbox for performance-wise.&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;2. Prerequisites&#xA;    &lt;div id=&#34;2-prerequisites&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#2-prerequisites&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://ivonblog.com/en-us/posts/how-to-use-termux/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://ivonblog.com/en-us/posts/termux-x11/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Termux X11&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://ivonblog.com/en-us/posts/termux-virglrenderer/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;virglrenderer&lt;/a&gt;: Optional hardware acceleration.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://f-droid.org/packages/org.pocketworkstation.pckeyboard/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Hacker&amp;rsquo;s keyboard&lt;/a&gt;: For interacting with the desktop environment. It can simulate PC keyboard inputs which would be very useful.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;3. Install Proot Alpine Linux&#xA;    &lt;div id=&#34;3-install-proot-alpine-linux&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#3-install-proot-alpine-linux&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;postmarketOS provides two updating channels, Edge and Stable. The version number of Stable channel can be found in &lt;a href=&#34;https://wiki.postmarketos.org/wiki/Releases&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Wiki&lt;/a&gt;, currently it is v24.06.&lt;/p&gt;&#xA;&lt;p&gt;The default Alpine Linux of Termux proot uses Edge branch, but this branch is unstable, so I suggest to switch it to Alpine 3.20 (corresponding to postmarketOS v24.06).&lt;/p&gt;&#xA;&lt;p&gt;P.S. At the time of writing, I am using Edge repo for getting latest packages in order to make Phosh launch through Cage. But for stability, you may choose the stable channel.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Start Termux and install proot Alpine Linux.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pkg update&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pkg install proot-distro pulseaudio&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;proot-distro install alpine&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;Change the Alpine Linux repository from Edge to v3.20.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;proot-distro login alpine --shared-tmp&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;apk update&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;apk add vim&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;vim /etc/apk/repositories&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Change &amp;#34;http://dl-cdn.alpinelinux.org/alpine/edge/main&amp;#34; to &amp;#34;http://dl-cdn.alpinelinux.org/alpine/v3.20/main&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Change &amp;#34;http://dl-cdn.alpinelinux.org/alpine/edge/community&amp;#34; to &amp;#34;http://dl-cdn.alpinelinux.org/alpine/v3.20/community&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;apk update&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;apk upgrade&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;Add a new user, add it to sudo group, and set the timezone&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;apk add sudo&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;addgroup storage&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;adduser -g wheel,storage,video,audio user&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;visudo&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo setup-timezone&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;4&#34;&gt;&#xA;&lt;li&gt;Enable SSH remote connection in Termux proot.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo vim /etc/ssh/sshd_config&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Change `Port` from 22 to 8023&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;ssh-keygen -A&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;rc-update add sshd&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;rc-serive sshd start&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Check the IP address.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;ip addr&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;4. Convert Alpine Linux installtion to postmarketOS&#xA;    &lt;div id=&#34;4-convert-alpine-linux-installtion-to-postmarketos&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#4-convert-alpine-linux-installtion-to-postmarketos&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Add the postmarketOS v24.06 (Alpine v3.20) repository.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;vim /etc/apk/repositories&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Add this line at the top:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;https://mirror.postmarketos.org/postmarketos/v24.06&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# For your reference, the url of the Edge channel is: https://mirror.postmarketos.org/postmarketos/master/&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;Install postmarketos-keys&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;apk add -u --allow-untrusted postmarketos-keys&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;apk update &lt;span class=&#34;o&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; apk upgrade&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;Add the following lines to &lt;code&gt;/etc/os-release&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;PRETTY_NAME&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;postmarketOS v24.06&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;NAME&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;postmarketOS&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;VERSION_ID&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;v24.06&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;VERSION&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;v24.06&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;ID&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;postmarketos&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;ID_LIKE&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;alpine&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;HOME_URL&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;https://www.postmarketos.org/&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;SUPPORT_URL&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;https://gitlab.com/postmarketOS&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;BUG_REPORT_URL&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;https://gitlab.com/postmarketOS/pmaports/issues&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;LOGO&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;postmarketos-logo&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;5. Installing Phosh desktop environment&#xA;    &lt;div id=&#34;5-installing-phosh-desktop-environment&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#5-installing-phosh-desktop-environment&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Install Openbox and Cage:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo apk add openbox cage&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;The Phosh package name is &lt;code&gt;postmarketos-ui-phosh&lt;/code&gt;. It is recommended to install some of the mobile device packages made by postmarektOS along with it:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo apk add postmarketos-ui-phosh &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;postmarketos-tweaks &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;firefox &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mobile-config-firefox &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;font-noto &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;font-noto-cjk &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;font-noto-cjk-extra &lt;span class=&#34;se&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;font-noto-emoji&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;6. Launch Termux X11 and Phosh&#xA;    &lt;div id=&#34;6-launch-termux-x11-and-phosh&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#6-launch-termux-x11-and-phosh&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;The inspiration to start Phosh in proot comes from &lt;a href=&#34;https://github.com/pothos/phosh-vnc&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;phosh-vnc&lt;/a&gt; and &lt;a href=&#34;https://github.com/dw5/termux-phosh/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;termux-phosh&lt;/a&gt;, although running it with WayVNC is one way, why not make good use of Termux X11 for better performance?&lt;/p&gt;&#xA;&lt;p&gt;The process of starting Phosh desktop is as follows: start PulseAudio audio server on Termux side, start Termux X11, then log in to Proot Alpine, start Openbox, cage and Phosh.&lt;/p&gt;&#xA;&lt;p&gt;The whole process is as follows:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Luanch Termux and start Pulse Audio&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pulseaudio --start --exit-idle-time&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;-1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pacmd load-module module-native-protocol-tcp auth-ip-acl&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;127.0.0.1 auth-anonymous&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;m&#34;&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;Luanch Termux X11 APP and start Termux X11 in Termux&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;export&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;DISPLAY&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;:0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;termux-x11 :0 &lt;span class=&#34;p&#34;&gt;&amp;amp;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;Start virglrenderer&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;virgl_test_server_android &lt;span class=&#34;p&#34;&gt;&amp;amp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;4&#34;&gt;&#xA;&lt;li&gt;Log into Alpine Linux&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;proot-distro login alpine --user user --shared-tmp&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;5&#34;&gt;&#xA;&lt;li&gt;Launch Openbox, cage, Phosh&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;export&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;DISPLAY&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;:0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;export&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;XDG_RUNTIME_DIR&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;/tmp&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;openbox &lt;span class=&#34;p&#34;&gt;&amp;amp;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;cage phoc -E &lt;span class=&#34;s1&#34;&gt;&amp;#39;/usr/libexec/phosh&amp;#39;&lt;/span&gt; -U &lt;span class=&#34;p&#34;&gt;&amp;amp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;6&#34;&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;In Termux X11 wait for the Openbox window to come out, double click on the title bar to maximize it.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Tap Preferences in your phone&amp;rsquo;s notification bar and set Termux X11&amp;rsquo;s Output to Scaled to zoom in to a size that fits your phone.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;img src=&#34;https://static.ivonblog.com/posts/postmarketos-in-termux-proot/images/Screenshot_20241116-194431.webp&#34; width=300&gt;&#xA;&lt;ol start=&#34;8&#34;&gt;&#xA;&lt;li&gt;And change the Termux X11 Pointer to Direct Touch to simulate a touch screen.&#xA;&lt;img src=&#34;https://static.ivonblog.com/posts/postmarketos-in-termux-proot/images/Screenshot_20241116-194435.webp&#34; width=300&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;7. Phosh user experience&#xA;    &lt;div id=&#34;7-phosh-user-experience&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#7-phosh-user-experience&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Most of the touch gestures work. The control logic of Phosh is to swipe up from the bottom to view all the tasks, and swipe up to close the app window.&lt;/p&gt;&#xA;&lt;p&gt;Note Phosh in proot is not a full Linux environment, so some functions are not available.&lt;/p&gt;&#xA;&lt;p&gt;For example, Phosh uses GNOME Control Center to adjust system settings, but the GUI app cannot be opened, so many places have to be changed with commands. For example, to modify the file manager Portfolio to open the app with a specific file format preset, you should use &lt;code&gt;xdg-mime&lt;/code&gt; to modify it. Also GNOME Software doesn&amp;rsquo;t work, please use &lt;code&gt;apk&lt;/code&gt; command to install the apps.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;p&gt;Regarding Chinese input methods: Phosh&amp;rsquo;s built-in Squeekboard only supports English. Press and hold the bar at the bottom of Phosh to activate it (it seems that it doesn&amp;rsquo;t work in proot environment). In order to type Chinese, you&amp;rsquo;ll have to use your Android phone&amp;rsquo;s keyboard.&lt;/p&gt;&#xA;&lt;p&gt;You can wake Android keyboard by pressing the back button in the Termux X11 APP. And then scroll the toolbar at the bottom to left to type charcters.&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;8. Let&amp;rsquo;s try other desktop environments?&#xA;    &lt;div id=&#34;8-lets-try-other-desktop-environments&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#8-lets-try-other-desktop-environments&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Besides Phosh, the desktop environments of postmarketOS are Plasma Mobile and SXMO, but I think they have more problems, one is unstable and the other is too complicated.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Plasma Mobile&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Plasma Mobile is a desktop envrionment based on the PC version of KDE Plasma, which can be launched with X11 or Wayland backend.&lt;/p&gt;&#xA;&lt;p&gt;Personally, I think this desktop envrionment is very unstable, so it is better to use the PC version of KDE Plasma.&lt;/p&gt;&#xA;&lt;p&gt;Packages name: &lt;code&gt;postmarketos-ui-plasma-mobile&lt;/code&gt;。Launch in X11: &lt;code&gt;startplasma-x11&lt;/code&gt;. Launch in Wayland: &lt;code&gt;startplasma-wayland&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can start Plasma Mobile X11 session by: &lt;code&gt;dbus-launch --exit-with-session startplasma-x11 &amp;amp;&lt;/code&gt;&lt;/p&gt;&#xA;&lt;img src=https://static.ivonblog.com/posts/postmarketos-in-termux-proot/images/Screenshot-20230124-121215.webp width=300&gt;&#xA;&lt;p&gt;&lt;strong&gt;SXMO&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The package name is &lt;code&gt;postmarketos-ui-sxmo&lt;/code&gt; but Termux X11 only support X server so I choose &lt;code&gt;postmarketos-ui-sxmo-de-dwm&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Install SXMO packages&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo apk add postmarketos-ui-sxmo-de-dwm postmarketos-tweaks-sxmo-x11 feh dwm svkbd conky clickclack&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Execute: &lt;code&gt;export XDG_RUNTIME_DIR=/tmp&lt;/code&gt; before launching SXMO.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;SXMO can be launched by executing &lt;code&gt;dbus-launch --exit-with-session /usr/bin/sxmo_xinit.sh &amp;amp;&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The configuration files of SXMO is located at &lt;code&gt;~/.config/sxmo/&lt;/code&gt;. Hooks are at &lt;code&gt;/usr/share/sxmo/default_hooks/&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Gestures are not working.&#xA;&lt;img src=https://static.ivonblog.com/posts/postmarketos-in-termux-proot/images/Screenshot-20230124-132311.webp width=300&gt;&lt;/p&gt;&#xA;&lt;p&gt;You may modify dwm source code to change default keybindings.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight-wrapper&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;git clone git@git.sr.ht:~mil/sxmo-dwm&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Modify config.def.h then reinstall dwm&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;Uninstall &lt;code&gt;sxmo-dwm&lt;/code&gt; package before installing your cutsom dwm.&lt;/p&gt;&#xA;&lt;p&gt;Or you can just install vanilla &lt;code&gt;dwm&lt;/code&gt; package and use default dwm keybindings.&lt;/p&gt;&#xA;&#xA;&lt;h2 class=&#34;relative group&#34;&gt;References&#xA;    &lt;div id=&#34;references&#34; class=&#34;anchor&#34;&gt;&lt;/div&gt;&#xA;    &#xA;    &lt;span&#xA;        class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none&#34;&gt;&#xA;        &lt;a class=&#34;text-primary-300 dark:text-neutral-700 !no-underline&#34; href=&#34;#references&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&#xA;    &lt;/span&gt;&#xA;    &#xA;&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/pothos/phosh-vnc&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;pothos/phosh-vnc - Github&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/dw5/termux-phosh/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;dw5/termux-phosh - Github&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://wiki.postmarketos.org/wiki/Existing_Alpine_installation&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Existing Alpine installation - postmarketOS Wiki&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://wiki.postmarketos.org/wiki/Phosh&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Phosh - postmarketOS Wiki&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://wiki.postmarketos.org/wiki/Plasma_Mobile&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Plasma Mobile#Starting Plasma Mobile from the Terminal - postmarketOS Wiki&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://phosh.mobi/posts/phosh-dev-part-0/&#34;  target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Developing for Mobile Linux with Phosh - Part 0: Running nested&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</content:encoded>
      <media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://ivonblog.com/en-us/posts/postmarketos-in-termux-proot/featured.webp" />
    </item>
    
  </channel>
</rss>
