For a traditional Unix experience, try Crux Linux
The Linux operating system can be implemented in many ways, and these implementations can very generally be divided into “traditional” Unix and modern Linux. This is definitely a generalization, and it’s just one way to view Linux implementations, but it can be a useful way to describe the feel of a Linux distribution. Something like Fedora Linux or Red Hat Enterprise Linux, and even something like Arch Linux, is keen to innovate rapidly. A distribution like Crux Linux, however, focuses on simplicity and transparency of design, with even its modern conveniences built in a style similar to historical solutions. I recently install Crux Linux 3.7 on a laptop, and found it refreshingly familiar, at least for a user of Slackware and BSD.
Install
Installing Crux is a matter of downloading the official ISO image and burning it to an optical disc or to a USB thumbdrive. To copy an ISO to USB, I use Balena Etcher, an easy open source and cross-platform imager. Once the image is on a drive, attach the drive to your target computer and reboot, using whatever keyboard shortcut your brand of computer requires to boot to an external drive. On some computers, you may need to enter UEFI or BIOS to deactivate various locks designed to prevent you from booting from an external drive.
Crux doesn’t have an installer, as such. Instead, you must manually partition your drive using parted
or fdisk
or cfdisk
, mount the internal drive, extract the packages to it, and then chroot
into the target drive to install a bootloader and add configuration files.
The good news is that Crux doesn’t make you do it all manually. There are helpful scripts, including setup
to install packages and setup-chroot
to perform the steps required to establish a chroot environment.
The scripts aren’t always very robust. If you skip a step accidentally and try to run a script before the drive is ready for it, the script might fail and leave you in a state of uncertainty. It’s not irrecoverable, but it might mean that you’re compelled to start back at the beginning for fear of missing something vital that would result in a non-bootable system.
It can be easy to miss a step because what you’re supposed to do is described to you instead of proscribed to you. Confusingly, the instructions are formatted as a bullet list (which suggests an unordered list) and not as a number list (which suggests an ordered list), so what looks like a series of choices under a subheading is often actually a hierarchy of steps. But then in other cases, a series of choices under a subheading is actually just a series of choices, dependent upon your system configuration (UEFI or BIOS, for example). I missed a step more than once because I had a difficult time differentiating instructions that were optional or conditional from instructions that were absolutely mandatory. Read carefully, and follow the install instructions line by line.
Compiling a kernel
My daily distribution is Slackware. It ships with a few kernel configurations, so I don’t have to compile my own kernel but it’s an easy thing to do on Slackware, so I often do it anyway. Crux requires you to compile a kernel, so if you’ve never done that before then this is likely to feel like the most intimidating step. You might be surprised to find, however, that it’s one of the easiest parts of the installation. After you’ve done it once, you’re likely to feel comfortable with the process, which is important because you may need to re-compile it (or an update) later because Crux doesn’t try to detect or predict what drivers your installed system is going to need.
An important job of the kernel is to help your computer detect peripheral devices, which includes your keyboard and mouse, your network and WiFi card, camera, and a lot of other parts of a computer you might normally take for granted. If you don’t include a driver in your kernel, even only as a loadable module, then your computer may not be able to detect an important peripheral. The age old problem here is that you need to know what peripherals you own (which is trickier than it sounds, given that many of the most important components of your computer are on the inside, hidden from view) and what driver is required to make that component functional. Fortunately, the default kernel configuration covers most basic commodity hardware. You can try to accept the default configuration and then compile the kernel just to get a bootable system, and then adjust and re-compile your kernel later once you see which devices aren’t recognised. Alternately, you can do research online to find out what devices are enabled by which driver, and enable those drivers in your kernel config.
The steps required to configure, compile, and install a kernel are very clearly written in the Crux documentation. I found this to be one of the easiest steps of all. I did end up re-compiling my kernel after I’d booted to my system, because I’d misidentified my WiFi card and needed a different driver than what I’d originally included. It took me mere minutes.
Installing a bootloader
After you’ve performed some configuration steps, you get to the bootloader step. In theory, this is simple, but between the way it’s documented and all the options you have depending on the system you’re installing onto, it can get confusing. Here are a few things to keep in mind.
First of all, there’s no instructions for dual-booting. The Crux documentation assumes that you’re installing Crux and only Crux to your computer. Frankly this is the safest and easiest method for an install, and I recommend it. In my experience, a dual-boot computer is very often a single-boot system in denial. You can only use one OS at a time, and eventually one OS ends up having all the stuff you care about on it, so you probably end up booting to it almost exclusively.
Secondly, Crux uses GRUB as a bootloader. It’s possible to fall back on SYSLINUX if you need to, but realistically it’s probably easiest to install and use GRUB. That means you must choose between two paths in the documentation: GRUB on UEFI or GRUB on BIOS. The difference between these options is that UEFI requires GRUB to be located in /boot/efi
while BIOS expects GRUB to be in the Master Boot Record (MBR) of the drive. Read the instructions thoroughly before you execute any command.
Reboot to Crux
After you’ve installed everything and configured your language and network settings, you can reboot the computer and boot from the internal drive. Assuming you got everything right, you get a GRUB screen allowing you to boot into your new Crux system.
The first time through, I didn’t get that far. Instead of GRUB, an error message appeared in place of GRUB. After re-reading the documentation, I realised that, although I had installed GRUB, I had failed to configure GRUB. This was the 3rd or 4th mistake I’d made during the process, but like all of my other errors it was easy to fix.
I rebooted to the installer, mounted my internal drive using mount
and then used setup-chroot
to make it my active environment.
I ran grub-mkconfig
:
# grub-mkconfig > /boot/grub/grub.cfg
Another reboot, and I was using Crux Linux.
When you boot into Crux for the first time, you can login as the root user and continue configuring your system. For me, this meant install the WiFi drivers I’d forgotten to include in my kernel and creating a normal user. I anticipate there to be more administrative tasks later. There are likely other drivers I’ve forgotten to include, and lots of software I’m going to want. Part of the beauty of Crux is that it doesn’t attempt to anticipate your preferences. It provides a foundation for you to build upon.
Installing software with ports
An installable software package for Crux Linux is a structured tar.gz
archive. Aside from the ones you make yourself using the pkgmk
command, packages are delivered as ports. Similar to how it works on NetBSD, the Crux ports system lets you to download a list of available ports from a Crux project server, and then build just the software you want.
To set up your ports system, use the ports
command with the -u
(for upgrade) option:
# ports -u
Your ports tree is stored in /usr/ports
. Each port is represented by a directory containing a file called Pkgfile
, which lists the source code download location and sometimes special instructions for the ports system.
You can find a port using standard system tools like ls
and grep
or find
, or the special Crux command prt-get
. The prt-get
command searches your ports tree and gives you information about what it finds.
# prt-get search tcsh
tcsh
# prt-get info tcsh
Name: tcsh
Path: /usr/ports/opt
Version: 6.24.14
[...]
To install a port, change directory to the location of the port and then use the pkgmk
command along with the -d
(for download) option:
# cd /usr/ports/opt/tcsh
# pkgmk -d
The first time I tried this, I got SSL errors from curl
, which pkgmk
uses to download the source code. To solve this, I had to pass the CA_CERT_BUNDLE
environment variable to pkgadd
:
CA_CERT_BUNDLE=/etc/ssl/certs.pem pkgadd -d
I only encountered this error on the first day of using Crux. Somehow, the problem was alleviated the next day. I couldn’t find CA_CERT_BUNDLE
in my environment variables, and to this day I’m not sure what the problem was.
After you’ve downloaded and built the package, use pkgadd
followed by the name of the package to install it to your system. The naming scheme of Crux packages is a little jarring, being the name of the software followed by a hash symbol (#
) and then the version number. I’m not used to a hash symbol in the name of a file, but despite it looking like a comment it does work as long as you use Tab to auto-complete the name, or else escape it with a backslash:
pkgadd tcsh\#6.24.14-1.pkg-tar.gz
Success is silent, so as long as you see no output from pkgadd
the install has completed successfully.
Contributor packages
By default, Crux provides you with the core
, opt
, and xorg
package sets. That’s just over 750 ports, ready to install. However, there are even more ports contributed by users in the contrib
collection.
To enable the contrib
collection, you just rename a configuration file:
# mv /etc/contrib.rsync.inactive /etc/contrib.rsync
Update your ports tree to see the new collection:
ports -u
Additionally, set the new collection as valid in prt-get
(the command that makes it easy to find and get info about each port):
# sed -i '/contrib/s/^#//' /etc/prt-get.conf
You now have over 1,000 additional ports available to you.
Of course there are yet more ways to install software on Crux. NetBSD’s pkgsrc
works on Crux, and you can also just compile software manually and then use pkgmk
to create a Crux package.
Try Crux Linux
Crux Linux is a minimalist Linux distribution that provides you with just the tools you need to get Linux installed. From there, building the system you want is largely up to you. You can assemble a toolchain consisting of what you want. With only the Openbox window manager available through its ports, even the desktop experience invites you to configure it as you please. It’s clear from documentation that Crux expects you to have advanced knowledge of computing. If you don’t understand how to partition a drive, or how to create a filesystem on that partition, or understand what filesystem you need to compile into your kernel, then you aren’t getting Crux installed. If you do understand these concepts, and you want a minimal system that allows you to set it up exactly the way you want, then Crux is a pleasure to use. If you’re looking for a traditionally Unix-like Linux, you should take a look at Crux.