How to Update GRUB on Arch Linux

How to Update GRUB on Arch Linux
The boot loader is the very first program that’s executed when the computer starts. This piece of software then loads the entire operating system. Within the “open-source” operating systems like Linux and other Unix-flavored ones, GRUB is the most popular bootloader. If you didn’t know, GRUB is also open-source with TONS of supported configurations.If you’re using Arch Linux, then I assume that you’re using GRUB as the bootloader, right? Let’s check out how to update GRUB on Arch Linux.

Updating GRUB package

The very first thing to do is make sure that GRUB is up-to-date. When you update the system, pacman will take care of updating GRUB to the latest version.

sudo pacman -Syu

If you want to manually make sure that the system has the latest version of GRUB, use the following command.

sudo pacman -S grub

This command will reinstall GRUB, of course. However, pacman will check for the latest version from the server and if there’s an update available, will grab and install it.

Editing GRUB configuration

GRUB allows custom configuration. You can perform a number of actions using this opportunity, for example, setting the default OS (if multiple OS is installed), GRUB menu timeout, custom background image and much more. It’s also possible to set custom scripts for GRUB.

GRUB uses its own configuration file for performing all the actions. The file is located at “/etc/default/grub”. For GRUB scripts, “/etc/grub.d” directory is used.

Edit the GRUB configuration file.

sudo <editor> /etc/default/grub

For example, to change the GRUB wallpaper, change the value of “GRUB_BACKGROUND” variable.

GRUB also allows coloring the texts for easier reading.

At the start of the file, you’ll notice “GRUB_DEFAUTL” variable. It’s used to define which OS is the default one in the bootloader.

The next entry “GRUB_TIMEOUT” will decide how long the GRUB menu should remain open. By default, the value is 5 (seconds). If you want to unlimited GRUB menu show, set the value to any negative integer.

Once editing is complete, save the file.

Let’s check out the GRUB script directory.

GRUB customizer

This is a very helpful tool that allows easier customization of various GRUB settings. It’s a graphical tool and available directly from the Arch Linux repository.

sudo pacman -S grub-customizer

Start “grub-customizer” from the menu.

It’ll require the root password to start. After all, you’re calling a tool to perform system-level changes.

Every single option of the tool is simple and self-explanatory.

Reload GRUB

After making all the changes, it’s necessary to update the GRUB cfg file at the “/boot/grub” directory. Run the following command after making any change to GRUB’s configuration file.

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

If you’re not interested in running this lengthy command, you can use the “update-grub”. It’s a script that runs the previously mentioned command. However, it’s not available on the Arch Linux official directory. “update-grub” has to be grabbed from AUR.

Prepare your system for building and installing AUR packages.

sudo pacman -S git base-devel

Grab “update-grub” from AUR.

git clone https://aur.archlinux.org/update-grub.git

Start building “update-grub”.

Note: For easier AUR access, it’s recommended to use a suitable AUR helper. AUR helpers can automate the entire task. Learn how to use AUR.

yay -S update-grub

Once the installation is complete, you can directly call “update-grub” to do the job.

sudo update-grub

Final thoughts

GRUB is the most popular bootloader for all the Linux distros. It can work with other OS as well. For taking full control over the boot process, it’s necessary to have knowledge on manipulating GRUB configurations and updating GRUB properly.

Related Posts
Leave a Reply

Your email address will not be published.Required fields are marked *