An experiment of running postmarketOS on Android with Termux Proot

Running postmarketOS on any Andrid devices without rooting or flashing ROM.

1. Prerequisites

2. Install Proot Alpine Linux

The defaut installation of Proot Apline in Termux-poort is using edge repositories. However Edge branch is very unstable, therefore I choose 3.17 (postmarketOS v22.12)

  1. Install Proot Alpine
1
2
3
4
pkg update
pkg install proot-distro pulseaudio
echo "pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 && pacmd load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1 " >> .profile
proot-distro install alpine
  1. Change repositories to v3.17
1
2
3
4
5
6
proot-distro login alpine --shared-tmp
vim /etc/apk/repositories
# Change "http://dl-cdn.alpinelinux.org/alpine/edge/main" to "http://dl-cdn.alpinelinux.org/alpine/v3.17/main"

apk update
apk upgrade
  1. Add a user and setup timezone.
1
2
3
4
5
6
7
8
9
apk add sudo

addgroup storage
adduser -g wheel,storage,video,audio user
visudo
passwd

sudo ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime
sudo setup-timezone
  1. Enable sshd in Termux proot.
1
2
3
4
5
6
7
8
sudo vim /etc/ssh/sshd_config
# Change `Port` from 22 to 8023

ssh-keygen -A
/usr/sbin/sshd
echo "/usr/sbin/sshd" >> /home/user/.profile
# Check IP address
ip addr

3. Convert Alpine installation to postmarketOS

  1. Add postmarketOS v22.12 (Aplpine v3.17) repositories
1
2
3
4
vim /etc/apk/repositories

# Add this:
https://mirror.postmarketos.org/postmarketos/v22.12
  1. Add postmarketos-keys
1
2
apk add -u --allow-untrusted postmarketos-keys
apk update && apk upgrade
  1. Edit /etc/os-release. Add following lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
PRETTY_NAME="postmarketOS v22.12"
NAME="postmarketOS"
VERSION_ID="v22.12"
VERSION="v22.12"
ID="postmarketos"
ID_LIKE="alpine"
HOME_URL="https://www.postmarketos.org/"
SUPPORT_URL="https://gitlab.com/postmarketOS"
BUG_REPORT_URL="https://gitlab.com/postmarketOS/pmaports/issues"
LOGO="postmarketos-logo"

4. Install Deskop Environment

To launch a desktop Environment in Termux proot, execute the following commands:

  1. proot-distro login --user user --shared-tmp: Log into Proot
  2. termux-x11 &: Start X server
  3. export DISPLAY=:0
  4. dbus-launch --exit-with-session <desktop nvironment> &: Start desktop environment

Phosh

The packae name is postmarketos-ui-phosh.

Not working.

Plasma Mobile

The packae name is postmarketos-ui-plasma-mobile.

Can be launched by executing dbus-launch --exit-with-session startplasma-x11 &

Login screen works. But it turns black after login.

In 2022, I tried to start Plasma Mobile in Proot Arch Linux and it worked (plasma-mobile is available on AUR). It was much unstable than Plasma desktop.

SXMO

The package name is postmarketos-ui-sxmo but Termux X11 only support X applications so I choose postmarketos-ui-sxmo-de-dwm.

  1. Install SXMO packages
1
sudo apk add postmarketos-ui-sxmo-de-dwm postmarketos-tweaks-sxmo-x11 feh dwm svkbd conky clickclack
  1. Execute: export XDG_RUNTIME_DIR=/tmp before launching SXMO.

  2. SXMO can be launched by executing dbus-launch --exit-with-session /usr/bin/sxmo_xinit.sh &

  3. The configuration files of SXMO is located at ~/.config/sxmo/. Hooks are at /usr/share/sxmo/default_hooks/.

Gestures are not working.

You may modify dwm source code to change default keybindings.

1
2
git clone [email protected]:~mil/sxmo-dwm
# Modify config.def.h then reinstall dwm

Uninstall sxmo-dwm package before installing your cutsom dwm.

Or you can just install vanilla dwm package and use default dwm keybindings.

Wake up hacker’s keyboard in Termux, then click Termux X11 at notification bar to keep keyboard displaying in Termux X11.


Thanks for your reading. You are welcome to share articles of Ivon's Blog (ivonblog.com). Please include the original URL when reprinting or citing articles, and abide by CC BY-NC-ND 4.0 license. For commercial use, please write an e-mail to me.

written by human, not by AI

If this article is helpful to you please consider supporting me.

Leave a comment

Choose the commenting system you like. Giscus for codes, Disqus for anonymous comments.

Please login to your Github account to leave a comment. You can post codes here for discussion. For images, please upload to Imgur and copy links. Your comments would be visible to everyone on Github Discussions.

This comment system is provided by Disqus, you may see some Disqus ADs on this page. You can leave a comment anonymously but you won't receive reply notifications.