Skip to content

Instantly share code, notes, and snippets.

@RebelLion420
Last active October 3, 2025 13:34
Show Gist options
  • Select an option

  • Save RebelLion420/bd1c94e320c0c6c56e33a1dc75e5f4a2 to your computer and use it in GitHub Desktop.

Select an option

Save RebelLion420/bd1c94e320c0c6c56e33a1dc75e5f4a2 to your computer and use it in GitHub Desktop.
How to set up Arch Linux in Termux on Android

So, to get started you need to get the base OS installed using the instructions from the official docs .

pkg update

pkg install bsdtar wget proot tergent tmux openssh

Tmux is a multiplexer that lets you run multiple persistent windows and sessions on a single terminal. I had trouble getting it working in the Arch proot, so a workaround is configuring tmux from your host Termux and then creating a tmux session and starting the chroot from there. For more information on using tmux read this article, and to learn how to customize the appearance and behaviors more try this one as well as looking at the tmux-plugins Github organization for community-built add-ons.

termux-setup-storage

wget https://raw.githubusercontent.com/SDRausty/termux-arch/master/setupTermuxArch.bash

bash setupTermuxArch.bash

This should download and install the Arch system. The install itself will take around 10-30 minutes to extract depending on your device. When the process finishes you'll be in a root shell in your new Arch distro! Of course like any new Linux distro, not everything will work out of the box.

You will want to change the password and maybe even the username of your new Linux user. This can be done with 2 commands.

For the password:

passwd user

For the user:

sudo usermod -dm /home/<user> -l <user> -s /bin/bash user

Once you're user is set up, you can use a crash-tested script I made that should run through and handle any exceptions. If not, it should at least make it easy enough to figure out what went wrong. Download and run it with sudo to avoid repeating your password:

wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=107Fh0l_p0ItVkUufOhP9to-OU_6KYhPW' -O fresharch.sh && chmod +x fresharch.sh && sudo bash fresharch.sh

If all the instructions were followed correctly yay should install and you'll have a functional Arch Linux with AUR support on your Android device.

@igorpichnenko
Copy link

sudo bash fresharch.sh не работает

@San-Sanbl4
Copy link

"sudo bash fresharch.sh не работает"
Не работает т.к. на сервере нет указанного в скрипте файла.
Нужно править fresharch.sh под актуальные сборки fakeroot доступные на сервере. http://ftp.debian.org/debian/pool/main/f/fakeroot

@mike111769
Copy link

mike111769 commented Dec 1, 2021

`:: Arch Linux Arm setup begins

:: Checking prerequisites...

fresharch.sh: line 46: $(echo $pkgs): ambiguous redirect

:: Packages up-to-date.

:: Making fakeroot package...

--2021-12-01 06:00:36-- http://ftp.debian.org/debian/pool/main/f/fakeroot/fakeroot_1.24.orig.tar.gz
Resolving ftp.debian.org (ftp.debian.org)... 151.101.50.132, 2a04:4e42:c::644
Connecting to ftp.debian.org (ftp.debian.org)|151.101.50.132|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2021-12-01 06:00:37 ERROR 404: Not Found.

tar: fakeroot_1.24.orig.tar.gz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
fresharch.sh: line 56: cd: /home/mike/.tmp/fakeroot-1.24/: No such file or directory`

https://launchpad.net/ubuntu/+source/fakeroot/1.24-1

I assume the warnings is about modification to your script.. didnt have a choice, if your interested i can upload a working version, although i did a few things manually.

Mike

@simonesestito
Copy link

I've had a few issues.

signature from "Arch Linux ARM Build System [email protected]" is unknown trust

Solved running the following commands:

  • pacman-key --init
  • pacman-key --populate
  • pacman -S archlinuxarm-keyring
  • pacman-key --populate archlinuxarm

sudo not installed

Solved with a simple pacman -Syyu sudo as root.

fresharch.sh download

Just download the file as usual from Google Drive and then manually copy it into ~/arch/root if you're still using the root user, or inside your home folder

Fake root not found (404)

In the fresharch.sh script, replace the fakeroot version from 1.24 to 1.29 or one available from http://ftp.debian.org/debian/pool/main/f/fakeroot/. Remember to update the filename in the wget, tar and the following related commands

@Kvngz3n0
Copy link

Kvngz3n0 commented Sep 5, 2023

`:: Arch Linux Arm setup begins

:: Checking prerequisites...

fresharch.sh: line 46: $(echo $pkgs): ambiguous redirect

:: Packages up-to-date.

:: Making fakeroot package...

--2021-12-01 06:00:36-- http://ftp.debian.org/debian/pool/main/f/fakeroot/fakeroot_1.24.orig.tar.gz Resolving ftp.debian.org (ftp.debian.org)... 151.101.50.132, 2a04:4e42:c::644 Connecting to ftp.debian.org (ftp.debian.org)|151.101.50.132|:80... connected. HTTP request sent, awaiting response... 404 Not Found 2021-12-01 06:00:37 ERROR 404: Not Found.

tar: fakeroot_1.24.orig.tar.gz: Cannot open: No such file or directory tar: Error is not recoverable: exiting now fresharch.sh: line 56: cd: /home/mike/.tmp/fakeroot-1.24/: No such file or directory`

https://launchpad.net/ubuntu/+source/fakeroot/1.24-1

I assume the warnings is about modification to your script.. didnt have a choice, if your interested i can upload a working version, although i did a few things manually.

Mike

@Kvngz3n0
Copy link

Kvngz3n0 commented Sep 5, 2023

I can't seem to solve : fakeroot_1.24.orig.tar.gz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
fresharch.sh: line 56: cd: /home/mike/.tmp/fakeroot-1.24/: No such file or directory` part

@Mintedshrimp
Copy link

Mintedshrimp commented Aug 27, 2024

extract https://drive.google.com/file/d/133GPa3o8NzE4MiKE5rYTWBVlBcweVdX-/view?usp=drivesdk
Make sure the files are extracted in internal storage mainly /storage/emulates/0/ then bash /sdcard/pacman.sh in terminal, this will add arch Linux repository to your termux environment

@Mintedshrimp
Copy link

Mintedshrimp commented Aug 27, 2024

Don't know how to fix execv errors need help pls.

@Mintedshrimp
Copy link

I saw the link was set to private , made it public so sorry for that.

@AlirezaParsi
Copy link

Is there any chroot option for installing this? I want install it with chroot permissions...

@RebelLion420
Copy link
Author

I've had a few issues.

signature from "Arch Linux ARM Build System [email protected]" is unknown trust

Solved running the following commands:

* pacman-key --init

* pacman-key --populate

* pacman -S archlinuxarm-keyring

* pacman-key --populate archlinuxarm

sudo not installed

Solved with a simple pacman -Syyu sudo as root.

fresharch.sh download

Just download the file as usual from Google Drive and then manually copy it into ~/arch/root if you're still using the root user, or inside your home folder

Fake root not found (404)

In the fresharch.sh script, replace the fakeroot version from 1.24 to 1.29 or one available from http://ftp.debian.org/debian/pool/main/f/fakeroot/. Remember to update the filename in the wget, tar and the following related commands

This should all be fixed now. I tested the script to be working myself but I would like to know of any issues

@elvisisvan
Copy link

elvisisvan commented Jan 12, 2025

since you're publishing a post to install arch on termux, why don't you just put them all in an interactive script to simplify the process? just like how the original material is meant to be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment