Linucate
~ Linucate_

102.2 Install a boot manager

All Levels

Introduction

This lesson is about putting a boot manager in the right place and making basic changes safely.

The main question is:

How does the system know what to boot, and how do you change that without making a mess?

For LPIC-1, the usual focus is GRUB.

What you should be able to do after this lesson:

  • Explain what a boot manager does.
  • Know the difference between BIOS and UEFI boot locations.
  • Recognize common GRUB files.
  • Run basic GRUB install and config rebuild commands.
  • Use the GRUB menu and command line for simple recovery tasks.

Before you start:

  • bootloader changes are not good guesswork; the wrong target can leave a system unbootable
  • temporary GRUB menu edits are safer than permanent changes when you are testing
  • always confirm BIOS or UEFI mode before repairing or reinstalling GRUB

Big Idea: The Boot Manager Sits Between Firmware and Linux

The boot manager starts after BIOS or UEFI and before the Linux kernel.

Its job is to:

  • offer boot choices
  • load the kernel
  • load initramfs
  • pass boot options to the kernel

If the boot manager is broken, Linux may be fine but never get a chance to start.

Common Boot Manager Names

For LPIC, the important names are:

  • GRUB Legacy
  • grub.cfg
  • grub.conf
  • menu.lst
  • grub-install
  • grub-mkconfig

Historical note

  • GRUB Legacy is the older GRUB generation
  • menu.lst and grub.conf are older names you still need to recognize
  • modern GRUB 2 usually uses grub.cfg

BIOS vs UEFI: Where Boot Code Lives

BIOS systems

On BIOS systems, boot code is commonly installed to the disk boot area, often discussed together with the MBR.

Typical idea:

  • firmware reads boot code from disk
  • boot code starts GRUB

UEFI systems

On UEFI systems, the firmware starts an EFI bootloader from the EFI System Partition.

Typical idea:

  • firmware reads a boot entry from NVRAM
  • that entry points to a file on the ESP
  • the bootloader then starts Linux

Example output from a firmware mode check:

UEFI

What this shows:

  • the current machine booted in UEFI mode
  • a UEFI system normally needs an EFI System Partition

Basic GRUB 2 Files and Commands

Common commands

sudo grub-install <device>
sudo grub-mkconfig -o <grub.cfg>

Use these as "know what they do" commands first. Do not run them blindly on a system unless you are sure about the firmware mode, boot disk, and config path.

Common file names

/boot/grub/grub.cfg
/boot/grub2/grub.cfg
/etc/default/grub

The exact path depends on the distribution. The exam idea is more important than the distro detail:

install GRUB -> adjust settings -> rebuild the generated config

Example output from ls -1 /boot | head -n 8:

EFI
amd-ucode.img
initramfs-linux-lts-fallback.img
initramfs-linux-lts.img
initramfs-linux.img
loader
vmlinuz-linux
vmlinuz-linux-lts

What this shows:

  • /boot contains kernels and initramfs images
  • UEFI systems often also have an EFI directory under /boot
  • one machine can keep multiple kernels or fallback images

What grub-install Does

grub-install puts GRUB in the correct boot location.

Examples:

  • BIOS style: install to a disk such as /dev/sda
  • UEFI style: install files into the ESP and register or use a boot path

Important beginner rule:

  • install to the disk, not to a normal data partition, unless you know exactly why

What grub-mkconfig Does

grub-mkconfig builds the final GRUB config file.

It usually reads settings from places such as:

  • /etc/default/grub
  • scripts under a GRUB config directory

Typical use:

sudo grub-mkconfig -o /boot/grub/grub.cfg

Some distributions wrap this with:

sudo update-grub

Safe Basic Changes

Common changes beginners make:

  • change default timeout
  • change default boot entry
  • add a kernel parameter

Typical place:

/etc/default/grub

Common variables to recognize:

  • GRUB_TIMEOUT
  • GRUB_DEFAULT
  • GRUB_CMDLINE_LINUX
  • GRUB_CMDLINE_LINUX_DEFAULT

After changes, rebuild the config.

Backup Boot Options

LPIC also cares about fallback thinking.

Good safety ideas:

  • keep more than one kernel entry if possible
  • keep a rescue entry if the distro provides one
  • know how to boot manually from the GRUB menu
  • know whether the system is BIOS or UEFI before repairing anything

Interacting with GRUB

Edit a menu entry temporarily

  1. Open the GRUB menu.
  2. Highlight an entry.
  3. Press e.
  4. Change the linux line.
  5. Boot once with Ctrl+x or F10.

This is good for testing because it does not permanently edit disk files.

Use the GRUB command line

Press c to get the GRUB prompt.

Commands to recognize:

ls
set root=(hd0,1)
linux /vmlinuz root=...
initrd /initrd.img
boot

A Simple Recovery Mindset

If the system is not booting:

  1. Confirm BIOS or UEFI mode.
  2. Confirm the expected boot disk.
  3. Check whether GRUB is installed in the right place.
  4. Check whether grub.cfg exists.
  5. Try a temporary GRUB edit or manual boot.

Common Beginner Mistakes

  • installing GRUB to the wrong disk or wrong boot context
  • treating BIOS and UEFI repairs as if they were the same procedure
  • editing persistent GRUB settings when a temporary menu edit would be safer
  • rebuilding config without checking the expected output path for the distribution
  • seeing old names such as menu.lst and assuming they are the main modern config

Legacy / Exam Note

Real systems today usually mean GRUB 2 plus either BIOS or UEFI. LPIC still expects recognition of older names and older concepts such as:

  • GRUB Legacy
  • menu.lst
  • grub.conf

That material is mostly about recognition and recovery context, not about recommending old bootloader setups for new systems.

Practice Step by Step

1) Make a safe GRUB change
  1. Edit /etc/default/grub.
  2. Change a simple setting such as timeout.
  3. Rebuild config with grub-mkconfig or update-grub.
  4. Reboot and verify.
2) Test a boot parameter without changing files
  1. Open GRUB.
  2. Press e.
  3. Add a temporary kernel parameter.
  4. Boot once.
  5. Reboot again and confirm the change did not persist.

Cheat Sheet

  • boot manager = chooses and starts the kernel
  • BIOS and UEFI use different boot paths
  • grub-install = install GRUB in the boot path
  • grub-mkconfig = generate the final GRUB config
  • grub.cfg = generated GRUB config
  • /etc/default/grub = common place for simple GRUB settings
  • menu.lst and grub.conf = older names you should recognize
  • GRUB menu: e to edit, c for command line
🎯

Test Your Knowledge

Complete the quiz to assess your understanding of this course's concepts.