Hacker News

Ask HN: Is the Linux From Scratch project still relevant?

For those that wish to learn to build their own distro, is the Linux From Scratch project still a great place to start?


26 pointsjason_slack posted 3 months ago7 Comments
nextos said 3 months ago:

It is. But I have this radical idea that with a declarative toolbox like what NixOS offers, most distros are trivial.

Lots of simple distros are doable with a page or two of declarative Nix configuration. They are just some opinionated choices concerning a variety of components, a desktop environment and some default applications (or the lack of thereof). Gentoo is also a meta-distro in some ways.

Of course, if you want some fundamental changes, you might not be able to stretch NixOS that far. Or if you prefer an imperative approach to things.

IMHO, most distro designs (imperative/declarative, binary/source-based) have been explored already. Forking yet a new distro is not advisable, unless you have some novel ideas or just want the educational experience.

jason_slack said 3 months ago:

My goal is to have a very small distro, yet easily customizable so I can deploy it over and over very quickly with small changes, etc but also modern enough of a start to promote pull requests to the projects being used in the distro.

forgottenpass said 3 months ago:

LFS is a deep dive for learning, not a way to create a production base.

I'd suggest stripping down whatever distro you already like unless you have an exotic target platform or highly constrained resource (like embedded systems).

The off the shelf distros can typically be customized much smaller than their "minimal" images. That "minimal" usually means "a reasonable base for your headless server" not "the least amount of software needed to boot." You'll be able to stay in a packaging ecosystem and process you already know. Learn how to create a custom deployable image and with any luck you'll still be able to leverage their build systems, testing and repos.

If you are talking more constrained than that or an unusual architecture, Yocto seems to be where most of the embedded Linux folks are these days. That targets highly-configurable custom compiling everything from the ground up, lots of additional software packages are available to be layered in.

Koshkin said 3 months ago:

LFS is no help creating a new Linux distribution. Rather, it guides you though building a Linux installation on your computer. In that sense, LFS is a distribution. Yes, it could be a (rather odd) base for a new distribution, but you would definitely have better luck if you choose, say, Debian, Slackware or Arch as the base.

In general, what differentiates Linux distributions is, for the most part, package management, installation/configuration process, and the default theme. A brand new, original distribution would have to say something new about some of those, and LFS would be no help there - perhaps, other than just giving you an experience of building and running Linux and some GNU software, well, from scratch.

neilalexander said 3 months ago:

If you have plenty of free time then I would argue yes, if nothing else because it gives quite a bit of context for various things that make up a typical Linux installation. The big problem with LFS is that it's a laborious process and it's extremely easy to lose interest part way through as a result.

If you have less free time (or a not-so-great attention span) then I think that something like Buildroot is ultimately much more valuable. You get the flexibility to choose exactly what makes up your new installation and you are introduced to the sophisticated level of configurability that a system can have, but importantly, you don't have to be the one to compile every single bit of it.

dfeojm-zlib said 3 months ago:

It's useful. I looked at it last night for a refresher.

Also, look at other major distros. And, for building packages and patches, look at LFS, Free/Open/NetBSD ports, homebrew, macports, linuxbrew, habitat, NixOS, Debian, Ubuntu, Fedora, OpenSUSE and Arch. For security advisories, be sure to check the multitude of sources... note that more than few released packages ship vulns that need patching and some packages are essentially abandonded. Have a look at the old RHEL 5 NSA hardening guide and other major guides for Linux hardening too (be sure to compile things using modern toolchain hardening flags, and test them thoroughly and relentlessly to suss out gotchas).

The big things with distros is package updates and system upgrade securely delivered (Debian flavors are good at this), don't break a system and don't interrupt users unexpectedly. Most distros' packaging systems are flexible but confusing and under-documented packaging descriptions. Habitat and Arch are cleaner.

syn0byte said 3 months ago:

It's not a bad place to start. It still seems to link to a sysvinit style setup by default(good). There are systemd flavored versions available but the relative directions, size and time requirements should tell you plenty without me evangelizing against it.