Bootstrapping Goal

The goal of the bootstrapping procedure is to setup an environment from which pacstrap runs.
This goal is achieved by installing pacstrap natively on the host system, or setting up an Arch Linux-based chroot.

If the host system runs Arch Linux, installing pacstrap natively is as easy as installing arch-install-scripts.

Note: This guide requires that the existing host system be able to execute the new target Arch Linux architecture programs. In the case of an x86_64 host, it is possible to use i686-pacman to build a 32-bit chroot environment. See Arch64 Install bundled 32bit system. However it is not so easy to build a 64-bit environment when the host only supports running 32-bit programs.

Setting up an Arch Linux-based chroot

The Arch Linux chroot environment will be used temporarily to set up the actual Arch Linux installation using the arch-install-scripts.

Just expand the tarball into the directory of your choice (if sufficient RAM is available, to a directory in /tmp) and use the included arch-chroot to chroot into your install "system".
More information can be found here and here.

Bootstrap Image

Download the bootstrap image which is a tarball containing the arch-install-scripts.
It is a smaller image.
Just expand the tarball into the directory of your choice (if sufficient RAM is available, to a directory in /tmp)
Use the included arch-chroot to chroot into your install "system".

The root image can be found on one of the mirrors under either arch/x86_64/ or arch/i686/ depending on the desired architecture

Chroot into LiveCD-image

It is possible to mount the root image of the latest Arch Linux installation media and then chroot into it. This method has the advantage of providing you with a working Arch Linux installation right within your host system without the need to prepare it by installing specific packages.

Note: Before proceeding, make sure the latest version of squashfs is installed on the host system. Otherwise you will get errors like: FATAL ERROR aborting: uncompress_inode_table: failed to read block.

The root image can be found on one of the mirrors under either arch/x86_64/ or arch/i686/ depending on the desired architecture. The squashfs format is not editable so we unsquash the root image and then mount it.

To unsquash the root image, run

# unsquashfs -d /squashfs-root root-image.fs.sfs

Now you can loop mount the root image

# mkdir /arch
# mount -o loop /squashfs-root/root-image.fs /arch

Before chrooting to it, we need to set up some mount points and copy the resolv.conf for networking.

Now everything is prepared to chroot into your newly installed Arch environment

# chroot /arch bash

This chroot is able to execute the arch install scripts. The destination partitions should be mounted under the /mnt directory from this chroot.

when chrooting Debian based host systems the /dev/shm points to /run/shm . /run/shm does not exist in the chroot environment , the link is broken and pacstrap returns an error. create a directory /run/shm in the chroot environment when chrooting from debian based host systems

You might need to run these commands if you get key errors when you try to install packages:

# pacman-key --init
# pacman-key --populate archlinux

Bootstrapping the arch installation scripts

Contrary to the other methods, this method is one-step only; you only have to execute the script below and thats it.

This method provides a chroot enviroment from where to execute the arch install scripts (similar to Method 1), by using a bootstrapping script.

The script below is going to create a directory called archinstall-pkg and download the required packages there. Then, is going to extract them into the archinstall-chroot directory. Finally, is going to prepare mount points, configure pacman and enter into a chroot.

This chroot is able to execute the arch install scripts. The destination partitions should be mounted under the /mnt directory from this chroot. After that, continue with the next step, which is #Fix the Pacman Signature Keyring.

CHROOT_DIR=archinstall-chroot Must Change First, or you might ruin your /etc/

Warning: This method is potentially difficult, your mileage may vary from distro to distro. If you just want to do an arch installation from another distro and you are not interested in have pacman as a regular program under such distro, is better to use a different method.

This method is about installing pacman and the arch install scripts directly under another distro, so they become regular programs on that distro.

This is really useful if you are planning to use another distro regularly to install arch linux, or do fancy things like updating packages of an arch installation using another distro. This is the only method that not imply creating a chroot to be able to execute pacman and the arch install scripts. (but since part of the installation includes entering inside a chroot, you'll end using a chroot anyway)

Install dependencies

Using your distribution mechanisms, install the required packages for pacman and the arch install scripts. libcurl, libarchive, fakeroot, xz, asciidoc, wget, and sed are among them. Of course, gcc, make and maybe some other "devel" packages are necessary too.

Compile pacman

If you get errors here, chances are you are missing dependencies, or your current libcurl, libarchive or others, are too old. Install the dependencies missing using your distro options, or if they are too old, compile them from source.

Compile

make

If there were no errors, install the files

make install

You may need to manually call ldconfig to make your distro detect libalpm.

Prepare configuration files

Now is time to extract the configuration files. Change the x86_64 as necessary.

Extract the pacman.conf and makepkg.conf files from the pacman package, and disable signature checking:

On a debian based host system /dev/shm points to /run/shm, but that directory doesn't exist in your chroot.
Log into your chroot, then do

# mkdir /run/shm

and you'll be fine.

Perhaps someone could add a check to the script to do this?

Edit the fstab file

Probably the genfstab script won't work. In that case, you'll need to edit the /mnt/etc/fstab file by hand.
You can use the content of /etc/mtab as reference.

Finish the Installation

Now just do the rest of the steps normally.

Tips and tricks

In case you want to replace an existing system, but can for some reason not use a LiveCD, since, e.g., you have no physical access to the computer, the following tip might help: If you manage to get ~500MB of free space somewhere on the disk (e.g. by partitioning a swap partition) you can install the new Archlinux system there, reboot into the newly created system and rsync the entire system to the primary partition. Finally don't forget to fix the bootloader configuration before rebooting.