Skip to content

Instantly share code, notes, and snippets.

@bashelled
Last active September 29, 2023 11:48
Show Gist options
  • Save bashelled/171a2f9897f74afeb7f50b36c92c340c to your computer and use it in GitHub Desktop.
Save bashelled/171a2f9897f74afeb7f50b36c92c340c to your computer and use it in GitHub Desktop.
Some tutorial on how to pacstrap Arch Linux without pacstrap.

Installing Arch without pacstrap is easy. No, you won't use archbootstrap. That is only for chroots. Instead, you will do it hand made.

First, make the file system.

mkdir -m 0755 -p /path/to/root/var/{cache/pacman/pkg,lib/pacman,log} /path/to/root/{dev,run,etc/pacman.d}
mkdir -m 1777 -p /path/to/root/tmp
mkdir -m 0555 -p /path/to/root/{sys,proc}
cp -a /etc/pacman.d/gnupg "/path/to/root/etc/pacman.d/"

Then, use the following advantages. I prefer advantage 1.

Advantage 1: Running pacman on the root

This can only be used on Arch based systems. For others, go to advantage 2.
Execute this command: unshare --fork --pid pacman -r "/path/to/root" -Sy packages where packages is replaced with base. Add linux and linux-firmware if you're installing Arch, and add more packages for personalised use.

Advantage 2: Download packages manually and extract them

Do NOT try this, use advantage 1 instead! However, considering you know what you're doing...
Make sure you have tar (with xz and zstd just in case) and either wget, curl, or a browser with support for downloads.

  1. Download the packages base, it's depends, and your own packages from any Arch mirror, or go to packages.archlinux.org. On an Arch Linux system, you can just copy from /var/cache/pacman.
  2. Execute this:
cd /path/to/root
tar xpvf *.pkg.tar.*
@GrabbenD
Copy link

Advantage 1 is out of date?

error: failed to initialize alpm library:
(root: /mnt/root, dbpath: /mnt/root/var/lib/pacman/)
could not find or read directory

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