Out with the old, in with the new


Article from Issue 195/2017

Explore this novel Linux distro, which throws out the old Unix filesystem hierarchy in favor of something more modern.

One of my favorite sayings comes from the mouth of Henry Spencer, author of the Regex regular expression parsing library (among many other things). He said: "Those who do not understand Unix are condemned to reinvent it, poorly." But, what exactly did he mean by this? Well, many hackers regard Unix as the pinnacle of operating system design. Unix pieces together many ideas and technologies that make it a truly universal operating system, running on everything from wristwatches to supercomputers. The concepts and foundations on which it's based will be solid forever.

Still, every few years, someone comes along promising a revolutionary OS that discards all the old 1970s baggage and implements everything using the latest buzzwords du jour. Why implement all that old Unix gunk when you can build an OS in a version 0.0.3 language someone just posted on Hacker News? Why should everything be a file when obviously JSON is the only sensible way to store data? And who needs a filesystem anyway?

But the same thing tends to happen to trendy OSes like these. Over time, they either die off or end up becoming more and more Unix-like. The developers realize that Unix isn't actually old and clunky but is actually a rather smart design crafted by hackers with a lot of experience. Unix may have been written for the mainframes and minicomputers of the 1970s, but it was very easily adaptable to smaller devices. It's no coincidence that Unix flavors pretty much run the world now: Linux and FreeBSD on servers, Android on phones, Mac OS on many desktops and laptops. Even Microsoft is trying to get in on the action with its Windows Subsystem for Linux.

So Unix is a solid and well thought-out OS, and straying too far from its principles can be risky. However, that doesn't mean you should be overly dogmatic and resist any change. Arguably, a few things in Unix-like systems are a bit archaic and could be updated, without radically re-engineering the whole OS. Say hello to GoboLinux [1].

GoboLinux is – for the most part – a regular Linux distribution, but with one major difference: it eschews the old filesystem hierarchy (/usr, /lib, /etc, and so forth) in favor of a more modern design where each program lives in its own directory. In theory, this should make it easier to distribute, install, and remove programs. Additionally, GoboLinux features its own boot system that's not based on the old SysVinit or BSD scripts – nor does it use Systemd. It's a fascinating distro, so in this article, I'll show you how it works, how to install it, and where it's heading.

A Bit of Background

Most Linux distributions adhere to the Filesystem Hierarchy Standard, aka FHS [2], which determines the directory structure in a typical Linux installation – i.e., which files and directories go where on the drive. The FHS is heavily inspired by older Unix flavors and leads to a setup like this:

/ (aka root directory) – The highest level directory, with nothing above. This contains all other directories (and their subdirectories).

/etc – Configuration files. This really is a mixed bunch, containing text-based config files for system-wide applications and services, scripts, and other bits 'n' pieces. There's very little standardization in here, with each file having its own format and syntax, and various subdirectories.

/bin and /sbin – Base-system binaries for regular users and the superuser (root), respectively. These are available immediately after booting, before other filesystem partitions are mounted. Here's where you find the Bash shell and other tools.

/lib – Historically, this contained base-system libraries, like the C library that almost every program depends on. Today, it also contains Linux kernel modules, systemd scripts (on distros that use it), and various other components.

/usr and /usr/lib – Programs and libraries for normal user accounts. This is typically the largest part of an installation and includes non-base software – the X Window System, desktop environments, Firefox, etc. In many older Unix installations, /usr would be on a separate partition and mounted later during the boot process to keep user apps separate from the base system.

Those are some of the most important directories in a typical Linux installation, but there are many more as well. You can see some historical baggage in there, with some directories serving multiple purposes, bits of overlap, and not much in the way of standardization (despite the best efforts of the FHS). Most significantly, though, is that a single program may have files in many different directories. Have a look at some packages on your current Linux installation and see where they scatter files. For instance, on a .deb-based distro:

dpkg -L bash

This shows that the Bash package drops files into /etc, /bin, /usr, and various sub-directories of /usr. There is some logic to this, but it makes a package manager pretty much essential. How can you easily remove a program when its files are scattered over so many different directories? How can you tell which file belongs to which program? Tools like dpkg, apt-get, yum, rpm, etc. take the pain of this away, but you could argue that they are just more layers of complexity and abstraction on top of what should be a simple design.

