Skip to content

GRUB

September 29, 2023
December 17, 2014

Grub is both boot loader and boot menu.
It loads /boot/grub/grub.cfg and present the menu.

GNU GRUB - Wikiwand
GRUB - ArchWiki
GRUB/Tips and tricks - ArchWiki
GNU GRUB Manual
Grub2 - Community Help Wiki

Commands in the Grub Command-line | Linux.org
Understanding the Various Grub Modules | Linux.org

How to Configure the GRUB2 Boot Loader’s Settings

iso boot

Grub2/ISOBoot - Community Help Wiki
How to Boot Linux ISO Images Directly From Your Hard Drive
Grub4dos Guide - Configuration File Entries

Kernel params

Kernel/KernelBootParameters - Ubuntu Wiki

# this is equivalent to setting `psmouse.proto=bare` upon boot
sudo modprobe -r psmouse && sudo modprobe -r psmouse proto=bare

Restore GRUB after Windows install

# check Linux partition
sudo fdisk -l
# mount Linux root
sudo mount /dev/nvme0n1p2 /mnt/root
arch-chroot /mnt/root /bin/bash
# mount Linux EFI
mount /dev/nvme0n1p1 /mnt/esp
# install grub, `ls /mnt/esp/EFI` for bootloader-id
grub-install --target=x86_64-efi --efi-directory=/mnt/esp --bootloader-id=GRUB
# this will also add Window entry to menu (with os-prober)
grub-mkconfig -o /boot/grub/grub.cfg

# exit chroot
sudo reboot

Restore the GRUB Bootloader - Manjaro Linux
How to Reinstall the Boot Loader in Arch Linux - Jeremy Morgan's Tech Blog

Boot-Repair - Community Help Wiki
Ubuntu Boot Repair Tutorial – Linux Hint
Windows + Linux 雙系統救回 grub 選單的步驟 | 簡睿隨筆 | 學習過程的紀錄與備忘

Restore Windows after GRUB install

# this will wipe GRUB out
bootrec /fixmbr
# this won't
bootrec.exe /fixboot
bootrec.exe /RebuildBcd

Edit GRUB entries

grub-mkconfig uses the config in /etc/default/grub and rules in /etc/grub.d to generate grub.cfg.
update-grub in Debian system is just a wrapper to grub-mkconfig.

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

# diff first
sudo su
grub-mkconfig -o grub.cfg
diff grub.cfg /boot/grub/grub.cfg
# fish single line
sudo diff (sudo grub-mkconfig | psub)  /boot/grub/grub.cfg
# commit
mv grub.cfg /boot/grub/grub.cfg

How to Configure the Linux Grub2 Boot Menu the Easy Way

sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get install grub-customizer
pacman -S grub-customizer

Save default

Grub2/Submenus - Community Help Wiki

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

grub-set-default

References

kernel-parameters.txt
GRUB | LinuxNorth

OS Prober no longer ran by default as of today's update of grub - General system - EndeavourOS