
How to update the GRUB bootloader on Debian and derivative distributions (Kali Linux, Ubuntu, Linux Mint)
February 17, 2023
The GRUB operating system loader is installed and updated on Linux like any other software package. But the peculiarity of the bootloader is that even after updating the package, the actual working files of the bootloader, which are located on the partition mounted along the /boot/grub/ path, are not automatically updated.
That is, when new versions of GRUB are released, the package in your OS is updated automatically.
But the bootloader itself, which is installed on a separate disk partition and mounted along the /boot/grub/ path, is not updated.
To start using the new features that are added in new versions of GRUB, you need to manually update the bootloader.
When to update the GRUB bootloader in /boot/grub/
The signal that a new version of GRUB has been released is something like the following messages:
Setting up grub-common (2.06-8+kali1) ... ........... Setting up grub2-common (2.06-8+kali1) ... ........... Setting up grub-pc-bin (2.06-8+kali1) …
Another sign that the GRUB package has been updated is a request to update the default GRUB configuration file.
In order to use the new features introduced in this GRUB update, it is recommended to install it in MBR or UEFI. Due to potential configuration incompatibilities, it is recommended that you perform both installation and configuration creation.
That is, if you see this message, then you need to update the bootloader in /boot/grub/.
How to check if GRUB is being used on the operating system
On Arch Linux and derivative distributions, the GRUB package can be installed but is not used because the bootloader is systemd-boot.
To verify that GRUB is the bootloader, run the following command:
ls -l /boot/grub/grub.cfg
If the /boot/grub/grub.cfg file is found, then GRUB is being used, if the grub.cfg file is not found, then GRUB is not used and does not need to be updated. That is, you do not need to follow the steps shown in this article!
For details, see the article: How to check if a computer is using BIOS or UEFI; GRUB or systemd-boot bootloader; MBR or GPT partition table
How to update the GRUB bootloader in /boot/grub/
To update the bootloader, you need to run a command like:
grub-install --recheck /dev/DISK
Where /dev/DISK should be the name of your drive.
Drive names can be checked with the command:
fdisk -l
Example output:
Disk /dev/vda: 50 GiB, 53687091200 bytes, 104857600 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x00000000 Device Boot Start End Sectors Size Id Type /dev/vda1 * 2048 104857566 104855519 50G 83 Linux Disk /dev/vdb: 450 KiB, 460800 bytes, 900 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
In this case, the drive name is /dev/vda. Note that /dev/vda is not a boot partition or some other partition – it's the entire drive.
So, the command to update GRUB in /boot/grub/ in my case is the following:
grub-install --recheck /dev/vda
Example output:
Installing for i386-pc platform. Installation finished. No error reported.
You also need to create a new configuration file with the following command:
grub-mkconfig -o /boot/grub/grub.cfg
Example output:
Generating grub configuration file ... Found linux image: /boot/vmlinuz-6.0.0-kali6-cloud-amd64 Found initrd image: /boot/initrd.img-6.0.0-kali6-cloud-amd64 Found linux image: /boot/vmlinuz-6.0.0-kali5-cloud-amd64 Found initrd image: /boot/initrd.img-6.0.0-kali5-cloud-amd64 Warning: os-prober will not be executed to detect other bootable partitions. Systems on them will not be added to the GRUB boot configuration. Check GRUB_DISABLE_OS_PROBER documentation entry. done
GRUB bootloader update and GRUB configuration update completed successfully. The next time you boot, your operating system will use the new features that were added by the GRUB update.
Related articles:
- How to update the GRUB bootloader in Arch Linux and derivatives (Manjaro, BlackArch) (81.4%)
- How to check if a computer is using BIOS or UEFI; GRUB or systemd-boot bootloader; MBR or GPT partition table (70.9%)
- Do services need to be restarted when updating packages (64.3%)
- How to change the default operating system in Arch Linux (for UEFI and systemd-boot) (62.6%)
- UEFI does not see installed Linux (SOLVED) (62.6%)
- htop command guide: how to view processes in Linux interactively (RANDOM - 50%)