LFS Frequently Asked Questions

The FAQ is divided in three documents. The General FAQ has links to all questions and answers. The LFS FAQ is a selection of LFS-specific FAQ's and the BLFS FAQ is a selection of BLFS-specific FAQ's.

Frequently Requested Enhancements

When reading and building LFS

General compilation errors

Package-specific errors

Configuration and booting issues

Frequently Requested Enhancements

Why not include the FAQ in the book?

Marc Heerdink may have said it best in a post to lfs-dev:

The problem is that the FAQ is a dynamic document. The FAQ for a book release is released only after the book version itself, because the FAQ is updated to reflect the Qs asked about the current version of the book. A link is better, since you'll always have the most up-to-date answers handy.

Why is vim in the book?

This is fairly well discussed in the thread starting at this post.

Why isn't some package manager in the book?

Package management - beyond that provided by tarballs and makefiles - is beyond the scope of the book. If nothing else does, the number of different "solutions" should hint at some of the reasons.

Here are a few of the options:

If you have an addition to the list, please do email its id, URL, and other information, to the FAQ maintainer or an appropriate LFS mailing list so it can be added here.

How do I make my machine poweroff when shut down?

Power Management is a kernel function, you need to enable it in the kernel. In the 5.11 kernel, you have to enable the options for ACPI (Advanced Configuration and Power Interface under Power managerment and ACPI options. For very old 32-bit x86 machines, you'll probably want the APM options, newer machines often require ACPI. Make sure that either APM or ACPI be enabled in the kernel, but definitely not both at the same time - this has been known to cause problems such as neither actually taking effect. Also try disabling SMP if you only have one processor; it's also known to prevent a proper poweroff. Make sure you read the help with each option.

After rebooting into the new kernel you should be able to poweroff your machine with the command shutdown -h now or poweroff (also read man shutdown and man halt). If you compiled APM or ACPI as modules, make sure they are loaded before you try to power off. Some machines require that APM or ACPI is compiled into the kernel because it needs to be initialised at boottime.

How do I boot LFS with UEFI?

GRUB can be built for UEFI, but doing so needs several packages beyond the scope of LFS. You can consult the BLFS page for it.

Can I skip a package in Chapter 8 since it's already built in Chapter 6 or 7, and it's functioning properly?

Short answer: no.

Long answer: we want LFS to be "settled down": if some package is rebuilt in the LFS system, the result (libraries and binaries) should be same as the result at the end of the LFS book. In Chapter 6 the tools are cross compiled, where many tests in the configure script can't be done. The "guessed" result will be used, unnecessary workarounds are enabled, or optional features are disabled. The tools in Chapter 7 are built for resolving circular dependencies: many of their optional features depend on packages not built yet and have to be disabled. So rebuilding them in Chapter 8 is necessary.

On the other hand, if you are building Linux for some really tiny platform where you can't build packages in a reasonable time (for example, a 16 MHz ARM), you can cross compile everything in Chapter 6 since Chapter 7 and 8 are not applicable. Or, you can do Chapter 7 and 8 with an emulator like QEMU.

Can I modify GCC code and get rid of /lib64?

Short answer: no.

Long answer: LSB mandates the ELF loader to be at /lib64/ld-linux-x86-64.so.2 on x86-64.

Even longer answer: when the kernel is told to execute a dynamic linked ELF executable, it reads the path to the ELF loader hard-coded in the ELF executable, which is /lib64/ld-linux-x86-64.so.2. So, if it does not exist, LFS won't be able to run any dynamic linked executable compiled elsewhere. For example, executables from commercial software packages (MATLAB or COMSOL) or binaries downloaded from GitHub release page will not run.

Back to the top.

When reading and building LFS

What distribution should I use to start from?

Most relatively recent distributions should be fine. You could consult the Host System Requirements page.

Make sure you have installed and/or updated the development packages. (Look for ones starting in "gcc", "glibc", or "libstdc++" or ending in "-dev" or "-devel".)

If you want to use LFS as your main system and you wish to install it without first installing a distribution, It is also possible to use a live image on dvd or usb stick. All major distributions provide one.

How do I compile a kernel or set up modules?

In /usr/share/doc/linux-x.y.z or wherever you unpacked your kernel source and the help in kernel config tool (make menuconfig), see the Module-HOWTO at http://www.tldp.org/HOWTO/Module-HOWTO/.

Are compiler warnings from GCC bad?

Short answer: no.

Long answer: probably, but only to someone working on the package you're trying to compile. Mostly, everything will be fine unless make quits with an error.

Here's an example:

sk ~/tmp $ cat > Makefile
gcc main.c
sk ~/tmp $ cat > main.c
void main() { exit(0); }
sk ~/tmp $ make
gcc main.c
main.c: In function `main':
main.c:1: warning: return type of `main' is not `int'
sk ~/tmp $ ######## that worked ########
sk ~/tmp $
sk ~/tmp $ cat > main.c
int main() { exxit(0) }
sk ~/tmp $ make
gcc main.c
main.c: In function `main':
main.c:1: parse error before `}'
make: *** [main] Error 1
sk ~/tmp $ ######## that failed ########
sk ~/tmp $

