How To: Create a Custom Arch Linux Distro

Create a Custom Arch Linux Distro

Having a custom Linux distro can be the coolest thing ever. Most of you will probably be satisfied with any particular Linux distribution, but I know I'm not the only one out there who wants it to have custom configurations and programs preloaded while leaving the bloatware behind.

The good thing? A custom distro doesn't have to be a fantasy. Linux is based on open-source software and user-contributed content, so setting up your own version isn't all that hard. The hardest part is getting started, because it's hard to find the exact details on the internet.

That's what this Null Byte is here for! We're going to create a custom, live Arch Linux CD that can have all of your personal configurations and software pre-installed.

Requirements

  • An installed version of Arch Linux on the computer that you're making this on.
  • 10GB of drive space (just to be safe).
  • A blank CD or DVD (depending on the size of the finished disc).
  • Root privileges on the computer.

Commands for the terminal are written in bold.

Step 1 Create a Chroot Base System

First off, we need to create what is know as a chroot. A chroot is a root Linux file system within another. So by creating one, we can put ourselves inside our OS-in-progress and paint the house from the inside, so to speak.

  1. Download the necessary tools:
    su && pacman -S devtools git make --needed
  2. Create a chroot with base-packages:
    mkarchroot /tmp/chroot base
  3. Clone the Archiso package:
    git clone git://projects.archlinux.org/archiso.git
  4. Compile Archiso to your chroot:
    make -C archiso/archiso DESTDIR=/tmp/chroot install
  5. Enter our chroot:
    mkarchroot -r bash /tmp/chroot

Step 2 Customize the ISO & Packages

Now we are going to customize the OS from the inside out. We can customize the whole OS from here, but we are going to go over packages, configuration files, and a window manager.

  1. Create a loopback interface:
    mknod /dev/loop0 b 7 0
  2. Configure a server to download packes from, this one is the most up-to-date:
    echo 'Server = http://ftp.osuosl.org/pub/archlinux/$repo/os/x86_64' >> /etc/pacman.d/mirrorlist
  3. Let's download any packages we want! Here are the required ones:
    pacman -S devtools libisoburn squashfs-tools

I would recommend installing the following packages for the average user.

  • leafpad
  • abiword
  • zathura
  • firefox
  • xorg
  • smplayer
  • audacious
  • gimp
  • kde-base

With this list of packages, you will have a few graphical tools as well as a graphical user interface on the disc already.

Next, we can create our user and change any configuration files that we want. Some common files I like to change are:

  • .bashrc
  • /boot/grub/menu.lst
  • /etc/rc.conf
  • /etc/hosts/allow

It's incredibly convenient to have all of your custom settings out of the box. You can't do that with Windows!

Step 3 Build the ISO

After you have done all the customizing you desire, we can build the ISO for burning.

  1. cp -r /usr/share/archiso/configs/baseline /tmp
  2. cd /tmp/baseline
  3. ./build.sh
  4. exit

Now, you will be out of your chroot, with the built ISO at the file path of:

/tmp/chroot/tmp/baseline/out/<iso>

Congratulations! You now have your own custom live media! Bring any questions and interesting conversations over with you to the Null Byte IRC!

Just updated your iPhone to iOS 18? You'll find a ton of hot new features for some of your most-used Apple apps. Dive in and see for yourself:

Image by morlockonzark

22 Comments

Thank you!
I am planning to make the switch and get Arch on my laptop this weekend. It is good to know some pachages i might need.

If you have time i would love to see an Arch installation from zero! I know i can get all the info from ArchWiki but i like your style and view on things ;)

You got it buddy, you'll see it posted soon :).

u 're da best!

Hey Alex Long,

thank you for your post. Is it possible to make a squashfs/aufs as RO? I would be appreciated if you are going to post a tutorial how to set up a live USB archlinux with squashfs/unionfs/aufs. This is not paranoia, it's just for the security.

Happy new year!

Yes, of course :). Squash is RO by default though, isn't it?

Hi Alex,
Thanks for your tutorial :-)

However in step 3, the first line does not work for me as /usr/share/archiso/configs/baseline is not visible from my chroot. Any clue? Thanks!

Daniel

ok, i got further thanks to me observing accurately the instructions (in my first step I worked on a /home/root/work directory instead of /tmp). However when booting the generated ISO the dreaded error appears:
Waiting 30 seconds for device /dev/disk/by-label/ARCH_201201 ...
ERROR: boot device didin't show up after 30 seconds...

Any clue at this stage? Thanks!

Sounds like the bootloader was maybe installed somewhere it shouldn't have been. Make sure that it is being installed to the MBR of your hard disk, that is, /dev/sda and not /dev/sda1,2.3 etc.

thanks alex, however to fix this would be beyond my capacities :-( and since all the scripts are automated and used with default settings, i suppose its an error within the scripts. However, i found that the instructions in https://kroweer.wordpress.com/2011/09/07/creating-a-custom-arch-linux-live-usb/ work fine and produce a bootable ISO (although using the same approach than yours with only minor differences). Total, i'm confused because available documentation and knowledge about these very important tools is scarce or outdated... anyway thanks for your time and efforts!

is there any way i can get a graphical installer for my live cd. like i want it to be instaled on my machene. live is fun for five min and for demo stuff but if i could get a live insaller it would realy help me out :) thanks in advance.

They don't make one, but maybe you should try ArchBang.

I have successfully created fully customised .iso (releng) of Arch installation on my desktop with all my programs,

and burned it on cd. On restarting with CD i am getting boot screen and rootarchiso command prompt etc. i can even load XFCE4.

Now how do i install this custom made .iso with all the software to another computer?
Because when i use "Beginners guide", i reach "pacstrap /mnt base" and it starts downloading base and all.
so it defeats my purpose of having fully customised .iso at hand to install. can you help pls?

Hi thanks for your detailed tutorial.
I'm having two errors during this process :

make -S archiso/archiso DESTDIR=/tmp/chroot install
make: Nothing to be done for `archiso/archiso'.
make: * No rule to make target `install'. Stop.

and the second one :

mknod /dev/loop0 b 7 0
mknod: '/dev/loop0' : Operation not permitted

Both commands are executed as root. Any Idea on how to solve this ?

Thanks again.

Just look into the ~/archiso dir. there's file named 'install' in it, not in ~/archiso/archiso. type
make -S archiso DESTDIR=/tmp/chroot install

I have a error at writing this command: su && pacman -S devtools git make --needed , when I entering password for me writing a Unable to determine the identity in Ubuntu 13.04 please help! Sorry for bad english.

Lol, I was looking for this on the internet for personal need and thought about publishing an article about it. Then legendary Null Byte pops out as first result, didn't even notice it was Null Byte.

I was like "I remember I was looking for Arch Linux, not controling new posts on Null Byte..."

Amazing.

Hi from Mauritius !

Thank you for this superb tutorial but I'm getting a bit puzzled by the part :

"Next, we can create our user and change any configuration files that we want. Some common files I like to change are:

.bashrc
/boot/grub/menu.lst
/etc/rc.conf
/etc/hosts/allow "

Can you please give a kind of exemple and detailed steps to follow ?

Thank you very much

Caron

p.s : I have installed archlinux on a laptop external hdd -in a usb slim case ( from which I an writing right now ...!)

Sanjaycom, how did you dealt with this step :

" Next, we can create our user and change any configuration files that we want. Some common files I like to change are:

.bashrc
/boot/grub/menu.lst
/etc/rc.conf
/etc/hosts/allow "

Caron

I get this error message after entering the command
mkarchroot /tmp/chroot base
The error message says... error: Partition /tmp/chroot too full: 163807 blocks needed, 127121 blocks free

This is strange to me because you've said leave 10GB of space and I have ~30GB on my root partition and ~43GB on my home partition. I have just under 1GB for my boot partition but /tmp directory isn't stored under the boot partition, is it?

Do I need to run some kind of defrag program, like in Windows to move all of my data to one side of the disk. I thought etc fs didn't need this kind of thing. Any help, please

faced the same issue... found that /tmp directory size 1gb... so i just moved /tmp/chroot to my home directory

temporarily change the size of /tmp partition by this command
# mount -o remount,size=4G,noatime /tmp
where 4G is the size , put whatever you want to make it!

mkarchroot -r bash /tmp/chroot should be arch-chroot /tmp/chroot i guess.... mkarchroot not working for me... it says /usr/sbin/mkarchroot: illegal option -- r

Share Your Thoughts

  • Hot
  • Latest