30 Home
XADE edited this page 2024-03-05 08:14:35 +00:00

PacmanStrap

  • Not the same tool provided by Arch to create base of arch.
  • A simple tool to create a minimal rootfs with working pacman
  • Does nothing more then necessary
  • No root privileges are required to exec the script

Mirror: GitHub


HOW TO USE ?

On Linux distribution

DEPENDENCIES : sh curl gawk tar gzip xz zstd

in this example we are creating rootfs inside directory

curl -O https://codeberg.org/zz/PacmanStrap/raw/branch/master/pacstrap.sh
sh pacstrap.sh directory

to login, run

chroot directory

to setup usable root filesystem, run

update-ca-trust
pacman -Syu --noconfirm --overwrite '*' pacman

On Termux

pkg upgrade -y
pkg install -y proot qemu-user-x86-64 curl gawk tar gzip xz-utils zstd
curl -O https://codeberg.org/zz/PacmanStrap/raw/branch/master/pacstrap.sh
proot --link2symlink sh pacstrap.sh directory

save this command to a file [in this example proot.sh]

Refer to this manual, to know what each of the following option does.

echo '
#!/bin/sh
unset LD_PRELOAD
proot \
 --kill-on-exit \
 -q qemu-x86_64 \
 -S $1 \
 --link2symlink \
 /bin/bash -c " \
 export \
   PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
   HOME=/root
 /bin/bash"
' > proot.sh

to log in, run

sh proot.sh ./directory

to setup usable root filesystem, run

update-ca-trust
pacman -Syu --noconfirm --overwrite '*' pacman

above command should be executed only once


Don't forget to enable signature verification

inside /etc/pacman.conf by setting

SigLevel = Required DatabaseOptional

Bootstraping distributions

By default this creates rootfs for Artix

For other Arch based distro, simple pass the repo url as 2nd arguement

# To install Arch for example:
sh pacstrap.sh directory https://mirrors.tuna.tsinghua.edu.cn/archlinux/core/os/x86_64

Here's another project which utilizes this tool.