Chapters
Chapter 1. Introduction 1.1. How to Build an LFS System

Chapter 1. Introduction 1.1. How to Build an LFS System

The LFS system will be built by using an already installed Linux distribution (such as Debian, OpenMandriva, Fedora, or openSUSE). This existing Linux system (the host) will be used as a starting point to provide necessary programs, including a compiler, linker, and shell, to build the new system. Select the “development” option during the distribution installation to include these tools.

Note

There are many ways to install a Linux distribution and the defaults are usually not optimal for building an LFS system.
For suggestions on setting up a commercial distribution see: https://www.linuxfromscratch.org/hints/downloads/files/partitioning-for-lfs.txt As an alternative to installing a separate distribution on your machine, you may wish to use a LiveCD from a commercial distribution.

Chapter 2 of this book describes how to create a new Linux native partition and file system, where the new LFS system will be compiled and installed. Chapter 3 explains which packages and patches must be downloaded to build an LFS system, and how to store them on the new file system. Chapter 4 discusses the setup of an appropriate working environment. Please read Chapter 4 carefully as it explains several important issues you should be aware of before you begin to work your way through Chapter 5 and beyond.

Chapter 5 explains the installation of the initial tool chain, (binutils, gcc, and glibc) using cross-compilation techniques to isolate the new tools from the host system.

Chapter 6 shows you how to cross-compile basic utilities using the just built cross-toolchain.

Chapter 7 then enters a "chroot" environment, where we use the new tools to build all the rest of the tools needed to create the LFS system.

This effort to isolate the new system from the host distribution may seem excessive. A full technical explanation as to why this is done is provided in Toolchain Technical Notes.

In Chapter 8 the full-blown LFS system is built. Another advantage provided by the chroot environment is that it allows you to continue using the host system while LFS is being built. While waiting for package compilations to complete, you can continue using your computer as usual.

To finish the installation, the basic system configuration is set up in Chapter 9, and the kernel and boot loader are created in Chapter 10. Chapter 11 contains information on continuing the LFS experience beyond this book. After the steps in this chapter have been implemented, the computer is ready to boot into the new LFS system.

This is the process in a nutshell. Detailed information on each step is presented in the following chapters. Items that seem complicated now will be clarified, and everything will fall into place as you commence your LFS adventure.

1.2. What's new since the last release

Here is a list of the packages updated since the previous release of LFS.

Upgraded to:

  • Automake-1.18.1
  • Bash-5.3
  • Binutils-2.45
  • Coreutils-9.7
  • Diffutils-3.12
  • E2fsprogs-1.47.3
  • Expat-2.7.1
  • Flit-Core-3.12.0
  • Gawk-5.3.2
  • GCC-15.2.0
  • GDBM-1.26
  • Gettext-0.26
  • Glibc-2.42
  • Gperf-3.3
  • Grep-3.12
  • Gzip-1.14
  • Iana-Etc-20250807
  • IPRoute2-6.16.0
  • Jinja2-3.1.6
  • Kbd-2.8.0
  • Kmod-34.2
  • Less-679
  • LFS-Bootscripts-20250827
  • Libcap-2.76
  • Libelf from Elfutils-0.193
  • Libffi-3.5.2
  • Linux-6.16.1
  • M4-1.4.20
  • Man-DB-2.13.1
  • Man-pages-6.15
  • Meson-1.8.3
  • MPFR-4.2.2
  • Ncurses-6.5-20250809
  • Ninja-1.13.1 3
  • Open SSL-3.5.2
  • Patch-2.8
  • Perl-5.42.0
  • Pkgconf-2.5.1
  • Python-3.13.7
  • Readline-8.3
  • Setuptools-80.9.0
  • Shadow-4.18.0
  • Sysklogd-2.7.2
  • Systemd-257.8
  • Tzdata-2025 b
  • Util-linux-2.41.1
  • Vim-9.1.1629
  • Wheel-0.46.1
  • Xz-5.8.1

Added:

  • Packaging-25.0
  • coreutils-9.7-upstream_fix-1.patch

Removed:

  • Check-0.15.2

1.3. Changelog

This is version 12.4 of the Linux From Scratch book, dated September 1st, 2025. If this book is more than six months old, a newer and better version is probably already available. To find out, please check one of the mirrors via https:// https://www.linuxfromscratch.org/mirrors.htmlpage:new]www.linuxfromscratch.org/mirrors.html. Below is a list of changes made since the previous release of the book.

