From ArchWiki
Revision as of 17:59, 7 September 2011 by Jd4 (talk | contribs) (Added link to a blog post)
Jump to: navigation, search

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

What is it?

Archiso is a small set of bash scripts that is capable of building fully functional Arch Linux based live CD/DVD and USB images. It is a very generic tool, so it could potentially be used to generate anything from rescue systems, to install disks, to special interest live CD/DVD/USB systems, and who knows what else. Simply put, if it involves Arch on a shiny coaster, it can do it. The heart and soul of Archiso is mkarchiso. All of its options are documented in its usage output, so its direct usage wont be covered here. Instead, this wiki article will act as a guide for rolling your own live mediums in no time!

Due to recent changes, Archiso will now automatically create ISO images that are also USB images! Separate CD/USB targets are therefore no longer necessary.

Building the most basic Arch Linux live media. (configs/baseline)

Note: Working in a clean chroot is not necesary but recomended
  • Install devtools if needed, mkarchroot needs it.
[host] # pacman -S devtools --needed
  • Create a base chroot to work on it.
Note: prefix with linux32 if you want to build a 32 bits enviroment under 64 bits; i.e add linux32 before mkarchroot
[host] # mkarchroot /tmp/chroot base
  • Install archiso on chroot (AUR method)

Get it from: archiso-git AUR package

[host] # pacman -U archiso-git-YYYYMMDD-R-any.pkg.tar.xz -r /tmp/chroot
  • Get and install archiso (GIT method)
[host] # pacman -S git make --needed
[host] # git clone git://
[host] # make -C archiso/archiso DESTDIR=/tmp/chroot install
  • Enter to chroot.
Note: prefix with linux32 if needed
[host] # mkarchroot -r bash /tmp/chroot
  • Create a loopback device.
Note: mkarchroot does not create it. Use other number if not available
[chroot] # mknod /dev/loop0 b 7 0
  • Setup a mirror.
Note: Change MIRROR to your preference
[chroot] # echo 'Server = MIRROR/archlinux/$repo/os/$arch' >> /etc/pacman.d/mirrorlist
  • Install aditional packages needed for archiso (only if GIT method is used previously)
[chroot] # pacman -S devtools libisoburn squashfs-tools
  • Build a basic iso.
[chroot] # cp -r /usr/share/archiso/configs/baseline /tmp
[chroot] # cd /tmp/baseline
[chroot] # ./
  • Exit from chroot.
[chroot] # exit

General workflow (manual way)

  • Setup a base filesystem
mkarchiso -p "base" create
  • Install syslinux
mkarchiso -p "syslinux" create
  • Install other packages (optional)
mkarchiso -p "pkg1 pkg2 pkg3 ... pkgN" create
  • At this point, customize anything what you want in root-image, then exit when done.
mkarchroot -n -r bash work/root-image
  • Setup initramfs image.
    • Copy needed hooks to root-image
cp /lib/initcpio/hooks/archiso work/root-image/lib/initcpio/hooks
cp /lib/initcpio/install/archiso work/root-image/lib/initcpio/install
    • Create a config for mkinitcpio mkinitcpio.conf
HOOKS="base udev archiso sata filesystems"
    • Generate the initramfs image
mkinitcpio -c ./mkinitcpio.conf -b work/root-image -k /boot/vmlinuz-linux -g work/iso/arch/boot/i686/archiso.img
  • Move kernel to boot/
mv work/root-image/boot/vmlinuz-linux work/iso/arch/boot/i686/vmlinuz
  • Setup syslinux
    • Create a directory for it.
 mkdir -p work/iso/arch/boot/syslinux
    • Create a work/iso/arch/boot/syslinux/syslinux.cfg file.
DEFAULT menu.c32

LABEL arch
LINUX /arch/boot/i686/vmlinuz
INITRD /arch/boot/i686/archiso.img
APPEND archisolabel=MY_ARCH

    • Copy menu.c32 needed by previous config.
cp work/root-image/usr/lib/syslinux/menu.c32 work/iso/arch/boot/syslinux/
  • Setup isolinux (optional, only needed for booteable iso)
mkdir work/iso/isolinux
cp work/root-image/usr/lib/syslinux/isolinux.bin work/iso/isolinux/
    • Create a work/iso/isolinux/isolinux.cfg
DEFAULT loadconfig

LABEL loadconfig
  CONFIG /arch/boot/syslinux/syslinux.cfg
  APPEND /arch/boot/syslinux/
  • Create an work/iso/arch/aitab file.
# <img>         <mnt>                 <arch>   <sfs_comp>  <fs_type>  <fs_size>
root-image      /                     i686     xz          ext4       50%
  • Build all filesystem images specified in aitab (.fs .fs.sfs .sfs)
mkarchiso prepare
  • Generate an ISO 9660 with "El Torito" boot image (optional)
mkarchiso -L "MY_ARCH" iso "my-arch.iso"

Make a booteable "pendrive" that have more things than "Arch Linux"

Copy "work/iso/arch" directory to some partition (must be booteable) that you have on the desired medium.

cp -r work/iso/arch /mnt/pen1

If partition is "vfat" run syslinux and set LABEL.

syslinux -i -d /mnt/pen1/arch/boot/syslinux /dev/pen1
Note: Due bug in mmove (from mtools), ldlinux.sys install fails, you can workaround with:
mv /mnt/pen1/arch/boot/syslinux /mnt/pen1/syslinux
syslinux -i -d /mnt/syslinux /dev/pen1
mv /mnt/pen1/ldlinux.sys /mnt/pen1/syslinux
dosfslabel /dev/pen1 MY_ARCH

If partition is ext2/3/4 or btrfs run extlinux and set LABEL.

extlinux -i /mnt/pen1/arch/boot/syslinux
e2label /dev/pen1 MY_ARCH

Finally install the master boot sector code.

cat /usr/lib/syslinux/mbr.bin > /dev/pen

Configure our live medium


An initcpio is necessary for creating a system that is able to "wake-up" from a CD/DVD/USB.

Therefore, you should create a mkinitcpio.conf that holds a list of our hooks:

$ vim mkinitcpio.conf

A typical set of hooks for archiso looks something like this:

HOOKS="base udev memdisk archiso archiso_pxe_nbd archiso_loop_mnt pata scsi sata usb fw pcmcia filesystems usbinput"

This list will get you a system that can be booted off a CD/DVD or a USB device. It's worth mentioning that hardware auto-detection and things of that nature do not belong here. Only what's necessary to get the system on its feet, and out of the initcpio really belong here, fancier stuff can be done on the booted system anyway.


You'll also want to create a list of packages you want installed on your live CD system. A file full of package names, one-per-line, is the format for this. This is great for special interest live CDs, just specify packages you want and bake the image.

Tip: You can also create a custom local repository for the purpose of preparing custom packages or packages from AUR/ABS. Just add your local repository at the first position (for top priority) of your build machine's pacman.conf and you are good to go!


The aitab file holds information about the filesystems images that must be created by mkarchiso and mounted at initramfs stage from the archiso hook. It consists of some fields which define the behaviour of images.

# <img>         <mnt>                 <arch>   <sfs_comp>  <fs_type>  <fs_size>
Image name without extension (.fs .fs.sfs .sfs).
Mount point.
Architecture { i686 | x86_64 | any }.
SquashFS compression type { gzip | lzo | xz }. A special value of "none" denotes no usage of SquashFS.
Set the filesystem type of the image { ext4 | ext3 | ext2 | xfs }. A special value of "none" denotes no usage of a filesystem. In that case all files are pushed directly to SquashFS filesystem.
An absolute value of file system image size in MiB (example: 100, 1000, 4096, etc) A relative value of file system free space [in percent] {1%..99%} (example 50%, 10%, 7%). This is an estimation, and calculated in a simple way. Space used + 10% (estimated for metadata overhead) + desired %
Note: Some combinations are invalid. Example both sfs_comp and fs_type are set to none

Boot Loader

DEFAULT menu.c32

LABEL arch
LINUX /%INSTALL_DIR%/boot/%ARCH%/vmlinuz
INITRD /%INSTALL_DIR%/boot/%ARCH%/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL%


Due to the modular nature of isolinux, you are able to use lots of addons since all *.c32 files are copied and available to you. Take a look at the official syslinux site and the archiso git repo. Using said addons, it is possible to make visually attractive and complex menus. See here.

Finishing the root-image

Some tips that will not be covered in this article because there are other articles on this wiki that already do:

  • Adding an user.
  • Configure an inittab to start into X at boot time
  • Configure the hosts file
  • Configure rc.conf (no fancy modules required here)
  • Configure sudoers
  • Configure rc.local
  • Put more stuff into etc/skel
  • Put additional artworks onto the medium
  • Put arbitrary binary stuff into opt/

See also