What is GRUB in Kali Linux, and how do you configure and repair it?
GRUB (GNU GRand Unified Bootloader) is a vital component in Kali Linux that manages the boot process. It bridges the system firmware and the operating system, allowing users to boot into Kali Linux or other installed OSs. GRUB supports advanced features like multibooting, dynamic configuration, kernel parameter editing, and recovery options. It stores configurations in /etc/default/grub, and any changes require updating the configuration using sudo update-grub. Additionally, GRUB can be customized with themes, password protection, and custom kernel parameters. Understanding GRUB ensures efficient boot management and troubleshooting in Kali Linux systems.
Quick answer: GRUB is the boot loader Kali Linux uses. It starts after the firmware (BIOS or UEFI), shows a menu, loads the Linux kernel and initramfs, and hands control to the system. You configure it in /etc/default/grub and apply changes with update-grub. If Kali will not boot, repair it from a live USB with a chroot and grub-install.
Key takeaways
- GRUB 2 starts the kernel after BIOS or UEFI hands over control.
- Edit
/etc/default/grub, never/boot/grub/grub.cfgdirectly, then runupdate-grub. - Kali uses GRUB 2, with
os-proberavailable for dual-boot detection. - A broken GRUB is repaired from a live USB using chroot and
grub-install. - Back up the config and know your disk layout before changing the boot loader.
What does GRUB do?
GRUB (GNU GRand Unified Bootloader) is the first program that loads Kali after the firmware has finished its checks. It finds the kernel, loads it with an initial RAM filesystem (initramfs), passes it boot parameters, and starts it. If more than one operating system is installed, GRUB also lets you choose.
The sequence on a typical Kali install:
- BIOS or UEFI firmware starts.
- Firmware loads GRUB from the disk (the boot sector on BIOS systems, or an EFI system partition on UEFI systems).
- GRUB reads its configuration and shows the menu.
- GRUB loads the Linux kernel and initramfs.
- The kernel starts and
systemdbrings up the system.
The official GNU GRUB manual describes every option. Kali itself is covered in the Kali Linux documentation.
Where are GRUB's files?
| Path | Purpose |
|---|---|
/etc/default/grub | Main settings you edit |
/etc/grub.d/ | Scripts that build menu entries |
/boot/grub/grub.cfg | Generated file. Do not edit it by hand |
/boot/efi | EFI system partition on UEFI installs |
How do you change GRUB settings?
Edit /etc/default/grub, then regenerate the configuration. Make a backup first.
$ sudo cp /etc/default/grub /etc/default/grub.bak
$ sudo nano /etc/default/grub
$ sudo update-grub
Useful settings:
GRUB_TIMEOUT=5is how many seconds the menu waits.GRUB_DEFAULT=0boots the first entry. You can also use a saved entry.GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"sets kernel options. Removingquiet splashshows boot messages, which helps when debugging.
update-grub rewrites /boot/grub/grub.cfg from your settings and the scripts in /etc/grub.d/.
How do you boot into recovery mode?
Choose "Advanced options for Kali GNU/Linux" in the GRUB menu, then a recovery entry. You get a root shell that lets you fix passwords or broken packages. You can also press e on a menu entry to edit its options for one boot. Changes made this way are not saved.
How do you repair GRUB when Kali will not boot?
Boot from a Kali live USB, mount your installed system, and reinstall GRUB. First check your layout.
$ lsblk -f
Say Kali's root partition is /dev/sda2 and you boot in UEFI mode with the EFI partition on /dev/sda1. Your device names will differ. Then:
$ sudo mount /dev/sda2 /mnt
$ sudo mount /dev/sda1 /mnt/boot/efi
$ for d in dev dev/pts proc sys run; do sudo mount --bind /$d /mnt/$d; done
$ sudo chroot /mnt
# grub-install /dev/sda
# update-grub
# exit
On a BIOS (legacy) system you skip the EFI mount and run grub-install /dev/sda on the disk, not on a partition. Reboot and remove the USB.
Check ls /sys/firmware/efi in the live session. If the directory exists, you booted in UEFI mode and should use the UEFI steps.
Why does Windows disappear from the GRUB menu?
Dual-boot menus rely on os-prober. On recent Debian-based systems it is disabled by default, so Windows may not appear after an update. To enable it, set GRUB_DISABLE_OS_PROBER=false in /etc/default/grub and run update-grub. Check this against the Kali documentation for your version.
Common mistakes
- Editing
grub.cfgdirectly. The nextupdate-gruberases your change. - Running
grub-installon a partition instead of the disk on BIOS systems. - Forgetting to mount the EFI partition before the chroot on UEFI systems.
- Setting
GRUB_TIMEOUT=0and then being unable to reach the menu.
What about LILO?
LILO was the older Linux boot loader and is not used on modern Kali. Our LILO explainer covers the history.
Next steps
Understanding boot is basic Linux administration. If you are building those skills, look at our Linux training or read how the Linux file system hierarchy is laid out.
Related reading
Frequently Asked Questions
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Wow
0
Sad
0
Angry
0