Changelog Entries:

  • 2025-09-01
  • [bdubbs] - LFS-12.4 released.
  • 2025-08-27
  • [bdubbs] - Update network boot script corner case.
  • 2025-08-15
  • [bdubbs] - Add a modification to glibc from upstream to solve an incompatibility with valgrind. Fixes #5778. 4
  • [bdubbs] - Update to iana-etc-20250807. Addresses #5006.
  • [bdubbs] - Update to vim-9.1.1829. Addresses #4500.
  • [bdubbs] - Update to ncurses-6.5-20250809. Fixes #5780.
  • [bdubbs] - Update to Python-3.13.7 (Security Update). Fixes #5779.
  • [bdubbs] - Update to linux-6.16.1. Fixes #5758.
  • [bdubbs] - Update to iproute2-6.16.0. Fixes #5773.
  • [bdubbs] - Update to systemd-257.8. Fixes #5751.
  • 2025-08-08
  • [bdubbs] - Update to Python-3.13.6 (Security Update). Fixes #5776.
  • [bdubbs] - Update to openssl-3.5.2. Fixes #5775.
  • [bdubbs] - Update to libffi-3.5.2. Fixes #5772.
  • [bdubbs] - Update to gcc-15.2.0. Fixes #5777.
  • 2025-08-05
  • Fixed CVE-2025-8194 in Python. Fixes #5774.
  • 2025-08-01
  • [bdubbs] - Update to meson-1.8.3. Fixes #5771.
  • [bdubbs] - Update to gdbm-1.26. Fixes #5770.
  • [bdubbs] - Update to binutils-2.45. Fixes #5766.
  • [bdubbs] - Update to gettext-0.26. Fixes #5762.
  • [bdubbs] - Update to glibc-2.42. Fixes #5765.
  • [bdubbs] - Update to man-pages-6.15. Fixes #5763.
  • 2025-07-15
  • [bdubbs] - Update to vim-9.1.1552 (Security update). Fixes #5760.
  • [bdubbs] - Update to readline-8.3. Fixes #5755.
  • [bdubbs] - Update to perl-5.42.0. Fixes #5756.
  • [bdubbs] - Update to openssl-3.5.1. Fixes #5723.
  • [bdubbs] - Update to ninja-1.13.1. Fixes #5759.
  • [bdubbs] - Update to linux-6.15.6. Fixes #5757.
  • [bdubbs] - Update to gettext-0.25.1. Fixes #5753.
  • [bdubbs] - Update to e2fsprogs-1.47.3. Fixes #5758.
  • [bdubbs] - Update to bash-5.3. Fixes #5754.
  • 2025-07-01
  • [bdubbs] - Update to iana-etc-20250618. Addresses #5006.
  • [bdubbs] - Update to vim-9.1.1497. Addresses #4500.
  • [bdubbs] - Update to util-linux-2.41.1. Fixes #5749.
  • [bdubbs] - Update to shadow-4.18.0. Fixes #5750. 5
  • [bdubbs] - Update to pkgconf-2.5.1. Fixes #5746.
  • [bdubbs] - Update to ninja-1.13.0. Fixes #5745.
  • [bdubbs] - Update to linux-6.15.4. Fixes #5748.
  • [bdubbs] - Update to less-679. Fixes #5747.
  • [bdubbs] - Update to automake-1.18.1. Fixes #5752.
  • 2025-06-15
  • [bdubbs] - Update to meson-1.8.2. Fixes #5742.
  • [bdubbs] - Update to linux-6.15.2. Fixes #5725.
  • [bdubbs] - Update to libffi-3.5.1. Fixes #5741.
  • [bdubbs] - Update to iproute2-6.15.0. Fixes #5732.
  • [bdubbs] - Update to Python-3.13.5. Fixes #5743.
  • 2025-06-04
  • [bdubbs] - Update to ncurses-6.5-20250531. Fixes #5737.
  • [bdubbs] - Update to readline-8.3-rc2. Fixes #5738.
  • [bdubbs] - Update to bash-5.3-rc2. Fixes #5738.
  • [bdubbs] - Update to Python-3.13.4. Fixes #6739.
  • 2025-06-01
  • [bdubbs] - Update to iana-etc-20250519. Addresses #5006.
  • [bdubbs] - Update to vim-9.1.1418. Addresses #4500.
  • [bdubbs] - Update to kbd-2.8.0. Fixes #5736.
  • [bdubbs] - Update to systemd-257.6. Fixes #5674.
  • [bdubbs] - Update to setuptools-80.9.0. Fixes #5728.
  • [bdubbs] - Update to meson-1.8.1. Fixes #5731.
  • [bdubbs] - Update to automake-1.18. Fixes #5734.
  • [bdubbs] - Update build instructions to accommodate gcc-15 for bc, expect, ncurses, and gmp.
  • [bdubbs] - Update to gcc-15.1.0. Fixes #5707.
  • [bdubbs] - Update to less-678. Fixes #5724.
  • [bdubbs] - Update to readline-8.3-rc1. Fixes #5726.
  • [bdubbs] - Update to bash-5.3-rc1. Fixes #5714.
  • 2025-05-15
  • [bdubbs] - Update to setuptools-80.7.1. Fixes #5715.
  • [bdubbs] - Update to man-pages-6.14. Fixes #5720.
  • [bdubbs] - Update to man-db-2.13.1. Fixes #5719.
  • [bdubbs] - Update to m4-1.4.20. Fixes #5722.
  • [bdubbs] - Update to linux-6.14.6. Fixes #5717.
  • [bdubbs] - Update to gettext-0.25. Fixes #5718. 6
  • 2025-05-01
  • [bdubbs] - Update to vim-9.1.1353. Addresses #4500.
  • [bdubbs] - Update to setuptools-80.0.1. Fixes #5710.
  • [bdubbs] - Update to packaging-25.0. Fixes #5706.
  • [bdubbs] - Update to meson-1.8.0. Fixes #5713.
  • [bdubbs] - Update to linux-6.14.4. Fixes #5709.
  • [bdubbs] - Update to iana-etc-20250407. Addresses #5006.
  • [bdubbs] - Update to gperf-3.3. Fixes #5708.
  • [bdubbs] - Update to elfutils-0.193. Fixes #5711.
  • 2025-04-15
  • [bdubbs] - Update to libcap-2.76. Fixes #5704.
  • [bdubbs] - Update to perl-5.40.2 (Security update). Fixes #5703.
  • [bdubbs] - Add packaging-24.2 (Python module). Needed for wheel.
  • [bdubbs] - Update to xz-5.8.1. Fixes #5694.
  • [bdubbs] - Update to wheel-0.46.1 (Python Module). Fixes #5693.
  • [bdubbs] - Update to sysklogd-2.7.2. Fixes #5690.
  • [bdubbs] - Update to Python3-3.13.3. Fixes #5697.
  • [bdubbs] - Update to openssl-3.5.0. Fixes #5701.
  • [bdubbs] - Update to meson-1.7.2. Fixes #5691.
  • [bdubbs] - Update to linux-6.14.2. Fixes #5680.
  • [bdubbs] - Update to libffi-3.4.8. Fixes #5700.
  • [bdubbs] - Update to iproute2-6.14.0. Fixes #5682.
  • [bdubbs] - Update to gzip-1.14. Fixes #5699.
  • [bdubbs] - Update to grep-3.12. Fixes #5702.
  • [bdubbs] - Update to gperf-3.2.1. Fixes #5695.
  • [bdubbs] - Update to gawk-5.3.2. Fixes #5692.
  • [bdubbs] - Update to diffutils-3.12. Fixes #5696.
  • [bdubbs] - Update to coreutils-9.7. Fixes #5698.
  • 2025-04-01
  • [bdubbs] - Update to vim-9.1.1263. Addresses #4500.
  • [bdubbs] - Update to iana-etc-20250328. Addresses #5006.
  • [bdubbs] - Update to xz-5.8.0. Fixes #5684.
  • [bdubbs] - Update to util-linux-2.41. Fixes #5648.
  • [bdubbs] - Update to tzdata-2025b. Fixes #5681.
  • [bdubbs] - Update to shadow-4.17.4. Fixes #5678.
  • [bdubbs] - Update to setuptools-78.1.0. Fixes #5676. 7
  • [bdubbs] - Update to patch-2.8. Fixes #5689.
  • [bdubbs] - Update to mpfr-4.2.2. Fixes #5677.
  • [bdubbs] - Update to kmod-34.2. Fixes #5688.
  • [bdubbs] - Update to gdbm-1.25. Fixes #5679.
  • [bdubbs] - Update to flit_core-3.12.0. Fixes #5683.
  • [bdubbs] - Update to expat-2.7.1. Fixes #5685.
  • 2025-03-15
  • [bdubbs] - Update to vim-9.1.1202. Addresses #4500.
  • [bdubbs] - Update to iana-etc-20250304. Addresses #5006.
  • [bdubbs] - Update to sysklogd-2.7.1. Fixes #5668.
  • [bdubbs] - Update to setuptools-76.0.0. Fixes #5665.
  • [bdubbs] - Update to pkgconf-2.4.3. Fixes #5672.
  • [bdubbs] - Update to man-pages-6.13. Fixes #5673.
  • [bdubbs] - Update to linux-6.13.7. Fixes #5664.
  • [bdubbs] - Update to libcap-2.75. Fixes #5667.
  • [bdubbs] - Update to kmod-34.1. Fixes #5671.
  • [bdubbs] - Update to jinja2-3.1.6. Fixes #5670.
  • [bdubbs] - Update to expat-2.7.0. Fixes #5675.
  • 2025-03-05
  • [bdubbs] - LFS-12.3 released.

