Skip to content

Instantly share code, notes, and snippets.

@RebelLion420
Last active May 12, 2024 22:37
Show Gist options
  • Save RebelLion420/bd1c94e320c0c6c56e33a1dc75e5f4a2 to your computer and use it in GitHub Desktop.
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 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.

To add your user:

$ useradd -mG root -s /bin/bash <newuser>

For the password:

$ passwd <newuser>

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. First download and run it with sudo to avoid repeating your password:

$ sudo pacman -Syyu wget

$ 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 builder@archlinuxarm.org" 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

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