GRUB2 101: How to Access and Use Your Linux Distribution’s Boot Loader

grub2-linux-boot-loader-menu

Ubuntu and practically every other Linux distribution use the GRUB2 boot loader. Unless you have multiple operating systems installed, this bootloader is normally hidden — but it provides options you may sometimes need.

The boot loader is the part of Linux that loads when you first boot up your computer. It normally just boots the Linux kernel, which loads the rest of the operating system — but it also provides a menu with options of its own.

Access the GRUB2 Menu

To access the GRUB2 bootloader menu, you’ll need to restart your computer — or boot it if it’s shut off. If you have a dual-boot system installed, you’ll always see the GRUB2 menu appear when you boot your computer. That’s the default setting for a computer with multiple operating systems, as this menu provides a way to choose between them at boot.

By default, Ubuntu and other Linux distributions hide this menu. You can access the hidden menu by holding down the Shift key at the very start of the boot-up process. If you see your Linux distribution’s graphical login screen instead of the menu, restart your computer and try again.

gnu-grub2-boot-loader-menu

Boot Other Operating Systems and Tools

By default, GRUB2 will boot the Linux operating system you’ve installed. Use the Up and Down arrow keys as well to select and option in the menu, and press Enter to boot the selected menu entry.

If you have other operating systems installed — whether they’re Windows or other Linux distributions — you can use select and boot them from here. Your Linux distribution should automatically configure GRUB to list your other installed operating systems when you install it.

You can also access some additional tools here, although the exact options available will depend on your Linux distribution. For example, Ubuntu offers a “Memory test (Memtest86+)” option. This menu entry will boot the Memtest86+ memory-testing tool. Select it and press Enter to quickly perform a memory test without having to burn Memtest86+ to a disc or create a bootable USB drive from it. Press Escape or reboot your computer to leave the memory-testing environment.

run-memtest86 -from-grub

Boot Different Linux Kernels

GRUB2 is also where you can choose between your installed Linux kernels. The Linux kernel is the core of the operating system, and new Linux kernels with updates and fixes often arrive via your Linux distribution’s package manager. To switch to a new Linux kernel, you have to reboot your operating system and boot into it. This all happens automatically the next time you boot.

However, in some cases, a new Linux kernel might have a problem on your system. It may refuse to boot after you update, or you may experience hardware problems. For this reason, Linux distributions generally keep at least one older Linux kernel around. You can switch to the older Linux kernel by rebooting into your GRUB boot loader and selecting the old kernel. Ubuntu configured GRUB to hide these options under “Advanced options for Ubuntu.” Select it and press Enter and you’ll see a list of Linux kernels you can choose to boot. The most recent kernel appears at the top of the list, has the highest version number, and is selected by default.

select-linux-kernel-in-grub2-boot-loader-on-ubuntu-14.04

Use Recovery Mode

Ubuntu also provides a “Recovery Mode” option here. Other Linux distributions may provide something similar. Boot into recovery mode and you’ll see a list of options designed to help you troubleshoot and recover an Ubuntu installation. If you ever need to fix your Ubuntu system, the options here may help. However, these tools aren’t as easy-to-use and helpful as the graphical system repair tools you’d find on a Windows installation disc.

ubuntu-14.04-recovery-mode-menu

Edit Boot Options

GRUB2 has some more advanced options. You can press c to open a GRUB2 command-line environment, where you can run various GRUB2 commands. Or, you can select a boot option and press e to edit that menu entry’s boot options by hand. For example, this would allow you to boot into different “runlevels.” By default, your Linux distribution probably boots into runlevel 5, which generally starts the system with a graphical desktop. You could boot into runlevel 3 — the standard system without a graphical desktop — or runlevel 1 — a single-user mode designed for administrative tasks.

To change boot options, select a boot entry with your arrow keys and press e. Edit the boot options and press Ctrl+X or F10 when you’re ready to boot. To edit the runlevel, locate the line beginning with “linux,” go to the very end of it, add a space, and then type the number of the runlevel you wanted to use. Note that the “linux” line may be very long and split across multiple lines.

For example, below we’ve moved the text-entry cursor to the end of the “linux” line.

edit-linux-boot-parameters-on-ubuntu

Next, we pressed space and typed 3 to specify runlevel 3. Pressing Ctrl+X or F10 would boot to runlevel three. This change is only temporary — it will just be used once and GRUB2 won’t remember it in the future.

change-runlevel-in-grub2-on-ubuntu-14.04


You shouldn’t need to tamper with GRUB2 much — it usually does its job and stays out of the way. Even people who need to use GRUB2 will generally just use it as a menu to choose their desired operating system when they boot their computers.

Image Credit: Paul Schultz on Flickr

Chris Hoffman is a technology writer and all-around computer geek. He's as at home using the Linux terminal as he is digging into the Windows registry. Connect with him on Google+.