1.4. Resources

1.4.1. FAQ

If during the building of the LFS system you encounter any errors, have any questions, or think there is a typo in the book, please start by consulting the list of Frequently Asked Questions (FAQ), located at https://www.linuxfromscratch.

org/faq/.

1.4.2. Mailing Lists

The linuxfromscratch.org server hosts a number of mailing lists used for the development of the LFS project. These lists include the main development and support lists, among others. If you cannot find an answer to your problem on the FAQ page, the next step would be to search the mailing lists at https://www.linuxfromscratch.org/search.html.

For information on the different lists, how to subscribe, archive locations, and additional information, visit linuxfromscratch.org/mail.html.

1.4.3. IRC

Several members of the LFS community offer assistance via Internet Relay Chat (IRC). Before using this support, please make sure your question is not already answered in the LFS FAQ or the mailing list archives. You can find the IRC network at irc.libera.chat . The support channel is named #lfs-support.

1.4.4. Mirror Sites

The LFS project has a number of world-wide mirrors to make accessing the website and downloading the required packages more convenient. Please visit the LFS website at https://www.linuxfromscratch.org/mirrors.html for a list of current mirrors.

1.4.5. Contact Information

Please direct all your questions and comments to one of the LFS mailing lists (see above).

1.5. Help

Note

