Linux.com

Feature: Linux

My Workstation OS: Linux From Scratch

By Vinod Vijayarajan on June 03, 2005 (8:00:00 AM)

Share    Print    Comments   

Like nearly every other person who has contributed to this series, I have tinkered around with my share of Linux distributions. I happened on Linux From Scratch (LFS) about an year and a half ago. With LFS, my choices run deep into the system -- into matters such as which shell to run, what feature of glibc to use, and how to tailor boot scripts. LFS 6.0, which is what I have built my system around, comes with gcc 3.4.1 (which is used to build everything else), a fairly recent CVS build of glibc 2.3.4 (which the LFS team provides for download), kernel 2.6.8.1, and udev.

LFS is a source-based distribution, and that detail alone nearly put me off it the first time around. My impression of typical source-based distros is that I'll be sitting around twiddling my thumbs until the installer (downloads and) builds each package. During that time, I'll have no system to work with, and except for the start when I specify some compiler options and the like, I have no further say in the process of building the system.

LFS was different. LFS is probably the only Linux distribution in which building the system is as much part of the experience as working on it. LFS must be built alongside an existing Linux distribution. This allows you flexibility in choosing the best compiler options for a particular package. It lets you research packages on the Net or elsewhere throughly before installing them. You can revert to your existing system if something goes awry. For a tinkerer such as I, this is manna. When I built my system, I happily spent hours looking around, selecting packages and options to use on my system. The whole procedure entails an unbeatable learning experience in that you actually watch your system grow from the basic toolchain to a desktop.

LFS is, in the strict definition of the term, not a distribution. It is rather a set of detailed and meticulously assembled instructions for building a custom Linux system. Laid out in order in a comprehensive book, the instructions describe each package that goes into your system, offer and suggest build options that can help you extract that little extra out of the package, and include patches that fix or enhance something in a package.

LFS does not bind you to a particular package set. You can choose to build a basic barebones system or a full-fledged desktop system. You can choose custom options for your particular hardware setup. This ability to customize your operating system helps you avoid the inevitable bloat and performance penalty that most available distributions suffer from, since they have to align their package set, options, and features to a lowest common denominator. In LFS, the lowest common denominator is you.

Given that you can squeeze the most from your hardware in LFS, it's no surprise that a system built thusly is the fastest you can get running. GNOME, KDE, and even OpenOffice.org are perceptibly faster in load and execution than under other distros.

LFS, on its own, can help you build a barebones system suitable for some basic console-based work or a server system. For a workstation, however, you'll need other pieces of software (system tools, libraries, languages, browsers, etc.) to fill out your system. That's where Beyond Linux From Scratch comes in. BLFS is a comprehensive follow-through to LFS that outlines build procedures for X (you have a choice of XFree86 or Xorg), a staggering number of development libraries and languages (including Python), a choice of Web browsers, desktop environments (KDE 3.3.2, GNOME 2.8.x and XFCE4), a printing subsystem, and multimedia tools (Xine, MPlayer, and XMMS, among others). Formatted like LFS, BLFS fills the void that its parent may appear to suffer from in terms of workstation software.

You are not constrained to the package versions in the book, though I'd suggest you limit yourself to them until you get the hang of the build process. During install and after, you can use the procedures and order and dependency information outlined in the book to install later releases of packages.

If the book were not enough, the community around LFS has come up with several other helpful projects, including the Hints project (a treasure trove of tips you can use to enhance your LFS/BLFS setup), the Patches project (which collects and test patches for later revisions of LFS/BLFS packages), and the LFS Hackers list, which maintains notes on changes to build instructions for bleeding-edge package versions. There are other related projects too, such as Automated-LFS, which seeks to automate building some or most of the LFS system, and Hardened-LFS, which seeks to build a hardened LFS.

While the practical benefits of building and using an LFS system cannot be debated, the basic premise of its philosophy has unavoidable downsides. The biggest of these is the lack of a package management system. In LFS's defense, it can be argued and even grudgingly admitted that a package management system is alien to its sphere and that several hints and tools in the Hints database attempt to provide this functionality. Further, several existing systems (such as RPM, APT, and pacman) can be configured to work in LFS. However, I do wish for some native package management system that would download package upgrades, build them with the customisations I have chosen for the previous version of the package, query me when it encounters unknown options, and finally install the upgrade.

With LFS, there may be times when you're building your system that you wish you could just install and be done with it. But if you persist and allow yourself the time to tinker and tweak, you'll find yourself learning and appreciating the pieces that go into constructing a Linux system. This knowledge will stand you in good stead if something breaks later, and the undertaking as a whole will make the subsequent experience of working on your system feel like riding on a finely tuned, well-greased, custom-made car.

Building an LFS/BLFS system may be a challenge. Working on one is as close to distro heaven as it gets.

What's your desktop OS of choice? So far, we've heard from fans of FreeBSD, Mepis Linux, Debian, Xandros, Slackware, Windows XP, Lycoris, SUSE Professional, NetBSD, Ubuntu, FreeDOS, Libranet, Mandrakelinux, Arch Linux, Mac OS X, Knoppix, Linspire, Gentoo, PCLinuxOS, Yoper, Fedora Core 3, Windows 2000 Professional, Damn Small Linux, VidaLinux, Kanotix, VectorLinux, Irix, and Scientific Linux.

Share    Print    Comments   

Comments

on My Workstation OS: Linux From Scratch

Note: Comments are owned by the poster. We are not responsible for their content.

proof reading

Posted by: WarPengi on June 03, 2005 07:52 PM
"a fairly recent CVS build of gcc 2.3.4"

Should be "glibc", not gcc.

#

An Alternative that Includes a Package Manager

Posted by: Anonymous Coward on June 04, 2005 01:37 AM
I'm going to put my 0.002 worth in on this subject.
The alternative I'm talking about is Gentoo. It builds everything from source, includes a centralized package maintenance tool called portage and allows you to customize the build process through the setting of UseFlags and c/c++ options.

The c/c++ options are generally set system wide and affect the basic compiler, these options are derived straight from the gcc group settings and allows some flexibility in building. The main compiler option flexibility though, comes from use flags. These flags allow for the usage of various package features such a KDE or Gnome support and are basically implemented during the "make" proccess.

That flexibility has now been enhanced through the usage of a package.use listing that covers any special flags you desire to be added to specific packages. An example is mplayer: it includes several special flags/options in it's make file that can be enabled here, such as matrox/nvidia card support.

For those LFS/BLFS folks who are looking for a centralized repository, check the gentoo<nobr> <wbr></nobr>/distfiles on a mirror <a href="http://www.gentoo.org/main/en/mirrors.xml" title="gentoo.org">http://www.gentoo.org/main/en/mirrors.xml</a gentoo.org> for them since gentoo does depend upon them. There are a few that are not available such as Nvidia's or Sun's binaries because they restrict access and as in the freebsd ports system must be downloaded from the source only.

#

Re:An Alternative that Includes a Package Manager

Posted by: Anonymous Coward on June 04, 2005 03:30 AM
Whoooosh!

That was the point of LFS going over your head.

#

LFS is geek cool

Posted by: WarPengi on June 03, 2005 08:14 PM
Nice article by the way. I built an LFS but still have not completed the BLFS. The lack of package management is a big show stopper for me. I like using a distro that allows for security updates with just a command line input or a few clicks on a GUI. That means that a BLFS system will probably not be what I want to run on a daily basis. That said, the educational experience of building an LFS is unsurpassed. For anyone who truly wants to learn the guts of Gnu/Linux, LFS will take you where no distro has taken you before.

#

Source-based "barebones" distros

