Troubleshooting the Initial LFS System

There are several places where the initial boot of a new LFS can go wrong. Below are several issues and possible things to check.

GRUB Related Issues

GRUB: "error: hd1 cannot get C/H/S values."

If you see this message, press any key and you'll be in GRUB command line interface. Issue the ls command and it will show the list the designators of all partitions available. The designators will look like (hd0) (hd0,gpt1) (hd0,gpt2) (hd1) (hd1,msdos1)...

Now you can issue ls <designator>/ (note that the trailing "/" is necessary but you may omit "msdos" or "gpt" in the designator) to inspect the content of each partition to see if it contains your LFS kernel. Once you find the correct designator for the partition containing the LFS kernel, you need to manually issue the set root= command and the linux command (just like you are writing them in grub.cfg) to load the kernel and set the kernel command line, then issue the boot command to boot the LFS system. Once it boots successfully, fix the set root= command in grub.cfg.

GRUB: "error: disk `hd0,4' not found."
GRUB: "error: file `vmlinuz-6.2.2-lfs-11.3' not found"

If you have a USB storage device plugged in, remove it and reboot. If this message still shows up with no USB storage devices plugged in, use the same diagnostic procedure as the previous issue. Note that you need to specify the partition containing the LFS kernel for the set root= or search --set=root --fs-uuid command, i. e. if /boot is a separate partition you need to specify it instead of the LFS partition.

If the system boots successfully without a USB storage device plugged in, but fails to boot with this message when a USB storage device is connected, you can either live with it and make sure you've disconnected all USB storage devices when you boot the LFS system, or use the search --set=root --fs-uuid command to replace the set root= command in grub.cfg. The usage of the search --set=root --fs-uuid command is already explained in the LFS book (11.2 or later).

Don't get confused with the two 'root' designators which are used in grub.cfg. One is in the line set root=(XXX) and the other root is in the kernel command line (linux ... root=YYY ...). These entries may point to different partitions. Assuming you have setup a separate partition for /boot which is different to the one where the system has been installed, these two root entries refer to different partitions. In this case:

  • set root=(XXX): The XXX must designate the /boot partition. This can be read as: Grub searches for the kernel in GRUB's root. So, the XXX must be the /boot partition.
  • linux /vmlinuz... root=YYY ...: This root designates the root from the kernel's perspective. This root is the partition where all the /usr, /etc, /var, ... directories are installed. When using a separate /boot partition, this YYY is not the same as set for GRUB's root as the LFS system hasn't been installed in XXX but in YYY.

In the case you have no separate partition for /boot, the root for GRUB as well for the kernel is the same partition. In this case the root setting will look like:

  • set root=(hdx,y): Here hdx points to the drive and y is the partition where the LFS system (including the /boot) has been installed to.
  • linux /boot/vmlinuz... root=dev/sdx ...: Here root points to the same partition as specified in GRUB's root, but is specifed in the format expected by the kernel. Note that the path to the kernel image has sightly changed to the example above – that is because GRUB will find the kernel in a subdirectory of its root.

In any case, the syntax to name the partitions is different when specifying GRUB's root even when they designate the same partition. For Grub it looks like set root=(hd0,2) while the syntax for the kernel root is the well-known path to a node in /dev like /dev/sda2.

GRUB: "error: unknown filesystem."

Try the same diagnostic procedure for the previous issue first.

If it does not work (i. e. you are sure a correct designator is used but the ls <designator>/ command still says "unknown filesystem"), one possiblity is the ext4 file system in the partition has the metadata_csum_seed feature enabled, but you are using the GRUB from the host distro which may not support this feature.

To check this issue, reboot into the host distro, and use the tune2fs -l /dev/<the device node for the partition containing the LFS kernel>. If you see the metadata_csum_seed filesystem feature, remove it with tune2fs -O ^metadata_csum_seed /dev/<device>. Alternatively, you can build and install GRUB following the LFS (for BIOS) or BLFS (for UEFI) book, where GRUB is patched to support this feature.

GRUB: "error: no such device: 3efa8848-4383-4987-8991-97e3fb323ef6"

You've specified the wrong file system UUID in the search --set=root --fs-uuid command. Note that you need the file system UUID here, not the partition UUID.

Press any button to enter the GRUB command line interface, then use the same diagnostic procedure as the first issue above. Once the LFS system boots successfully, get the correct file system UUID via the lsblk -o uuid,name command and fix the search command in grub.cfg.

Video Related Issues

The screen goes blank during the boot process.

This problem can have a couple of causes. The first is because there are one or more missing video drivers in the kernel. The second is due to the kernel not loading required firmware for the video device.

To solve this problem, first identify your video device:

lspci | grep -i vga

Now, in the kernel configuration, go to Device Drivers ---> Graphics Support. First select the device driver that matches your video hardware. For now, select this as a module.

Then select Frame buffer Devices and go to the menu that selects Support for frame buffer devices. Now select VESA VGA graphics support and EFI-based Framebuffer Support. You can also select as a module any entry that matches your video hardware. If you are unsure, just select them all for now. After a successful boot, you can run lsmod and, if desired, rebuild the kernel without any of the unused modules.

If the above does not work, your graphics device may need firmware to be loaded at boot time. For information about how to do that, see About Firware in BLFS.

Problems Mounting the Root Partition

This problem can occur for a couple of reasons:

The disk drivers are not installed in the kernel.

Since LFS does not use an initrd, all drivers needed to access the disk must be installed in the kernel itself. Generally if using a plain ext4 partition and starting the kernel configuration with make defconfig this problem will not occur, but trying to over-optimize the kernel may result in them missing. In addition, if a different disk format such as btrfs is being used, that driver must also be installed in the kernel.

To help determine what hardware you have, on your host system run:

lspci | grep --color -i "controller"

Kernel config options to check depending on your disk and file system types:


       ---> Device Drivers
         ---> SCSI device support
           * SCSI disk support (needed for SATA and PATA hard disks)
         ---> Serial ATA and Parallel ATA drivers (libata)
           * ATA ACPI Support (older systems)
           * AHCI SATA support (most SATA interfaces)
           * ATA BMDMA support (SATA SFF controllers with BMDMA)
             This provides SATA emulation for IDE hardware, 
             Additional options may be needed for some HW.
         ---> NVME Support (m.2 based SSD drives)
         ---> USB Support
           * USB Mass Storage support
         ---> Block devices
           * Virtio block driver
         ---> Virtio drivers
           * PCI driver for virtio devices (optional for qemu)

       ---> File Systems
           * The Extended 4 (ext4) filesystem
           * Use ext4 for ext2 file systems
         ---> DOS/FAT/EXFAT/NT Filesystems 
           * VFAT (Windows-95) fs support
         Other file system option for the type used for the root partition
     
The kernel will not mount the root partition on my USB disk.

The kernel is probably trying to mount the root partition before the USB system is ready. Put the parameter rootdelay=10 on the kernel command line in grub.cfg.

The kernel thinks the root device is different from what is on the command line.

Sometimes the disk layout for the LFS kernel is different from the host layout. This can be solved by specifying the root partition's UUID or LABEL. To see what the identifiers are, run lsblk -o name,partlabel,partuuid on your host system. Then tell the kernel how to identify the root partition with:
root=PARTUUID=<uuid> or
root=PARTLABEL=<label>
on the kernel command line in grub.cfg.

Note that filesystems also have a UUID and optionally a LABEL, but the kernel does not recognize them. Those identifiers require an initrd.

Network Related Issues

I have no internet

There are several things to check here. First run: ls /sys/class/net. If your network interface does not show up, then the kernel configuration needs to be updated and rebuilt with the appropriate network driver. To see what driver is needed run
lspci | grep -i ethernet on the host system. From there, look in the kernel configuration for the configuration item that matches your hardware:

Device Drivers --->
  Network Device Support --->
    Ethernet driver support --->

In addition, some network cards need firmware. If so, see Firmware for Network Interfaces in BLFS.

In a SystemV LFS system, the name and contents of the network configuration file need to be set up properly. The name of the file, /etc/sysconfig/ifconfig.<interface name>, needs to match the network interface name. In addition the IFACE parameter in that file also needs to match the interface name.

Wifi and/or DHCP are not working

LFS does not supoprt wifi directly, and the SystemV revision does not support DHCP directly either. To add those capabilities see the following pages in BLFS: