💾 Archived View for zaney.org › posts › grubguide.gmi captured on 2021-12-17 at 13:26:06. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-11-30)

-=-=-=-=-=-=-

GRUB Guide

Please understand that this guide is written with Arch Linux in mind. GRUB is essentially the universal bootloader that most users are going to use. So here's how you can install and properly setup your new GRUB configuration.

BIOS

Before following the installation instructions below ensure you know whether your using UEFI or BIOS/Legacy. The best way to check is to load into your BIOS and check the boot method. If you don't see UEFI anywhere at all then it's a safe bet your not using it.

Installation

Install the grub package. (pacman -S grub)

(It will replace grub-legacyAUR if that is already installed.) Then do:

$ grub-install --target=i386-pc /dev/sdX

where /dev/sdX is the disk (not a partition) where GRUB is to be installed. For example /dev/sda or /dev/nvme0n1, or /dev/mmcblk0.

UEFI

Installation

First, install the packages grub and efibootmgr: GRUB is the bootloader while efibootmgr is used by the GRUB installation script to write boot entries to NVRAM.

Then follow the below steps to install GRUB:

$ grub-install --target=x86_64-efi --efi-directory=esp --bootloader-id=GRUB

Configuration

On an installed system, GRUB loads the /boot/grub/grub.cfg configuration file each boot.

Generate the main configuration file

After the installation, the main configuration file /boot/grub/grub.cfg needs to be generated. The generation process can be influenced by a variety of options in /etc/default/grub and scripts in /etc/grub.d/.

If you have not done additional configuration, the automatic generation will determine the root filesystem of the system to boot for the configuration file. For that to succeed it is important that the system is either booted or chrooted into.

Use the grub-mkconfig tool to generate /boot/grub/grub.cfg:

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

Detecting other operating systems

To have grub-mkconfig search for other installed systems and automatically add them to the menu, install the os-prober package and mount the partitions from which the other systems boot. Then re-run grub-mkconfig. If you get the following output: Warning: os-prober will not be executed to detect other bootable partitions then edit /etc/default/grub and add/uncomment:

GRUB_DISABLE_OS_PROBER=false

Then try the grub-mkconfig command again.

Home