If you can determine that some warning indicates a real bug in the software, report to the maintainer of it.

How do I make that really small install the book mentions?

Gerard describes the process of making a 5MB LFS install in an email to lfs-support, and there are links to many resources in a post by Cor Lem and a reply to it.

Is there information about building LFS on other processors?

For information about building LFS for a wide array of systems, take a look at the Cross-LFS branch of LFS.

For ARM (64-bit or 32-bit), consult LFS Fork for ARM, maintained by William Harrington.

For 64-bit little-endian MIPS, Xi Ruoyao has done an experiment building LFS on it. The modified LFS book documented the instruction used in the experiment.

How do I cross compile LFS?

It's often useful to compile LFS for one machine on another machine. Say using that fast 1Ghz Athlon to build an install for an old 486. While this is technically not cross compiling, binaries compiled for the Athlon cannot be run on the 486 because binaries compiled for the newer processor use features the older processor doesn't have.

The LFS book specifically for cross compiling is the Cross-LFS book. Another source of information would be the cross-compiling hint.

The resources provided above are quite outdated. You can modify the LFS building process after LFS 10.0 (developed by Pierre Labestie) to cross compile LFS: set $LFS_TGT to the triplet of your target platform, and build cross toolchain in Chapter 5 and temporary tools in Chapter 6 as normal. At the end of Chapter 6, build a kernel and a bootloader for the target. Then copy the temporary system to the target platform, boot it, and continue the building from Chapter 7.

What's a DOS format text file?

It has to do with the characters used to end lines.

There are two that may be used:

  • Line Feed: (LF) Octal:012 Decimal:10 Hex:0A C Style Escape:'\n' Moves down one line.
  • Carriage Return: (CR) Octal:015 Decimal:13 Hex:0D C Style Excape:'\r' Move to the left margin.

Unix, DOS, and MacOS each use a different combination to end lines in text files:

  • Unix: LF only. This is why when a Unix format text file is sent to a printer raw, it prints out
  • DOS: CRLF both. Which is why if you do "cat -v" on a DOS file you'll see a "^M" (control m is carriage return) at the end of each line. And that is why scripts don't work when written with Microsoft Notepad. The kernel looks for "/bin/sh^M" which doesn't exist. There's a "/bin/sh", but nothing with a "^M" appended.
  • Classic MacOS (before Mac OS X): CR only. Printers probably print every line atop the first, and Unix tools think the whole file is one line with "^M" all through it. Mac OS X follows Unix convention (LF only).

To change DOS to Unix, use

cp <fileid> <fileid>.dos &&
cat <fileid>.dos | tr -d '\r' > <fileid>

Or in vim, you can convert a file with :set ff={unix, dos, mac}. Other conversions will probably require sed or a different use of tr and are left as an exercise for the reader.

Is there a way to download all current files at one time?

Yes. You can download the file LFS-BOOK-x.y-wget-list http://www.linuxfromscratch.org/lfs/downloads/stable/wget-list. To download all the files, use the version of wget on your host distribution to run:

wget --input-file=LFS-BOOK-x.y-wget-list

Back to the top.

General compilation errors

When using optimization flags (setting CFLAGS)

If you're getting errors and you're setting CFLAGS or otherwise passing optimization flags to the compiler that may be the problem.

If you ask on the list and they can't figure it out immediately, they'll likely suggest trying it without optimization. So if you just retry it without before asking, you'll be one step ahead of them :)

Of particular note is that optimizing binutils, gcc, or glibc may cause any other package to fail to compile or run or to otherwise misbehave in strange and mysterious ways. Also, optimization that works for someone else may not work for you. Flags that used to work may mysteriously stop working. Even some small innocent hardware change can make the difference.