Posted by: Anonymous Coward on June 03, 2005 09:11 PM
If you like LFS but want some package management system, you could do worse than checking <a href="http://www.sourcemage.org/" title="sourcemage.org">SourceMage</a sourcemage.org> or <a href="http://lunar-linux.org/" title="lunar-linux.org">Lunar Linux</a lunar-linux.org>. Both allow almost the same level of control you get with LFS/BLFS, with good package managements systems and integrity checking thrown in. I do use SourceMage for almost all my machines (one server is still running Mandrake, I haven't had the time to switch it over), and have helped creating packages for SourceMage using the BLFS hints almost without change.
jbernardo at sourcemage.org

#

Re:Source-based "barebones" distros

Posted by: Anonymous Coward on June 05, 2005 07:04 PM
Oh god....building a distro from source packages using scripts is NOT the same as building one from scratch. You might as well be using SRPMS. You don't learn anything using scripts.

#

Re:Source-based "barebones" distros

Posted by: Stumbles on June 05, 2005 09:58 PM
I think your statements are way to general. With LFS you do have to monkey around at the most elemental levels to get a bootable system. With Lunar-Linux you don't have to do that. I don't see the real advantage there. Especially since you almost always end up with a sysvinit type environment anyway. So at most that point is moot.



Nor would I say using SRPMS is exactly the same as using bash scripts (like Lunar-Linux uses) though they do acheive the same results. Though I see little difference in the end results of the method used by LFS. In any case your just talking about differenct package management systems. Which road you take is personal choice.



My personal systems run Lunar-Linux and I have learned a great deal from the "scripts". Some of that is realated to it's method of package management but a lot also about compiling and installing source based software fresh from the author(s).



Having used several RPM base distros and I was very surprised at the differences in the look/feel, menu layout, etc of KDE (as an example) when I compiled it on Lunar-Linux. It then dawned on me that what I was looking at was how the original authors intended it to look. I've since grown a slight displeasure of the RPM based distros interpretation of life, universe and everything.

#

Re:Source-based "barebones" distros

Posted by: Anonymous Coward on June 06, 2005 07:34 PM
Obviously, you completely missed the point of LFS, like you say : "I don't see the real advantage there". The point is the control and the learning experience BTW, which are unrivaled in LFS. There is another project, named DIY Linux, that is an LFS++, even more optimized. And you are wrong, everyone does not end up with a sysvinit type environment : I have a LFS based system since 2001, and I run with simpleinit-msb since I started it. When most people still complain about complexicity of boot scripts, parallelisation of boot scripts, I have all that since 2001. Perhaps now you can start to understand the level of control LFS gives you.

It's amazing you don't see the difference between using SRPMS and bash scripts. Anyway, people like me do not use bash scripts, they use nALFS, and use paco in their XML file as package management. It's WAY easier to make a XML file for nALFS (I have one template for my XML files, and do everything with it) than a SRPMS, and no need for a complicated database tool. And with LFS, you get everything as it was intended by the original authors. So basically, you rarely have a problem. Of course, when you're bleeding edge, you have to make some patches here and there.

The only time consuming task with LFS, is when you start. You have to learn and write your XML files for nALFS.
And then, it's very fast. For example, updating KDE for me is a matter of modifying the version numbers in my XML package file, then launch nALFS, and install what I called "KDE->base". Then it downloads, compile and install everything (and stops if there is an error). I get KDE entirely compiled the day after its released, generally speaking.

#

Building

Posted by: Anonymous Coward on June 03, 2005 09:29 PM

LFS is probably the only Linux distribution in which building the system is as much part of the experience as working on it.


*cough* Gentoo *cough*

#

Re:Building

Posted by: blindcoder on June 03, 2005 09:44 PM
changing a few options in a config file, issuing emerge * and coming back three days later and having a complete system does not count here<nobr> <wbr></nobr>:)

#

Re:Building

Posted by: boschtoo on June 03, 2005 10:22 PM
I was on Fedora before, and wanted to get a OS where (unlike Red Hat, Mandrake or Microsoft) I have the full control of everything - I went with LFS for a while, until I tried out Gentoo... there are several ways one can use Gentoo! You don't need absolutely to use the eBuilds.
On the other side I agree that, me too, I have learned a whole bunch with LFS that you won't learn in any other... hmmm... OS? LFS is no distro in fact!

#

Re:Building

Posted by: Anonymous Coward on June 03, 2005 11:44 PM
3 days?
Sorry dude, but if you havent notice IT BUILDS EVERYTHING FROM SOURCE, this will take time on any computer, and im damm sure it takes longer to build a LFS system.
Its called building a system to your liking, and what YOU want in it. With other distros you dont get much choice on how things are compiled/installed.

