LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Blogs > The Slacker's Blog
User Name
Password

Notices

This is a semi-random collection of posts on nearly all things Slackware and Linux-related -- at least as I see it.
Rate this Entry

A slacker builds Linux From Scratch!

Posted 10-12-2010 at 09:29 AM by Lufbery

Once again I'm writing about another "distribution" purely from a Slackware user's perspective. But this is a little different. I put distribution in quotes because Linux from Scratch (LFS) is a distribution in the same way that corn meal, flour, sugar, baking powder, salt, and an egg is corn bread -- you have to make it yourself following a recipe. Everything is built from source.

I successfully built an LFS system, and surprisingly learned a lot about Slackware at the same time.

The LFS web site provides the recipe and the ingredients (the maintainers make available both links to the software sources and a nice tarball with all of the sources and patches in one place). But more than that, it provides a lot of explanatory material to go with the build instructions. If one pays attention, one can learn a lot about how GNU/Linux works.

That last should sound familiar to slackers. The oft-repeated mantra, “If you learn Redhat (or Ubuntu or Debian), you learn Redhat, but if you learn Slackware, you learn Linux,” is a rallying cry for Slackware users. I’m not sure it’s precisely true -- not a lot of Linux distributions use the BSD-style initiation/boot scripts -- but it is pretty close to the truth. There aren’t a lot of patches to upstream sources and slackers have to do a bunch of configuration by editing text files. LFS is like Slackware in that regard, just more so.

Quick and Dirty Take Home Message

1) Is LFS worth the time and effort to build?

Absolutely!

2) Will I learn a lot about Slackware by building LFS?

Yes.

3) Is it hard to build?

No; especially not for Slackware users, many of whom are used to compiling software and configuring things by hand.

4) Does it take a long time?

How much time do you have? It took me two months worth of evenings and some time on weekends. I’d spend an hour or two on it after my kids went to bed on most evenings. I hit a few snags and had to backtrack a couple of times. I estimate 80 hours or so worth of work, but that includes the time to compile all of the packages, during which I could do other work. I’ve got a pretty fast computer, but not the fasted available. Your compile time could be much shorter or longer than mine. I also did more than strictly follow the LFS book; I used a package management scheme where I built and installed each package as a non-privileged user. That took more time, but not having package management, which is the default for LFS, was anathema to me. Finally, I added time to the build by documenting it as I went. One could probably build the whole thing in a weekend if one is simply following the book, running a pretty fast computer, and not doing much else.

5) Okay, but is the finished LFS system useful?

No, or yes, depending on what you do. The resulting system is really fast, tight, optimized for one’s own hardware, and really, really basic. If you want to actually do any work, you’ve got to build and install a lot more software, which is detailed in the “Beyond Linux from Scratch” (BLFS) project.

The Details

I built LFS version 6.6 (version 6.7 was release when I was halfway through my build) using 32-bit Slackware 13.1 running in a QEMU-KVM virtual machine. Slackware64_13.1 was the virtual machine’s host, and my regular computer, but that’s not relevant to the LFS build. Slackware 13.1 was the perfect host for LFS. Nothing needed to be added to it or recompiled to properly build the temporary LFS toolchain, which one then uses to build the LFS system. In other words, Slackware’s native development environment is fantastic for projects like this.

I did a few things differently than the instructions. As mentioned above, I used a package users scheme for package management. Additionally, the LFS book has one installing Vim, but I installed Emacs and Nano instead. Frankly, the joke about Emacs being a very good operating system with a mediocre text editor is uncomfortably close to the truth. With Emacs installed, the final LFS system is actually very useful for a lot of what I do with a computer. Finally, the LFS book calls for building and installing Grub2 and then overwriting one’s boot sector after configuring it to boot the new LFS and existing OSs on the system. I skipped that step and simply added LFS to LILO after I was done. I didn’t feel like learning all about a new boot loader at this point.

Why is LFS valuable to Slackware Users?

The bottom line, if you are like me, is that you can read about something and research it, but until you do it, you won’t really understand it. The key is understanding not just what goes into a Linux system, but how everything interacts.

After 80 hours of admittedly fun work (I’m a geek), I’ve got an extremely basic GNU/Linux system that runs Emacs as its flagship application. In contrast, I could spend about an hour installing and an hour configuring Slackware and have pretty much everything I need. But what I don’t get from simply installing slackware is a systems-level understanding of where each package came from. I now know where each basic program and utility comes from, how it is built, and to a certain extent, how the programs depend on one another.

For example, ‘less’ is probably in my top 10 command list, but it’s not installed until late in the process. Similarly, I installed the man pages very early in the process, but couldn’t actually read them until Man-DB rather late in the process. Now that I know how the basic Linux utilities interact, I’m more comfortable troubleshooting problems with Slackware. For ,while Slackware does not have dependency tracking, it most certainly has dependencies. Building a system teaches me about those a lot better than simply installing pre-compiled binary packages from the Slackware DVD.

More to the point, I gained a real appreciation for what it takes to actually build and maintain a GNU/Linux distribution. Gals and guys, we have it really easy when we use Slackware. Not only do Pat and his small team manage to build a complete distribution (with X and everything!), they also manage to incorporate bug-fixes, security updates, and new features and do it in such a way that it works on an exceptionally large variety of hardware and has great performance.

Frankly, looking ahead to BLFS and thinking about building X, much less KDE, Thunderbird, Firefox, and Open Office, I’m a little wary of the effort it is going to take -- especially when compared to simply installing Slackware. It is possible to build and maintain a full-featured LFS system, but it takes a ton of work.

So my general recommendation is to build LFS, tinker with it, and learn from it. The LFS developers put a lot of effort into the project and it shows. There is, probably, no better way to learn about GNU/Linux. In the process, you’ll gain a real appreciation for what it takes to build and maintain Slackware.

However. . .

I can't see LFS displacing Slackware on my computers at home as the main operating system that I run for all the stuff I do with a computer.

But there's something about LFS that's very attractive. For one thing, the LFS developers do a fantastic job of putting everything together and explaining it well. I particularly like the process of building a system up from the bottom and adding what I want/need rather than trying to figure out from a whole, complete system how everything relates.

Secondly, I really like the package users package management scheme. It is surprisingly simple but effective, and I like that it only uses utilities built into Linux.

So, my next step is to repartition my IBM Thinkpad's hard drive and build LFS for it instead of in a virtual machine. The Thinkpad is my 2nd computer. It also runs Slackware, but I really only use it when my wife is on the desktop computer. Half the time I use the laptop to simply SSH into the faster computer and work on it at the same time my wife does.

So it's a good test bed for making a more fully functioning LFS system. It's an older Pentium III, so compiling software may take a while, but I think I'll get very good performance out of LFS, and eventually BLFS, on it when I'm done.

We'll see how it goes.
Posted in Uncategorized
Views 1531 Comments 2
« Prev     Main     Next »
Total Comments 2

Comments

  1. Old Comment
    LFS is just a lots of fun and lots of learning, if making it for the first time
    It's not a big performance overhead in fact, but can be great for some unstandard server environment.
    Posted 10-14-2010 at 02:54 AM by Web31337 Web31337 is offline
  2. Old Comment
    Thank you Lufbery, well written, very informative, quite useful, looking forward to reading about your subsequent efforts with BLFS.


    much appreciated,
    CAI ENG
    Posted 10-19-2010 at 03:29 PM by caieng caieng is offline
 

  



All times are GMT -5. The time now is 10:43 AM.

Main Menu

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration