This post is about something which I actually wanted to try out for quite a while: Building a custom Live-CD!
Another “Rolling Release” annoyance
Today I just wanted to give a little tool called archiso a try – however it wasn’t just as easy as that. I was off for some weeks and when I returned home now, my Arch-powered machines couldn’t even connect to the net after doing an update… What happened? Well, the trifle of replacing SysVinit with Systemd…
Yes, I know that it’s really my fault and that I should read the Arch news on a regular basis. But honestly: For people who have various distros in use, always keeping up with the latest changes proves be a pain in the proverbial. Once again I can only praise Gentoo for providing a news system inside the OS (“eselect news”) where important changes are announced a long time before they actually take place. This is definitely something that Arch lacks. At least IMHO.
Setting up our system
So what are we going to do this time? The idea is to be left with a bootable iso that loads Arch Linux and provides a graphical DE of some sort, preferably something not too big that needs to be installed as a custom package. I choose EDE² for that reason.
Since it’s always a good idea to start over with a clean system, let’s download the latest Arch install CD and in the meantime set up a new VirtualBox VM. In installing I follow more or less the way that the installation guide on the wiki suggests (which has not yet been updated to cover systemd).
Thanks to that change, I have to create a network profile in /etc/network.d/ (or copy one of the examples). After adding this profile to /etc/conf.d/netcfg, both netcfg.service itself and net-auto-wired.service have to be added to the services loaded at system start. That brings my network back.
Alright. Next, I install sudo, links, git and wget (archiso needs it but it’s not listed as a dependency). Then I create a new user named “builder” and add him to the sudoers. Now I can logout and login again as the new user.
The version of archiso that’s in the repos is old and no longer working (among other things thanks to systemd). So we’re using links to go to the AUR and download the PKGBUILDs for archiso, edelib2 and ede2. Now let’s build packages for these, shall we?
Once that’s done, I log out “builder” and log in as root again. I create a new directory /root/newrepo, copy the edelib and ede packages there and change to that dir. Then I use
repo-add newrepo.db.tar.gz edelib-2.0.1-1-i686.pkg.tar.xz to create a custom local repo (and add ede-2.0-3-i686.pkg.tar.xz, too, using the same script). Now I just install the archiso package I compiled from the AUR and we’re good to go.
Configuring archiso and building!
First we create a new directory /root/archlive and copy the content of /usr/share/archiso/configs/releng/ there. Next I add my custom repo to the pacman.conf file in the new releng directory (that’s the one that is used for the build process, not /etc/pacman.conf! Now all that is left to do is actually adding packages to /root/archlive/releng/packages.i686.
I choose to add xorg-server, xorg-xinit, xf86-video-vesa, xf86-input-evdev, libxpm, edelib and ede. Finally I can issue the command
./build.sh -v build single netinstall afterwards. The script begins building!
The script first syncs all repos and downloads the needed packages. Afterwards they are installed and an initramfs image is build which doesn’t take a long time. The next thing the script does is building multiple squashfs’. These are compressed read-only file systems that archiso makes heavy use of. Since it uses strong compression, their creation take quite a while.
Once it’s done, we’re left with an iso file placed in the out folder. Yes, that’s all!
Of course, as you can see in the first image, there are some more files that would allow for some more customizing but for our basic purposes what we did here was actually all we had to!
Testing the iso
Now it’s time to test the iso. I could burn it to a real cd but that would be a pure waste. Luckily VirtualBox can boot from an iso file just like from a real cd.
In my case all went well and I was able to boot from the iso. And finally I can startx into the desktop environment I chose for it!
I have to confess that I thought things would be a lot more difficult. But of course our example was about the simplest case one could come up with. Adding more files to the iso, setting up users, adding a display manager for graphical login, etc. are things some people might want to consider, too. But that’s a little beyond the scope of this entry.
The next post will reveal what the “DDD” is that I’ve been playing with for quite a while now.