(If you don't know what optimization flags are, don't worry, you really don't need to.)

Why does GCC reports "Internal Compiler Error" for a "hello world" program?

You over optimized gcc.

I didn't delete the source tree after my last attempt. Do I need to?

Yes. In general make clean or make dist-clean can't be relied upon for clean sources. Especially when you have manually hacked the sources or applied patches to it you should first try again with a fresh unpacked package. The only exception to this rule is the linux kernel, which requires its sources to be present when third-party modules, such as the NVidia drivers, are needed.

I'm getting `/dev/null: Permission denied'

Does /dev/null look like this:

$ ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 Aug 3 2000 /dev/null

If not, it should. See the chmod(1), chown(1), and mknod(1) man pages and /usr/src/linux/Documentation/devices.txt if you need help fixing it.

If it does look right, the problem is probably your mount options. See the answer to "./configure: bad interpreter: Permission denied", above.

signal 11 (internal error: Segmentation fault)

The long answer is at http://www.bitwizard.nl/sig11/.

The short answer is that if restarting make gets a little further every time, you have a hardware problem. (If make, or whatever you're running, fails at the same place every time, then it is not hardware.)

Assuming you're not overclocking, the most likely hardware problem is bad memory which you can check with Memtest86 from http://www.memtest86.com/. If that isn't it, see the long answer.

No such file or directory

Examples of this error are:

/usr/bin/env: /bin/bash: No such file or directory
gcc: No such file or directory

What happens is that the path to the dynamic linker path embedded inside the executable is /lib64/ld-linux-x86-64.so.2 (/lib/ld-linux.so.2 for 32-bit), and when one goes to run the binary inside the chroot where /lib64/ld-linux-x86-64.so.2 does not exist yet, the very unhelpful No such file or directory error message is shown.

Check if the symlink /lib64/ld-linux-x86-64.so.2 is broken. For LFS 9.1 or older, it may indicate a typo in GCC Pass 2.

bash: ./configure: No such file or directory

You forgot to cd into the extracted directory of the package after you've extracted it.

./configure: bad interpreter: Permission denied

You're most likely getting this while building binutils in Chapter 5 of the LFS Book. The problem is most likely your mount options. You probably have a line in /etc/fstab like:

/dev/hda10 /mnt/lfs ext2 user 1 2

'user' is the mount flag, and it's the problem. To quote from the mount man page:

user: Allow an ordinary user to mount the file system. This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line user,exec,dev,suid).

So change the line in /etc/fstab like this:

/dev/hda10 /mnt/lfs ext2 defaults 1 2
configure can't guess my host type.

Typical symptoms look like this:

sk ~/tmp-0.0 $ ./configure
creating cache ./config.cache
checking host system type...
configure: error: can not guess host type; you must specify one
sk ~/tmp-0.0 $

The problem is usually that the script can't run the compiler. Usually it's just a missing /usr/bin/cc symlink. You can fix it like this:

cd /usr/bin && ln -s gcc cc

If that doesn't do it, check the file config.log created by configure. Errors are recorded there and may indicate the problem.

checking whether we are using GNU C... no

If you're getting an error from configure like:

checking whether we are using GNU C... no
configure: error: GNU libc must be compiled using GNU CC

It may be because egrep isn't working. Since egrep is a shell-script which calls grep, this actually means there's a problem with grep.

To test if egrep is working in the chroot environment, run the following command from inside chroot:

egrep root /etc/passwd

If it doesn't print root's line from /etc/passwd, again, you have a problem. (This test also works if you encounter the problem after rebooting into the new LFS system.)

The system has no more ptys. Ask your system administrator to create more.

If you run

expect -c "spawn ls"

and get the following error:

The system has no more ptys.
Ask your system administrator to create more.

then your linux distribution is either not setup to use Unix98 PTYs or to use the /dev/pts file system.

The solution may require recompiling your kernel. First, go to your kernel's source directory and look at the .config file. If you do not have a .config file, and you are running the pre-compiled kernel that was installed with rpm, aptget, or whatever your distribution uses, then you need to seek support from your distribution's support FAQ's, mailing lists or IRC channels.

If you do have a .config file, look inside it for the following 2 options:


If either of these has 'n' instead of 'y', then change it and recompile the kernel.

If they both have 'y', then you probably will not have to recompile the kernel.

Next, we need to ensure that the system is actually using both Unix98 PTYs and the /dev/pts file system.

First, look for a device called /dev/ptmx. If it doesn't exist, create it with:

mknod /dev/ptmx c 5 2

Then, whether it existed or you just created it, run:

chmod 666 /dev/ptmx

Next, ensure that there is a directory called /dev/pts. The permissions should be 755. Create it and/or chmod it if needed.

The final setup is to add the following line to /etc/fstab:

devpts    /dev/pts    devpts    gid=5,mode=620    0  0

NOTE: Look for the tty group in /etc/group and note the group id number. Change the gid=5 option to match the group id number of the tty group. The group id of 5 is just an example and may differ on your system.

Now that everything is setup, you have two options.

1. Mount /dev/pts and test it by rerunning the above expect command.

2. Reboot the computer and test it by rerunning the above expect command.

Back to the top.

Package-specific errors

M4: Assumed value of MB_LEN_MAX wrong

This error message usually indicates that limits.h provided by GCC isn't including limits.h from Glibc as it should be. There are two commands as a workaround for limits.h in Chapter 5, one in GCC Pass 1 and another in Glibc. Forgetting any of them will lead to this issue. You can rerun the forgotten commands (untar GCC tarball if necessary) and retry to build M4. Note that if you forgot the command in GCC Pass 1, you'll have to rerun both of these two workarounds, as the workaround in Glibc copies from the file created in the workaround in GCC Pass 1.

Systemd: systemd-networkd.service: Failed to determine user credentials: No such process

It's likely because /etc/passwd for sysv revision is misused in systemd-based system. "No such process" is just the "standard" error message for ESRCH, it's not very helpful for diagnosis of this issue.

Back to the top.

Configuration and booting issues

Kernel panic - not syncing: VFS: Unable to mount root fs on ...

There are several reasons why the kernel might be unable to mount the root filesystem.

  • Did you specify the correct partition in /boot/grub/grub.cfg?
  • Is support for the hard drive enabled in the kernel. For SCSI this means support for the specific SCSI adapter.
  • Is support for the hard drive compiled into the kernel, not just as a module. (Modules are stored on the filesystem. If a driver needed to access the filesystem is stored as a module on that filesystem, well ... you know ... ;)
  • Is support for the filesystem compiled into the kernel. Again, not a module. Support for ext4 is enabled by default, but others like reiser, jfs, and xfs are not.
init: Id "1" respawning too fast: disabled for 5 minutes

When you see, in your syslogs, this line:

init: Id "1" respawning too fast: disabled for 5 minutes

It means you have an error in the /etc/inittab line beginning with the given id ("1" in this example).

modprobe: Can't locate module char-major-10-135

char-major-10-135 refers to the character device, major 10, minor 135, which is /dev/rtc. It provides access to the BIOS clock, or RTC, the Real Time Clock. See /usr/src/linux/Documentation/rtc.txt for more information.

The error is because something, most likely hwclock, is trying to use /dev/rtc but you haven't configured kernel support for it in your kernel. Either delete /dev/rtc so hwclock won't try to use it or enable RTC support in your kernel. It's located in make menuconfig under "Character devices" -> "Enhanced Real Time Clock Support".

modprobe: Can't locate module /dev/rtc

See the question "modprobe: Can't locate module char-major-10-135".

eth0:unknown interface:No such device [failed]

The full error looks like this:

eth0:unknown interface:No such device [failed]
Setting up default gateway...
SIOCADDRT:No such device [failed]

eth0 is a virtual device with no /dev entry. It refers to the first detected network card in your system. The reason the kernel can't find this device is because you forgot to add support for your network card in the kernel. The kernel detected the card but doesn't have a driver for it. The LFS boot script tries to bring up the network but fails because of this.

Recompile your kernel with the proper driver, either built in or as a module. If you compiled the network driver as a module, then also adjust /etc/modules.conf to alias the network card module as eth0; for example: alias eth0 8139too. If you don't know which network card you have, you can use dmesg, /proc/pci or lspci to find out.

And, udev may rename your network devices. For example, eth0 may be renamed to enp4s0. You can run ip link command after booting the LFS system, and examine the output to know the name of your network devices.

irq 9: nobody cared (try booting with the "irqpoll" option)

It may be a bug in the firmware (BIOS) or the drivers in kernel. Some hardware vendors tend to use Windows-specific hacks in their BIOS, which is misinterpreted by Linux kernel and causing this kind of issue.

If you see message like this but your system functions normally, you can ignore it. If the system malfunctions, you can try the combinations of several kernel options to workaround: irqpoll, noapic, pci=nocrs, and i8042.nopnp=1.

And, you can try ACPI DSDT override if you really understand it.

You can always report this kind of issue to Kernel bug tracker, no matter if it's a BIOS bug. The kernel developers want to make Linux runable even if the BIOS has this kind of bug.