Skip to content

Instantly share code, notes, and snippets.

@onlurking
Last active November 27, 2022 21:29
Show Gist options
  • Select an option

  • Save onlurking/48e251f88ea426ee87792caeb9175fd5 to your computer and use it in GitHub Desktop.

Select an option

Save onlurking/48e251f88ea426ee87792caeb9175fd5 to your computer and use it in GitHub Desktop.
Arch Linux on Termux

Arch Linux

chroot on Termux

Let's download the Arch ARM image with curl and install proot:

apt install curl proot

Let's download the ARM Arch Linux image:

curl -L http://archlinuxarm.org/os/ArchLinuxARM-utilite-latest.tar.gz -o arch.tar.gz

Create a directory and move the image there:

cd ~ && mkdir .arch && cd .arch && mv ../arch.tar.gz .

Then we will extract the image:

tar xvf arch.gz || chmod -R 777 . && tar xvf arch.tar.gz 

If you get this error:

Permission denied
tar: write: Broken pipe

just run the command above again.

Add to .bashrc or .zshrc:

alias arch='unset LD_PRELOAD && proot --link2symlink -0 -r ~/.arch -b /dev/ -b /sys/ -b /proc/ -b /storage/ -b $HOME -w $HOME /bin/env -i HOME=/root TERM="$TERM" PS1='λ [\W] ' LANG=$LANG PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/sh'

run arch, inside the Arch chroot for striping it down:

pacman -Rns lvm2 linux-firmware linux-utilite systemd systemd-sysvcompat libusb netctl dhcpcd device-mapper usbutils libpcap iptables cryptsetup iproute2 xfsprogs s-nail reiserfsprogs pciutils licenses gettext man-db jfsutils procps-ng mdadm haveged inetutils psmisc logrotate sysfsutils iputils texinfo diffutils net-tools 

Uncomment the locale:

vi /etc/locale.gen

echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen

And then generate:

locale-gen

Network doesn't work out of box, to fix it:

rm /etc/resolv.conf && vi /etc/resolv.conf

And put inside the file:

nameserver 8.8.8.8
nameserver 4.4.4.4

Let's fix the encoding also:

vi /etc/locale.conf
LC_ALL=en_US.UTF-8 
LANG=en_US.UTF-8 
LANGUAGE=en_US.UTF-8

Also, let's fix some permissions:

chmod 755 -R /etc /usr /var /boot /home /mnt /opt /run /srv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment