Topics Covered:
Kernel Parameters
Boot Custom Kernel
Single User Mode
Linux Boot Process
GRUB Edit Mode
Root Password Recovery
Kernel 6.x
What Is GRUB and Why Should You Care?
When you press the power button on your Linux machine, a lot happens before you see the login screen. One of the most important players in this sequence is GRUB — the Grand Unified Bootloader.
GRUB’s job is simple to state but critical in practice: it finds the kernel image on disk, loads it into RAM, and hands control over to it. But GRUB can also do much more — it lets you choose which kernel to boot, pass special options to the kernel, and even recover from certain problems like a forgotten root password.
In this tutorial, we focus on the part of the boot process that many students skip — the GRUB menu itself and how you can interact with it at runtime. This is a skill that will serve you throughout your career as a Linux or embedded systems engineer.
Before we interact with GRUB, let’s understand where it fits in the big picture. The boot sequence on an x86 machine (simplified for modern UEFI + kernel 6.x systems) looks like this:
| 1. Power ON | → | 2. UEFI / BIOS POST, hardware init |
→ | 3. GRUB2 Menu + kernel loader |
→ | 4. Linux Kernel Decompress + init |
→ | 5. init / systemd PID 1, user space |
GRUB sits at step 3 — between firmware and the kernel
On a modern system using UEFI (which is the default on most laptops and desktops since ~2012), GRUB is stored as an EFI application in the EFI System Partition (ESP). On older BIOS-based systems, GRUB’s first-stage loader sits in the Master Boot Record (MBR). Either way, from your point of view as a developer, interacting with GRUB is the same.
When the machine starts, GRUB displays a menu listing all bootable entries. On Ubuntu 22.04 / 24.04 with kernel 6.x, a typical menu looks like this (simplified):
│ * Ubuntu, with Linux 6.8.0-mykernel │
│ Ubuntu, with Linux 6.8.0-mykernel (recovery mode) │
│ Ubuntu, with Linux 6.5.0-45-generic │
│ Ubuntu, with Linux 6.5.0-45-generic (recovery mode) │
└─────────────────────────────────────────────────────────┘Use ↑↓ arrow keys to select. Press ENTER to boot.
Press ‘e’ to edit the selected entry.
Press ‘c’ for a command-line.
The entry marked with * is the default. If you have compiled a custom kernel (for example 6.8.0-mykernel), it appears at the top because it was the most recently installed. Use the arrow keys to highlight your custom entry and press Enter to boot it.
This is where things get really interesting. When you highlight a GRUB menu entry and press e, GRUB opens an editor showing the raw configuration for that boot entry.
The edit screen contains several lines of GRUB script. The most important one starts with the word linux. It tells GRUB which kernel image to load and what parameters to pass to that kernel.
set root=’hd0,msdos1′
…
echo ‘Loading Linux 6.8.0-mykernel …’
linux /boot/vmlinuz-6.8.0-mykernel root=UUID=abc123 ro quiet splash ← KEY LINE
echo ‘Loading initial ramdisk …’
initrd /boot/initrd.img-6.8.0-mykernel
| Part | Example Value | What It Means |
|---|---|---|
| linux | — | GRUB command: “load this kernel image” |
| /boot/vmlinuz-6.8.0-mykernel | vmlinuz | Path to the compressed kernel image on disk |
| root=UUID=abc123 | UUID | Which partition is the root filesystem |
| ro | read-only | Mount root as read-only initially (kernel remounts rw later) |
| quiet | — | Suppress most kernel log messages during boot |
| splash | — | Show the graphical splash screen instead of text logs |
After pressing e, you can change any of these values. When you are done editing, press Ctrl + X or F10 to boot with your changes. These changes are temporary — they only apply to this one boot session. The stored GRUB config on disk is not touched.
quiet and splash from the linux line and boot. Instead of the Ubuntu logo, you will see all kernel messages scrolling past. This is called verbose boot and is extremely useful when debugging boot problems.The values you see after the kernel image path on the linux line are called kernel command-line parameters (also called boot parameters or kernel boot arguments). These are passed by GRUB to the kernel at boot time, and the kernel reads them very early in its startup sequence — before any user-space program runs.
You can view the parameters that your currently running kernel was booted with at any time:
cat /proc/cmdline
On a typical Ubuntu 24.04 system with kernel 6.8.x, the output looks something like:
BOOT_IMAGE=/boot/vmlinuz-6.8.0-45-generic root=UUID=d1a2b3c4-... ro quiet splash
| Parameter | Effect | When to Use |
|---|---|---|
quiet |
Hides most boot messages | Normal boot (cleaner output) |
splash |
Displays graphical boot screen | Desktop systems |
single or 1 |
Boot into single-user (rescue) mode | Maintenance, password recovery |
ro |
Root filesystem initially read-only | Standard — always present |
nomodeset |
Disables kernel mode-setting for GPU | When display is broken at boot |
init=/bin/bash |
Starts bash as PID 1 instead of systemd | Emergency recovery |
debug |
Enables extra kernel debug messages | Kernel development / debugging |
loglevel=N |
Sets kernel log verbosity (0=silent, 7=all) | Controlling how much you see at boot |
The full list of kernel parameters is documented in the kernel source tree under Documentation/admin-guide/kernel-parameters.txt. As of Linux 6.x, there are hundreds of parameters covering everything from CPU scheduling to memory management to device drivers.
Here is a practical skill that will save you one day: recovering from a forgotten root password without reinstalling the OS.
The trick is to boot the system into single-user mode (also called runlevel 1 or rescue mode). In this mode, the system starts up minimally and drops you into a root shell without asking for a password.
Here is how to do it step by step:
1
2
linux. Navigate to its end.3
single (or just the number 1) at the very end of that line:linux /boot/vmlinuz-6.8.0-mykernel root=UUID=abc123 ro quiet splash single
4
5
passwd username
6
rebootgrub-mkpasswd-pbkdf2) and lock down physical access to servers.init=/bin/bash instead of single on the kernel command line for true password-bypass recovery. Then remount root as read-write with mount -o remount,rw / before changing passwords.The GRUB edits you make by pressing e are one-time-only. They last only for that single boot session. To make permanent changes, you edit the GRUB configuration file.
On modern Debian/Ubuntu systems, the main GRUB configuration file that you should edit is:
/etc/default/grub
Some important options inside this file:
# Set the default boot entry (0 = first entry)
GRUB_DEFAULT=0
# How long to show the menu before auto-booting (seconds)
GRUB_TIMEOUT=5
# Command-line options passed to the kernel for normal boots
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
# Options passed to ALL boot entries (including recovery)
GRUB_CMDLINE_LINUX=""
After editing this file, you must regenerate the actual GRUB config file that the bootloader reads:
sudo update-grub
grub-mkconfig and writes the result to /boot/grub/grub.cfg. That file is the one GRUB reads at boot time. You should never edit /boot/grub/grub.cfg directly — it gets overwritten every time you run update-grub or install a new kernel.Interview Questions & Answers
These are questions commonly asked in embedded Linux and kernel development interviews related to the GRUB bootloader topic.
/proc/cmdline file./etc/default/grub different from /boot/grub/grub.cfg?/etc/default/grub is the human-editable configuration file where you set high-level options like timeout and kernel parameters. It is a source file. /boot/grub/grub.cfg is the actual file that GRUB reads at boot time — it is auto-generated by running update-grub (or grub-mkconfig) and should never be edited manually, as it gets overwritten on every kernel installation or GRUB update.single or 1 to the kernel command line in GRUB.quiet and splash kernel parameters?quiet suppresses most kernel log messages from appearing on the console during boot, reducing the log level so only critical messages are shown. splash is a desktop-environment parameter that tells the boot system to show a graphical splash screen (like the Ubuntu logo with a progress bar) instead of a text console. Removing both parameters gives you verbose boot output, showing every kernel message as the system starts — this is very useful for debugging kernel or driver issues during boot.Continue Your Linux Kernel Journey
Next up: Verifying your custom kernel configuration after boot →
