There comes a time in every Linux user’s life where the standard ISOs just don’t cut it. You want your dotfiles, your window manager, your specific cocktail of packages baked into the medium itself. Maybe you want a rescue USB that boots straight into a fully configured environment, or maybe - just maybe - you harbor the delusion of maintaining your own Linux distribution.
As an Arch user, I don’t wait for upstream to give me what I want. I build it.
Today, we are going to look at ArchISO. This is the official tool used to generate the monthly Arch Linux installation images. But it’s not a black box; it’s a recipe system. And like any recipe, if you change the ingredients, you change the result.
Here is how you craft a custom Arch Linux ISO from scratch.
The Prerequisites
You need an Arch-based system (or a chroot). You need the archiso package.
sudo pacman -S archiso
Step 1: Clone the Profile
We never edit the system files directly. archiso comes with two profiles: baseline (bare minimum to boot) and releng (Release Engineering - the standard Arch ISO). We want releng because we aren’t masochists; we want a working base.
Create a workspace and copy the profile:
mkdir -p ~/iso/my-distro
cp -r /usr/share/archiso/configs/releng/* ~/iso/my-distro/
cd ~/iso/my-distro
Step 2: The Ingredient List (packages.x86_64)
Inside your workspace, you’ll find packages.x86_64. This is just a flat text list of every package pacman will install into the ISO.
By default, it’s bare. You want a desktop? You need to add it.
Open it in Vim (or Emacs, I don’t judge) and add your requirements:
- The Basics: git, vim, htop, neofetch.
- The GUI: xorg-server, xorg-xinit.
- The DE/WM: qtile, awesome, bspwm, or plasma.
- The Terminal: alacrity, kitty.
If you maintain your own custom repository (like I do with my amadeos-sync), you can add your meta-packages here too.
Pro-Tip: If you add packages from a custom repo or the AUR (via a pre-built repo), you must edit pacman.conf in this same directory. Add your custom repository server lines there just like you would on a live system, otherwise the build process will fail when it can’t find your custom packages.
Step 3: The Root Filesystem (airootfs)
This is where the magic happens. The directory airootfs acts as an overlay for the root of the live system. If you place a file in airootfs/etc/neofetch/config.conf, it will appear in /etc/neofetch/config.conf on the live ISO.
Creating a User (Beyond Root)
The default ISO only has root. That’s bad practice for a daily driver. We need to edit airootfs/etc/passwd and airootfs/etc/shadow.
- Generate a Password Hash: Don’t paste plain text passwords. Use OpenSSL to generate a SHA-512 hash.
- Edit passwd: Add your user (usually UID 1000).
- Edit shadow: Paste the hash you generated into the shadow file for your new user.
The Skeleton (/etc/skel)
How do you get your custom .bashrc or Window Manager configs to the live user? You use the skeleton directory.
Copy your dotfiles into airootfs/etc/skel/.
- airootfs/etc/skel/.config/qtile/…
- airootfs/etc/skel/.bashrc
When the ISO creates the user at boot, it copies everything from /etc/skel to the new user’s home directory.
Warning: Check your permissions. If you copy scripts into ~/.local/bin, make sure they are executable (chmod +x) before you build the ISO.
Step 4: Configuration and Permissions (profiledef.sh)
You can’t just throw files into airootfs and expect the permissions to be correct. You need to define them in profiledef.sh.
This file controls the metadata of the ISO.
- iso_name: Change this from archlinux to mydistro.
- File Permissions: This is critical. You must ensure your shadow files are not world-readable.
['/etc/shadow']='0:0:400'
['/etc/gshadow']='0:0:400'
If you forget this, archiso might default to world-readable permissions, and you’ve just baked a security vulnerability into your release.
Step 5: The Build
Once you’ve tweaked your sddm.conf, set up your systemd symlinks (to enable display managers on boot), and cleaned up your package list, it’s time to compile.
Clean your workspace of any previous failed attempts (and there will be failed attempts).
sudo rm -rf work/ out/
Run the build command:
sudo mkarchiso -v -w work/ -o out/ .
- -v: Verbose. You want to see what fails.
- -w: The working directory (temporary storage).
- -o: The output directory (where the ISO lands).
- .: The current directory (your profile).
Go make coffee. This will download every package defined in your list and compress the filesystem.
The Reality Check: Troubleshooting
It rarely works the first time. Here are the common failure points I hit:
- Signature Errors: If you use custom repos, ensure your keyring is properly set up in the airootfs or that your pacman.conf has the correct SigLevel.
- File Conflicts: If you try to overwrite a file that a package installs (like os-release), pacman will error out during the build. You have to be clever about how you overlay files.
- Boot Failures: You build the ISO, boot it in virt-manager, and… black screen. This usually means you forgot to enable the Display Manager service (like SDDM or LightDM) or your Xorg config is missing drivers.
Conclusion: The Live Environment vs. The Installer
Congratulations, you have an ISO. But remember: ArchISO creates a Live Medium, not an Installer.
If you boot this, you are in a live session running off RAM. If you want this to be a real distribution that you can install to a hard drive easily, you need to add an installer like Calamares.
Adding Calamares is a whole different beast involving unholy amounts of Python and YAML configuration to ensure it copies your custom files correctly to the target target.
But for now? You have a bootable slice of Linux that is entirely yours. Flash it to a USB, put it on your keychain, and carry your digital soul with you wherever you go.