#

Re:Building

Posted by: Anonymous Coward on June 06, 2005 07:45 PM
And you would be completely wrong.
Search for one complete system referenced at <a href="http://www.linuxfromscratch.org/~bdubbs/about.html" title="linuxfromscratch.org">http://www.linuxfromscratch.org/~bdubbs/about.htm<nobr>l<wbr></nobr> </a linuxfromscratch.org>

I have one complete LFS built in less than 4 hours on my bi-AMD 2200+, and the second CPU does not speed the process much.
Of course, it is automated entirely by nALFS.

#

Re:Building

Posted by: Anonymous Coward on June 07, 2005 09:15 AM
Gentoo is from source, but it is not a distribution
where you build it yourself. Which is isn't a bad thing, but doesn't serve the same purpose as LFS.
LFS is a practical tutorial. Gentoo is a practical distro. You wouldn't pick Gentoo if your goal is to learn how a Linux distro is built.

#

alternatives

Posted by: Anonymous Coward on June 03, 2005 10:32 PM
However, I do wish for some native package management system that would download package upgrades, build them with the customisations I have chosen for the previous version of the package, query me when it encounters unknown options, and finally install the upgrade.


gentoo's emerge??

#

gcc 3.4.1?

Posted by: Anonymous Coward on June 04, 2005 02:43 PM
You compiled your kernel with a version of gcc other than 2.95.3? Brave motherfucker.

#

Re:gcc 3.4.1?

Posted by: Anonymous Coward on June 05, 2005 05:43 PM
Well... he wasnt the one who wrote the LFS book. So go tell in lfs mailing list.

#

gcc3+ supported for 2.6

Posted by: Anonymous Coward on June 05, 2005 06:04 PM
Actually gcc3+ is the supported gcc for 2.6 kernels.
-ck

#

Re:gcc 3.4.1?

Posted by: Anonymous Coward on June 06, 2005 12:10 AM
The LFS book states:

"NPTL requires the kernel to be compiled with GCC 3.x, in this case 3.4.1. Compiling with 2.95.x is known to cause failures in the glibc test suite, so it is not recommended to compile the kernel with gcc 2.95.x."

#

LFS is about the learning experience

Posted by: lzs on June 06, 2005 10:26 AM
Your article is a good introduction to LFS.

Just to share a comment or two. The way I see LFS is that it's a learning experience. As your article describes, LFS is "a set of detailed and meticulously assembled instructions for building a custom Linux system".

Some people however approach LFS with the expectation of a distro not unlike say Gentoo, and then wonder about package management, the chore of rebuilding, maintenance, or the lack of some feature or other. This would be irrelevant to say the least, because the LFS is a book about doing something, and not so much about the end result itself. After someone has gone through the LFS book to build their own system, they would better understand and better equipped to figure out the other nifty features if not to at least try to automate the tasks they've gone through.

Perhaps it should be stressed more that LFS is a book, not a distro.

#

My Workstation OS: Linux From Scratch

Posted by: Anonymous [ip: 58.69.7.74] on February 01, 2008 02:09 AM
Hi,
Im reading this review about LFS, because I just happened to download live CD of LFS. Im new to Linux, few months, but I was able to go through few distros already. Starting with Fedora and Ubuntu, I have ended up with Mint and Arch as working on my computer. I would like to hear something about Arch versus LFS comparison. I like Arch very much; it is very simple and fast distro, but Im thinking to give LFS a try.

#

My Workstation OS: Linux From Scratch

Posted by: Anonymous [ip: 213.63.155.146] on February 08, 2008 03:09 PM
I've also read this article about LFS/BLFS, and I'm also going to try LFS, but like it was said in here, the problem is that you don't have an package management system, even if you can fix one (I'm going to try pacman from arch, and probably I place my packages also on CD, in case something ever goes wrong). So I just guess that it is an cool way to have both worlds, because I also can learn, if I do the scripts for pacman myself (even if I've downloaded the .tar.bz2 packages from the web myself), and I will also be able to mantain backups of my just compiled packages... I also don't think as LFS/BLFS as bing an distro, but as being some kind of howto, that explains how to build an linux based system

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya