Create a Custom Arch Linux Installer
Posted by: Jack Van Zyl 8 months, 3 weeks ago
Here's how to create a custom Arch Linux installer disk image on a USB drive, with installation packages for:
- Boot loaders
- Scripts for building Linux kernel modules
- General firmware
- A proprietary hardware driver, the Broadcom wireless networking driver used in MacBooks
- Networking, including wireless networking
- The GNOME desktop environment including GNOME Evolution mail and calendar
- PlayOnLinux, VirtualBox, Atom, Python, Node.js, PostgreSQL, Blender, Transmission, Tor and Busybox
First install Arch Linux in VirtualBox with this article on running Arch Linux, or by installing Vagrant and using the Arch Linux v20201201 Vagrant box.
A desktop environment is not required for creating the installer disk image, but if you installed the GNOME desktop environment as per the article, go into the machine settings and enable clipboard sharing (under General > Advanced) and install the VirtualBox guest additions, so that you can copy and paste to the virtual machine if you like. Start the terminal utility app and install the guest additions:
pacman -S virtualbox-guest-utils
Install the archiso package:
pacman -S archiso
Create profile, work and output folders, and copy the release installer image build profile to the profile folder as a starting point:
mkdir /home/archlive mkdir /home/archwork mkdir /home/archout cd /home cp -r /usr/share/archiso/configs/releng/* ./archlive
Enable the Arch Linux multilib repository so that you have the option to include packages from all of the official Arch Linux repositories, by uncommenting the multilib section in the package manager configuration file, and then synchronising the package databases:
... [multilib] Include = /etc/pacman.d/mirrorlist ...
Install the wget package and get a list of the additional packages that you would like to be available when using the custom installer disk image, and save the list in a file package-list.txt in a folder /home/custompkgs. Download all of the packages that are not currently installed (and so not required as this should be done on a new system so that the same already installed packages will also be available in the new custom installer in /var/lib/pacman/local/). Then create a custom local package repository in custompkgs with all of the packages in that folder.
pacman -S wget mkdir /home/custompkgs pacman -Sp --noconfirm \ linux-headers grub broadcom-wl iw wget curl \ xorg xorg-server gnome gnome-extra \ wine winetricks playonlinux \ virtualbox atom python nodejs \ postgresql blender \ transmission-gtk tor torbrowser-launcher \ busybox > /home/custompkgs/package-list.txt wget -P /home/custompkgs -nv -i /home/custompkgs/package-list.txt ls -al /home/custompkgs | wc -l repo-add /home/custompkgs/custom.db.tar.gz /home/custompkgs/*.pkg.*
Add the new custom repository to the profile folder's package manager configuration file:
... [custom] SigLevel = Optional TrustAll Server = file:///home/custompkgs ...
Build the custom installer image:
mkarchiso -v -w ./archwork -o ./archout ./archlive
Connect a USB drive to your machine and connect it to the virtual machine, and, with persistent block device naming, identify it by id, label or part label, or find it by listing all sd (or "special disk") devices:
ls -al /dev/disk/by-id ls -al /dev/disk/by-label ls -al /dev/disk/by-partlabel ls -al /dev/sd*
Write the installer disk image to the USB drive, reading and writing in blocks of 4 MB:
dd bs=4M if=/home/archout/archlinux-[date-example-2020.12.27]-x86_64.iso of=/dev/[device-example-sdb] conv=fdatasync
Remove the work and output folders:
rm -rf /home/archlive rm -rf /home/archwork rm -rf /home/archout
There! You have a custom Arch Linux installer image on a USB drive!