Chain loading

Also known as: chainloading

On this page 7

Chain loading (also written chainloading) is the boot technique in which one boot program loads another boot program into memory and transfers control to it, instead of loading the operating system kernel directly. In boot & firmware design it lets a small first-stage loader delegate the real work to a larger, more capable second stage, and it lets a single boot menu start several operating systems that each bring their own bootloader.

The technique dates back to the earliest PC boot process, where the firmware could only read a 512-byte boot sector and had to rely on that tiny program to fetch everything else. It remains central in operating systems today, from GRUB starting Windows Boot Manager on dual-boot machines to UEFI loaders that hand off to signed shims, network loaders and recovery environments.

How chain loading passes control between loaders

Every chain loading step follows the same pattern: locate, load, verify if required, and jump. The current loader finds the next boot program on a disk, partition or network, reads it into a known memory address, optionally checks its signature or hash, sets up the environment the next program expects and then executes it. The first loader usually never regains control.

On legacy BIOS systems, firmware loads the master boot record to address 0x7C00 and jumps to it. The MBR code then reads the volume boot record of the active partition into the same address and jumps again. On UEFI systems, a loader calls the firmware services LoadImage and StartImage to load and run another EFI executable from the EFI system partition, so control passes through a defined API rather than raw memory jumps.

The table below shows how a typical chain looks on each firmware type.

StageLegacy BIOS pathUEFI path
FirmwareBIOS reads sector 0 of the boot diskUEFI reads a boot entry from NVRAM
First loaderMBR code, 446 bytesshim or boot manager EFI file
Next loaderPartition boot sector or GRUB coreGRUB, systemd-boot or Windows Boot Manager
Final targetKernel or another OS loaderKernel, EFI stub or another EFI loader
Typical chain loading paths by firmware type

Why boot designs rely on chain loading

Chain loading solves the problem of tight size and capability limits in early boot code. A boot sector is too small to understand file systems, configuration files or graphical menus, so it delegates to a later stage that can. Even on UEFI, where loaders are ordinary executables, chaining keeps each component small, replaceable and independently signed.

  • Multi-boot support: a boot manager can start any OS by handing control to that system’s native loader, which preserves vendor-specific boot logic.
  • Staged loading: GRUB on BIOS systems uses stage 1 in the MBR, a core image in the post-MBR gap and modules from the boot partition.
  • Secure Boot compatibility: a Microsoft-signed shim verifies and chain loads a distribution-signed GRUB, so Linux can boot without its own key in firmware.
  • Network and recovery paths: PXE firmware loads a small network loader, which then chain loads a fuller loader such as iPXE or an installer.

Chain loading compared with direct kernel loading

A bootloader can either load a kernel directly or delegate to another loader. Direct loading means the bootloader understands the kernel format, passes the command line and initial RAM disk, and builds the boot information the kernel expects. Chain loading means it simply starts another loader and lets that loader do all of this.

AspectDirect kernel loadingChain loading
What is startedOS kernel and initial RAM diskAnother bootloader or EFI program
Knowledge requiredKernel format and boot protocolOnly how to load and start the next program
Typical useLinux booted by GRUB or systemd-bootWindows started from GRUB, recovery tools
Configuration controlCentral, in one loaderSplit between several loaders
Boot time impactFewer stepsOne extra stage, usually negligible
Direct kernel loading versus chain loading

Windows is the classic case for chaining, because Windows Boot Manager must load its own boot configuration data and cannot be replaced by a third-party loader. Linux kernels, by contrast, can be booted directly by many loaders or even by firmware through the EFI stub, which removes the need for a separate bootloader altogether.

Configuring chain loading in common bootloaders

Most bootloaders offer an explicit chain loading command or entry type. Correct configuration depends on the firmware mode, because a UEFI loader can chain only EFI executables and a BIOS loader can chain only boot sectors. Mixing modes is the most frequent reason a chained entry fails.

LoaderFirmware modeTypical directive or method
GRUB 2BIOSchainloader +1 on the target partition
GRUB 2UEFIchainloader with the path to an EFI file
systemd-bootUEFIEntry with an efi line pointing to the loader
rEFIndUEFIAutomatic detection of EFI loaders on all partitions
Windows Boot ManagerBIOS and UEFIBoot entry that loads a boot sector file or EFI path
Chain loading configuration in common loaders

In practice, administrators usually set the partition or file path by a stable identifier, such as a file system UUID, rather than by disk order. Disk numbers change when drives are added or USB devices are connected, and an entry that points to the wrong device fails silently or starts the wrong system.

Security risks and common failures

Every link in a boot chain is a place where untrusted code could gain control before the OS starts. Bootkits historically replaced the MBR or partition boot sector so that malicious code ran first and then chain loaded the genuine loader, hiding from the operating system. Secure Boot and measured boot counter this by requiring each stage to verify or record the next one before handing over control.

ProblemTypical causeRemedy
Chained entry shows an errorFirmware mode mismatch between loadersUse the same BIOS or UEFI mode for all stages
Security violation on bootNext loader is unsigned under Secure BootUse signed loaders or enroll a machine owner key
Wrong system startsDevice order changedReference partitions by UUID or label
Loader disappears after updateOS update overwrote the boot entryRestore the entry or reinstall the boot manager
Chain loading problems, causes and remedies

A subtle limitation is that a chained loader trusts what it receives. Firmware state, memory maps and configuration left by earlier stages can affect the next one, so a buggy first loader can cause failures that appear to come from the operating system. Keeping chains short and every stage updated is the most reliable practice.

The simple explanation

Chain loading is like a relay race at startup. The first runner is a tiny program that cannot carry much. Its only job is to hand the baton to the next program, which knows more and can finish the race.

This is how one computer can offer a menu of several systems. The menu does not need to know how each system starts. It just passes control to the right starter program, and that program takes it from there.

How it is used in practice

A software developer runs Windows 11 and Ubuntu on one UEFI laptop with Secure Boot enabled. The firmware boot entry starts the Microsoft-signed shim, which verifies and chain loads GRUB. GRUB shows a menu with Ubuntu, loaded directly with its kernel and initial RAM disk, and a Windows entry that uses chainloader to start Windows Boot Manager from the EFI system partition.

After a major Windows update, the laptop starts Windows directly because the update moved its own boot entry to the top of the firmware order. The developer restores the shim entry as the first boot option with the firmware settings, and the GRUB menu returns without reinstalling anything. Because every stage remains signed, the dual-boot setup works with Secure Boot fully enforced.