DEV Community

Cover image for My thoughts and experiences with Linux From Scratch
Donald Sebastian Leung
Donald Sebastian Leung

Posted on • Updated on


My thoughts and experiences with Linux From Scratch

I've finally managed to build a working Linux system from scratch following version 11.1-systemd of Linux From Scratch (LFS), after failing my first attempt about a year ago. This post aims to share some of my experience and tips from completing the project.


I was properly introduced to Linux (or GNU/Linux as some would like to call it) in June 2020, when I entered a 6-month internship in a small but well-established firm specializing in firmware and control systems designed specifically for physics and quantum experiments. At the time, I found the philosophy behind GNU/Linux fascinating (I still do) and promptly earned my Linux Foundation Certified Systems Administrator (LFCS) certification in the following month (July 2020), which also happened to be my first professional certification outside of formal education. I have also switched all my existing laptops to Linux (Ubuntu on one, Fedora on another) since around September 2020, so I use Linux on a daily basis.

What are the prerequisites for attempting LFS?

LFS assumes a certain level of familiarity with Linux systems as you might expect, since building and installing various components of a Linux system from the ground up is no small feat and requires a lot of time and patience. First-time Linux users are definitely advised to try beginner-friendly distributions such as Ubuntu and Fedora, and gradually work their way towards more advanced distributions if desired. I personally found my LFCS background to be crucial in understanding the instructions presented in the LFS book, though LFCS certification (or equivalent, like RHCSA) is not a hard requirement. If you've successfully installed and managed a "difficult" distro such as Arch, Debian or Gentoo, then LFS might also be a logical next step.

Where should I install LFS?

Definitely do not attempt to install LFS on your main desktop or laptop if you haven't tried it before and do not know what you are doing, since it is quite possible to make a mistake along the way that renders your computer unbootable, in a way that may be difficult or impossible to recover the integrity and data of the original system.

If you do have a computer to spare that does not contain critical data, it can be used to attempt LFS, since in the event that you mess up, it is possible to simply re-install a functioning system and re-attempt LFS from there. It is also generally considered more educational to install LFS on bare metal compared to in a virtual machine (VM), though a drawback is that messing up may mean that you may have to forego days of hard work and start all over again.

The more convenient alternative, which I also chose, is to attempt LFS inside a VM. This way, VM snapshots can be made such that in case a mistake prevents the VM from booting and system rescue does not work, the VM can just be rolled back to a working snapshot and LFS can be resumed from a known good state instead of starting over from scratch.

Is LFS difficult?

Given that you have a working knowledge of the Linux command line, most of LFS is actually rather straightforward as the majority of commands presented in the book can be copied and executed as-is without modification. Though the compilation process for certain system components like GCC can take a lot of time ranging from hours to days on end depending on your hardware specs, so patience is key.

For me, the only tricky part is near the end where you have to figure out a working kernel configuration, and whether you have to configure dynamic module loading by placing appropriate files under /etc/modprobe.d. This section is hardware-specific, so you really need to have a good idea what options to enable (or disable) in the kernel, whether you need any specific device driver modules and whether they need to be somehow specified under /etc/modprobe.d to be loaded at system startup. Otherwise, the kernel could be successfully compiled and installed, but the resulting system could end in a kernel panic.

In the specific case of building LFS inside a KVM guest with x86_64 architecture, gives a reasonable starting configuration that can be easily modified to a working configuration by following the instructions in the LFS book. If, on the other hand, you generated a default configuration with make defconfig, it doesn't enable the VirtIO drivers required for KVM guests by default, and it is difficult to find and enable them through the menu selection if you do not know where you should be looking.

Next steps

The LFS system I built is currently very minimal and missing many commonly used utilities such as sudo or an OpenSSH server. I'll probably set those up shortly, then take a break and attempt Kubernetes the Hard Way before possibly resuming building the system with BLFS (or re-attempt LFS on bare metal, using a ~15 year old computer with only 1G of RAM). Stay tuned ;-)


LFS neofetch output

LFS login screen

LFS system version information

I am the 29460th registered LFS user

Top comments (1)

n8chz profile image
Lorraine Lee

Wat is registering a LFS install the new posting to comp.hack?

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git