REVIEW - How Linux Works, 3rd Edition - What every Superuser Should Know

Title:

How Linux Works, 3rd Edition - What every Superuser Should Know

Author:

Brian Ward

ISBN:

9781718500402

Publisher:

No Starch Press (2021)

Pages:

464

Reviewer:

Ian Bruntlett

Reviewed:

September 2021

Rating:

★★★★☆

Verdict: Recommended

This title is now in its Third Edition, spanning 17 chapters, a Bibliography, and an Index. Like the blurb says, “to truly master Linux, you need to understand its internals like how the system boots, how networking works, and what the kernel actually does” and it goes on to state “This edition has been thoroughly updated and expanded with added coverage of the Logical Volume Manager (LVM), virtualisation, and containers” as well as stating that new to this edition are:

  • Hands on coverage of the LVM, journald logging system, and IPv6.
  • Additional chapter on virtualisation featuring containers and cgroups.
  • Expanded discussion of systemd

The author has been working with Linux for a long time (since 1993) and has written The Linux Kernel HOWTO, The Linux Problem solver, and previous editions of this book.

The ‘Big Picture’ chapter gives a decent overview of a Linux system, with details to be filled in by later chapters.

The ‘Basic Commands and Directory Hierarchy’ chapter is “a guide to the Unix commands and utilities you’ll encounter throughout this book” – it acts as a foundation chapter for people getting used to the Linux Command Line (in this case, the bourne shell rather than Linux’s traditional bash). Whilst many Linux installations are single user, it would have been nice to have had some information about handling multi-user installations as well. The coverage of grep needs better examples. The coverage of online help (man, info) could do well to mention the use of ‘type’ to determine if a command is a built-in type as well as the use of ‘help’ to get help for built-in commands. Although 2.14 covers the redirection of output to stderr, the ‘Introduction to shell scripts’ chapter is curiously silent about its use in shell scripts.

‘Devices’ explains the device files (/dev, /sys) and the udevadm for the managing of devices and how the dd command is useful in this context. Although the ‘everything is a file’ metaphor prevails, there are instances where dedicated commands make life easier. The role of devtmpfs, udev, and udevadm are covered. The chapter concludes with an in-depth look at the kernel’s SCSI support and the software architecture that results from it.

‘Disks and Filesystems’ covers disk partitioning (including the fdisk and parted tools) and has a good explanation and diagram covering CHS (Cylinders, Heads, Sectors) and how it has been superseded by LBA (Logical Block Addressing). GPT is mentioned and UEFI is covered. File systems are covered in-depth, using the command line. There is a considerable chunk that covers LVM (Logical Volume Manager), again using the command line, the chapter concludes with the role of inodes.

‘How the Linux Kernel boots’ covers the events that happen from the firmware loading the bootloader thorough to user space starting (init). It also has a close look at GRUB 2 (Grand Unified Bootloader).

‘How user space starts’ covers modern init (systemd), traditional init (System V) as well as the Initial Ram File System and why booting from a rescue image (e.g. a suitable install ‘live’ image or SystemRescue CD) is the preferred approach to disaster recovery. It also covers shutting down the system. I found this chapter quite demanding – especially the section on systemd – that could be a book in its own right.

‘System Configuration’ is all about /etc covering system logging (via systemd) which happens to be a lot more powerful than the old style logging – but can’t quite replace it yet. The philosophy of /etc, along with details on /etc/passwd, time management (from the system clock to scheduling recurring tasks). Finally the chapter covers a myriad of topics about user ids – including PAM (Pluggable Authentication Modules).

The next chapter takes a “closer look at processes and resource utilization” and covers a lot of ground, detailing the fundamentals of CPU, memory, and I/O” – from the various “stat” commands through to the use of cgroups (control groups).

‘Understanding your network and its configuration’ covers a lot of ground – including subnets, routing, IPv4 and IPv6, DNS, DHCP, networking internals etc. It gets one thing wrong, though – 9.7 states that an IPv6 address has 32 bytes – it actually has 16 bytes. The next chapter, ‘Network Applications and Services’ covers higher level matters and also debugging at this layer. I don’t know enough about networking to verify the accuracy of these two chapters.

‘Introduction to Shell Scripts’ is an introduction to the Bourne Shell – why bash isn’t covered, I don’t know – but that is a minor issue. As bash is the default shell for most (all?) Linuxes, the chapter should have a link for the GNU bash manual (www.gnu.org/software/bash/manual) and note the key differences between sh and bash. The shellcheck (www.shellcheck.net) tool for “finding bugs in shellscripts” isn’t mentioned either.

‘Network File Transfer and Sharing’ covers a variety of network file transfer and sharing methods. There are some interesting things here – most of which are out the scope of my experience. To summarise, the networking options handled by this chapter covers using Python’s HTTP server, rsync (but not its graphical front-end grsync), file sharing (Samba, SSHFS, NFS).

The ‘User Environments’ chapter is all about customising things largely experienced at the command line.

‘A brief survey of the Linux Desktop and Printing’ discusses how GUIs are structured on Linux (X, Wayland) and covers some of the command line utilities for dealing with the GUI. The desktop bus (D-Bus) is briefly dealt with – suggestions for further information would have been nice. Finally, this chapter concludes with a discussion of printing.

‘Development Tools’ is a solid introduction to building C programs, either dynamically or statically linked, using make. Other things are touched on – Lex and Yacc (also mentioning Flex and Bison), scripting languages and Java. It would have been useful if the examples’ source code was available to download to experiment with. Again, it does not mention that the GNU manuals are available online (www.gnu.org/software).

‘Introduction to Compiling Software from C Source Code’ is all about building and installing software that is installed using the GNU autotools suite. CMake is mentioned but no references given. The coverage of three popular package management systems (.deb, .rpm, and snap) is minimal.

‘Virtualisation’ is the final chapter. It explains the terminology involved, with an example for Docker/Podman. LXC and Kubernetes are also mentioned.

There is a Bibliography which lists books only. Given the dynamic nature of the subject, references to relevant websites, mailing lists, and forums would have been very helpful. As would links to the online manuals for the many tools covered. Also, an online errata would be a good idea.

To conclude, the Linux Kernel and its associated utilities are a huge topic. No one can be an expert in everything. This book provides an overview of Linux, with some information on how to dive deeper into its topics.

Recommended.

Website: nostarch.com/howlinuxworks3