Skip to main content

An experiment of running postmarketOS on Android with Termux Proot

Categories   Smartphone Termux Tutorial
Tags   PostmarketOS Termux
Table of Contents

中文版

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

1. Prerequisites
#

2. Install Proot Alpine Linux
#

The Stable Channel version number of postmarketOS can be found in Wiki. Currently it is v22.12.

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

  1. Install Proot Alpine Linux
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
proot-distro login alpine --shared-tmp
apk add vim
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.
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.
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 (Alpine v3.17) repositories
vim /etc/apk/repositories

# Add this:
https://mirror.postmarketos.org/postmarketos/v22.12
  1. Add postmarketos-keys
apk add -u --allow-untrusted postmarketos-keys
apk update && apk upgrade
  1. Add following lines to /etc/os-release
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 environment> &: Start desktop environment

Traditional desktops, such as XFCE and LXQT work in proot environment; nevertheless I want to try mobile-friendly interfaces, let’s see the results.

Phosh
#

Phosh is a fork of GNOME, optimized for mobile devices.

The package name is postmarketos-ui-phosh.

The startup command is phosh-session. Not working. Maybe the X11 beckend flag needs to be passed?

Plasma Mobile
#

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

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

Login screen works, but it turns black after login.

BTW, in 2022, I had successfully started Plasma Mobile in Proot Arch Linux (the package plasma-mobile is available on AUR); however it was very unstable.

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
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.

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.

Related

How to play Minecraft Java Edition on Android using Termux proot
Categories   Smartphone Termux Tutorial
Tags   Raspberry Pi Minecraft Termux
Fix [Process completed (signal 9) - press Enter] for Termux on Android 12+ devices
Categories   Smartphone Termux Tutorial
Tags   Termux
Run Windows exe on Android through Proot Exagear on Termux
Categories   Smartphone Termux Tutorial
Tags   Termux Windows Android

Leave a comment

Choose the comment 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 forcing Disqus ADs on this page. Sometimes your comment may need to be reviewed, resulting in delayed display. Thank you for your understanding.