How does GoboLinux approach this? Essentially, it tries to redefine the filesystem. Instead of programs being scattered all over the drive and hard to manage without specific tools, each program is placed in its own subdirectory of /Programs, so they are easy to locate, change, and remove. In GoboLinux, "the filesystem is the package manager," drastically simplifying the software management process. On top of that, the distro makes it possible to have multiple versions of the same program installed, side by side. Try doing that with your regular Linux distro – even with the most awesome command-line gymnastics and symbolic link shenanigans, it's tough to achieve.

Installing GoboLinux

You may be reticent at this stage to switch to GoboLinux as your primary distro. Fair enough – I recommend exploring it in a virtual machine such as VirtualBox (or just installing it on a spare PC). Go to the download page [3] and grab the ISO image of the latest release – 016 beta at the time of writing, but it may be final when you read this.

In VirtualBox, assign it to the emulated DVD drive and start the virtual machine. After a few moments of booting up, GoboLinux will ask you to select a language and keyboard map. Then you'll land on a root command-line prompt – which probably wasn't what you're expecting, so enter startx to bring up the X Window System and access the GUI. From there, you'll find an installer icon on the desktop, so double-click that and follow the prompts.

If you have trouble running startx, though, you'll need to perform a text-mode installation (Figure 1) – enter:

Figure 1: GoboLinux's text-mode installer gets you set up easily – you can mostly just hit Enter.

Note the capital letter at the start – this is your first taste of how GoboLinux does things! Use Tab to switch between buttons and other elements on the screen, and Enter to select them. You'll be prompted to choose the partition(s) on your drive where GoboLinux should be installed, the package sets to be copied over (it's best to leave them all selected), and where to install the boot loader. For the most part, you can just accept the defaults and keep selecting Next.

You'll be prompted to set a password for root, the administrator user, and also create a normal user account for your day-to-day work. Lastly, the GoboLinux installer will perform a final check that you're ready to go ahead with the options you selected – if so, the files will be installed and then you can reboot. If GoboLinux boots into text mode, you can log in as your regular user account and enter startx to bring up the desktop (Figure 2).

Figure 2: The Awesome window manager is included with version 016, along with a rather moody theme.

Filesystem Magic

To see how GoboLinux handles software, open a terminal and cd into the /Programs directory. There you'll see a bunch of directories, one per program, so try switching into one – e.g., Nano. Then you'll see three directories: one with a version number, which contains the binary and support files for that version of Nano. There's also Current, which is a symbolic link to the version currently in use (this is how you can have multiple versions installed at any one time), and Settings, which contains files that would normally be stored for system-wide usage in /etc (e.g., nanorc).

This system doesn't just apply to programs but to libraries as well. For instance, Glibc (the GNU C Library) can be found in /Programs/Glibc/2.24/lib). As for "infrastructure" software – i.e., not standalone desktop apps – those are in /Programs, too. You'll find the X Window System in /Programs/Xorg-server, binaries from Coreutils in /Programs/Coreutils/Current/bin, and so on.

This is all good and well, but how does GoboLinux keep track of all these, without having to use a giant $PATH environment variable? Well, take a look in the /System/Index directory. There you'll see bin and lib directories containing huge amounts of symbolic links to all of the programs and libraries stored separately in the /Programs folder. For instance, go into bin and do ls -l nano, and you'll see something like:

nano -> ../../../Programs/Nano/2.7.0/bin/nano

This shows you how GoboLinux knows where to find Nano (and other programs) in the installation. The /System directory contains other components, neatly arranged into their own sub-folders, as well. You'll see that the kernel can be found there (along with its modules), while the Settings directory does the job of a traditional /etc.

Now, if you cd into the root (/) directory and look around with ls -a, you'll notice something odd: Apart from lost+found, none of the usual Unix-y filesystem locations can be seen. There's no /etc, /lib, /tmp, or anything like that (Figure 3). What's going on here? Has GoboLinux done away with them all completely?

Figure 3: Here you can see what the root directory contains – /etc, /lib, and so on are all hidden by default.

Well, not quite. GoboLinux is set up with a kernel patch that hides these directories by default. They do actually exist, so you can cd /etc and then look around inside, but they're not shown to you in your daily work. This is all about simplicity: Users and admins shouldn't need to be concerned about the "legacy" Unix filesystem, apart from in extreme cases. For most tasks of editing config files, updating programs, and the like, these should all be possible via the newer GoboLinux filesystem structure.

Helpfully, though, the distro includes a small tool for changing this behavior. Enter gobohide -l to list all of the Unix-ish directories that are hidden by default. To disable hiding, so that one is shown at the command prompt and in your file manager, use the following:

gobohide -u /etc

Now /etc will be visible. You'll see that it's a symbolic link to the /System/Settings directory you were in earlier, however, so it's not just duplicated content.

Have fun exploring the system: Clearly a lot of thought has been put into the design, and it works surprisingly well given the amount of software out there that expects traditional Unix-style filesystem layouts. GoboLinux feels well engineered, and when you go back to a regular distro with its package files scattered all over the place, everything seems rather disjointed and thrown together.

Still, GoboLinux has its rough edges: I had issues getting some apps to work (see the "Adding New Software" box), and there are some questions about its long-term viability (there was a major gap of six years between releases 014 and 015). But even if GoboLinux isn't going to be your daily driver any time soon, it's good to try out a distro that dares to do things differently – after all, as great as Unix and Linux are, you should always give room for improvements. And, given that GoboLinux's novel directory structure can still be used to create a working distro, I'd like to see some elements of it incorporated into the mainstream distros at some point (see the "NixOS: Another Alternative" box). Fedora devs, what do you reckon?

Adding New Software

GoboLinux is primarily a source-based distro, so whenever you want a new piece of software, you issue a command that downloads the program's source code (along with the code for its dependencies) and builds the whole caboodle. First, take a look at the available "recipes" [4] – that is, the scripts and information bundles for various open source apps and tools (Figure 4).

Let's say you want to install Qemu, the rather awesome PC (and other machine) emulator. Enter the following command:

Compile qemu

This will search for a matching recipe and tell you what it's going to download. If the app has a lot of dependencies, Compile will prompt you before grabbing them; enter "CA" for "compile all" to skip having to confirm for every single file.

Then, Compile builds the dependencies and the program itself and installs them into GoboLinux creating symbolic links accordingly so that older programs using Unix-like paths can still work with them. GoboLinux has a lot of recipes at its disposal, so you can find pretty much every major FOSS app and utility in there, although some of the versions are rather dated (Figure 5).

Figure 4: Look into /Programs/Nano and you can see how GoboLinux handles multiple app versions and meta information.
Figure 5: For some reason, GoboLinux includes the ridiculously outdated Mosaic browser. It loads almost nothing.

NixOS: Another Alternative

If GoboLinux has whetted your appetite for Linux distros that take an alternative approach to package management, take a look at NixOS [5] as well. This is built around Nix, a "fully functional package manager for Linux and other Unix systems that makes package management reliable and reproducible." The reproducible part is built upon checksums and other techniques that guarantee that binary packages match their source code equivalents. (In other words, nothing dodgy has been injected by the package creator in the building process.)

In terms of reliability, Nix packages exist in isolated read-only directories; updates don't overwrite the original files, so it's easy to revert back to the previous version of an app or library if you're having trouble with the new one. And, all updates are "atomic": They either succeed or they don't. So, if you're updating an app and the process gets interrupted half way (e.g., due to power loss), you won't end up with an app where half the files are from one version, and half from another.

While Nix has been quite innovative here, some other mainstream distros are starting to adopt similar approaches. Take Ubuntu, for example, with its Snap packages [6] – they are also designed to be updated safely and are isolated from one another so that one badly behaving app can't cause chaos on the whole system.


  1. GoboLinux: http://www.gobolinux.org
  2. Filesystem Hierarchy Standard: https://wiki.linuxfoundation.org/lsb/fhs
  3. GoboLinux download: http://www.gobolinux.org/?page=downloads
  4. GoboLinux recipes: http://recipes.gobolinux.org
  5. NixOS: http://nixos.org
  6. Snap packages: http://snapcraft.io

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Next Gen Distributions

    With systemd poised to revolutionize the init process, we look at Linux distributions that have left the familiar path, use new approaches and techniques, and are paving the way for the next generation of Linux distros.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.