Skip to content

Instantly share code, notes, and snippets.

@heartnn
Forked from onlurking/arch.md
Created September 22, 2018 05:07
Show Gist options
  • Save heartnn/89a3f60955a2d056b56313a3583149a8 to your computer and use it in GitHub Desktop.
Save heartnn/89a3f60955a2d056b56313a3583149a8 to your computer and use it in GitHub Desktop.
Arch Linux chroot on Termux

Arch Linux

chroot on Termux

Let's download the Arch ARM image with the text-browser w3m and install proot:

apt install w3m proot
w3m http://archlinuxarm.org/os/ArchLinuxARM-utilite-latest.tar.gz
cd ~ && mkdir .arch && cd .arch && mv ../ArchLinuxARM-utilite-latest.tar.gz .

We extract the image,

tar xvf ArchLinuxARM-utilite-latest.tar.gz || chmod -R 777 . && tar xvf ArchLinuxARM-utilite-latest.tar.gz 

Add to .bashrc or .zshrc:

alias arch="proot --link2symlink -0 -r ~/.arch -b /dev/ -b /sys/ -b /proc/ -b $HOME /bin/env -i HOME=/root

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

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