Out with the Old, in with the New
Total Page:16
File Type:pdf, Size:1020Kb
LINUX VOICE RE-THINKING THE FILESYSTEM GoboLinux: Out with the old, in with the new Explore this novel Linux distro, which throws out the old Unix filesystem hierarchy in favor of something more modern. BY MIKE SAUNDERS ne of my favorite sayings comes from the could be updated, without radically re-engineering mouth of Henry Spencer, author of the the whole OS. Say hello to GoboLinux [1]. O Regex regular expression parsing library GoboLinux is – for the most part – a regular Linux (among many other things). He said: “Those who do distribution, but with one major difference: it es- not understand Unix are condemned to reinvent it, chews the old filesystem hierarchy (/usr, /lib, /etc, poorly.” But, what exactly did he mean by this? Well, and so forth) in favor of a more modern design many hackers regard Unix as the pinnacle of operat- where each program lives in its own directory. In the- ing system design. Unix ory, this should make it pieces together many easier to distribute, install, ideas and technologies and remove programs. that make it a truly uni- Additionally, GoboLinux versal operating system, features its own boot sys- running on everything from wristwatches to super- tem that’s not based on the old SysVinit or BSD computers. The concepts and foundations on scripts – nor does it use Systemd. It’s a fascinating which it's based will be solid forever. distro, so in this article, I’ll show you how it works, Still, every few years, someone comes along how to install it, and where it’s heading. promising a revolutionary OS that discards all the old 1970s baggage and implements everything A Bit of Background using the latest buzzwords du jour. Why imple- Most Linux distributions adhere to the Filesys- ment all that old Unix gunk when you can build an tem Hierarchy Standard, aka FHS [2], which de- OS in a version 0.0.3 language someone just termines the directory structure in a typical posted on Hacker News? Why should everything Linux installation – i.e., which files and directo- be a file when obviously JSON is the only sensible ries go where on the drive. The FHS is heavily way to store data? And who needs a filesystem inspired by older Unix flavors and leads to a anyway? setup like this: But the same thing tends to happen to trendy / (aka root directory) – The highest level direc- OSes like these. Over time, they either die off or tory, with nothing above. This contains all other di- end up becoming more and more Unix-like. The rectories (and their subdirectories). developers realize that Unix isn’t actually old and /etc – Configuration files. This really is a mixed clunky but is actually a rather smart design bunch, containing text-based config files for sys- crafted by hackers with a lot of experience. Unix tem-wide applications and services, scripts, and may have been written for the mainframes and other bits ‘n’ pieces. There’s very little standardiza- minicomputers of the 1970s, but it was very easily tion in here, with each file having its own format adaptable to smaller devices. It’s no coincidence and syntax, and various subdirectories. that Unix flavors pretty much run the world now: /bin and /sbin – Base-system binaries for regu- Linux and FreeBSD on servers, Android on lar users and the superuser (root), respectively. phones, Mac OS on many desktops and laptops. These are available immediately after booting, be- Even Microsoft is trying to get in on the action fore other filesystem partitions are mounted. Here’s with its Windows Subsystem for Linux. where you find the Bash shell and other tools. So Unix is a solid and well thought-out OS, and /lib – Historically, this contained base-system li- straying too far from its principles can be risky. braries, like the C library that almost every pro- However, that doesn’t mean you should be overly gram depends on. Today, it also contains Linux dogmatic and resist any change. Arguably, a few kernel modules, systemd scripts (on distros that things in Unix-like systems are a bit archaic and use it), and various other components. 66 FEBRUARY 2017 ISSUE 195 LINUX-MAGAZINE.COM | LINUXPROMAGAZINE.COM RE-THINKING THE FILESYSTEM LINUX VOICE /usr and /usr/lib – Programs and libraries for moments of booting up, GoboLinux will ask you to normal user accounts. This is typically the largest select a language and keyboard map. Then you’ll part of an installation and includes non-base soft- land on a root command-line prompt – which ware – the X Window System, desktop environ- probably wasn’t what you’re expecting, so enter ments, Firefox, etc. In many older Unix installa- startx to bring up the X Window System and ac- tions, /usr would be on a separate partition and cess the GUI. From there, you’ll find an installer mounted later during the boot process to keep icon on the desktop, so double-click that and fol- user apps separate from the base system. low the prompts. Those are some of the most important directo- If you have trouble running startx, though, ries in a typical Linux installation, but there are you’ll need to perform a text-mode installation many more as well. You can see some historical (Figure 1) – enter: baggage in there, with some directories serving multiple purposes, bits of overlap, and not much Installer in the way of standardization (despite the best ef- forts of the FHS). Most significantly, though, is Note the capital letter at the start – this is your that a single program may have files in many dif- first taste of how GoboLinux does things! Use Tab ferent directories. Have a look at some packages to switch between buttons and other elements on on your current Linux installation and see where the screen, and Enter to select them. You’ll be they scatter files. For instance, on a .deb-based prompted to choose the partition(s) on your drive distro: where GoboLinux should be installed, the package sets to be copied over (it’s best to leave them all dpkg -L bash selected), and where to install the boot loader. For the most part, you can just accept the defaults This shows that the Bash package drops files into and keep selecting Next. /etc, /bin, /usr, and various sub-directories of /usr. You’ll be prompted to set a password for root, the There is some logic to this, but it makes a package administrator user, and also create a normal user manager pretty much essential. How can you eas- account for your day-to-day work. Lastly, the Gobo- ily remove a program when its files are scattered Linux installer will perform a final check that you’re over so many different directories? How can you ready to go ahead with the options you selected – if tell which file belongs to which program? Tools like so, the files will be installed and then you can re- dpkg, apt-get, yum, rpm, etc. take the pain of this boot. If GoboLinux boots into text mode, you can away, but you could argue that they are just more log in as your regular user account and enter startx layers of complexity and abstraction on top of to bring up the desktop (Figure 2). what should be a simple design. How does GoboLinux approach this? Essentially, Filesystem Magic it tries to redefine the filesystem. Instead of pro- To see how GoboLinux handles software, open grams being scattered all over the drive and hard a terminal and cd into the /Programs directory. to manage without specific tools, each program is There you’ll see a bunch of directories, one per placed in its own subdirectory of /Programs, so they program, so try switching into one – e.g., Nano. are easy to locate, change, and remove. In Gobo- Then you’ll see three directories: one with a ver- Linux, “the filesystem is the package manager,” sion number, which contains the binary and Figure 1: GoboLinux’s text- drastically simplifying the software management support files for that version of Nano. There’s mode installer gets you set process. On top of that, the distro makes it possible also Current, which is a symbolic link to the ver- up easily – you can mostly to have multiple versions of the same program in- sion currently in use (this is how you can have just hit Enter. stalled, side by side. Try doing that with your regu- lar Linux distro – even with the most awesome command-line gymnastics and symbolic link she- nanigans, 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 LINUX-MAGAZINE.COM | LINUXPROMAGAZINE.COM ISSUE 195 FEBRUARY 2017 67 LINUX VOICE RE-THINKING THE FILESYSTEM 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.