In case you've hit an issue building one package with the LFS instruction, we strongly discourage posting the issue directly onto the upstream support channel before discussing via a LFS support channel listed in Section 1.4, “Resources.” Doing so is often quite inefficient because the upstream maintainers are rarely familiar with LFS building procedure. Even if you've really hit an upstream issue, the LFS community can still help to isolate the information wanted by the upstream maintainers and make a proper report.

If you must ask a question directly via an upstream support channel, you shall at least note that many upstream projects have the support channels separated from the bug tracker. The “bug” reports for asking questions are considered invalid and may annoy upstream developers for these projects.

If an issue or a question is encountered while working through this book, please check the FAQ page at https://linuxfromscratch.org/faq/#generalfaq. Questions are often already answered there. If your question is not answered on that page, try to find the source of the problem. The following hint will give you some guidance for troubleshooting:

https://www.linuxfromscratch.org/hints/downloads/files/errors.txtpage:new]https://www.linuxfromscratch.org/hints/downloads/files/errors.txt.[/link] If you cannot find your problem listed in the FAQ, search the mailing lists at https://www.linuxfromscratch.org/search.

We also have a wonderful LFS community that is willing to offer assistance through the mailing lists and IRC (see the Section 1.4, “Resources” section of this book). However, we get several support questions every day, and many of them could have been easily answered by going to the FAQ or by searching the mailing lists first. So, for us to offer the best assistance possible, you should first do some research on your own. That allows us to focus on the more unusual support needs. If your searches do not produce a solution, please include all the relevant information (mentioned below) in your request for help.

1.5.1. Things to Mention

Apart from a brief explanation of the problem being experienced, any request for help should include these essential things:

  • The version of the book being used (in this case 12.4)
  • The host distribution and version being used to create LFS
  • The output from the Host System Requirements script
  • The package or section the problem was encountered in
  • The exact error message, or a clear description of the problem
  • Note whether you have deviated from the book at all

Note


Deviating from this book does not mean that we will not help you. After all, LFS is about personal preference.
Being up-front about any changes to the established procedure helps us evaluate and determine possible causes of your problem.

1.5.2. Configure Script Problems

If something goes wrong while running the configure script, review the config.log file. This file may contain errors encountered during configure which were not printed to the screen. Include the relevant lines if you need to ask for help.

1.5.3. Compilation Problems

Both the screen output and the contents of various files are useful in determining the cause of compilation problems.

The screen output from the configure script and the make run can be helpful. It is not necessary to include the entire output, but do include all of the relevant information. Here is an example of the type of information to include from
the make screen output.

gcc -D ALIASPATH=\"/mnt/lfs/usr/share/locale:.\"
-D LOCALEDIR=\"/mnt/lfs/usr/share/locale\"
-D LIBDIR=\"/mnt/lfs/usr/lib\"
-D INCLUDEDIR=\"/mnt/lfs/usr/include\" -D HAVE_CONFIG_H -I. -I.
-g -O2 -c getopt1.c
gcc -g -O2 -static -o make ar.o arscan.o commands.o dir.o
expand.o file.o function.o getopt.o implicit.o job.o main.o
misc.o read.o remake.o rule.o signame.o variable.o vpath.o
default.o remote-stub.o version.o opt1.o
-lutil job.o: In function `load_too_high':

In this case, many people would just include the bottom section:

make [2]: *** Error 1

This is not enough information to diagnose the problem, because it only notes that something went wrong, not what went wrong. The entire section, as in the example above, is what should be saved because it includes the command that was executed and all the associated error messages.

An excellent article about asking for help on the Internet is available online at http://catb.org/~esr/faqs/smart-questions.html. Read this document, and follow the hints. Doing so will increase the likelihood of getting the help you need.