| by Arround The Web | No comments

How to Update Grub on Arch Linux

For Ubuntu and other Linux systems, GRUB (GRand Unified Bootloader) is a bootloader tool. The Linux kernel, as well as the initial RAM disc (initrd), are loaded by it at system startup. If more than one operating system or kernel is available, the user may choose which one to start. Additionally, it offers the sophisticated users with a command-line interface to directly configure the boot procedure. In this guide, we will discuss the methods of updating Grub on the Arch Linux system.

Update the Arch Linux

Start from the following listed command that is used to update the package databases and upgrade all packages on a system that is running on Arch Linux. The -S flag tells Pacman to sync (install or update) the packages. The -y flag tells Pacman to assume yes as an answer to any question that it may ask. And the -u flag tells Pacman to also upgrade the packages that are already installed on the system. In the output, you can see that the package databases for the core, extra, and community package repositories are already up to date.

[omar@omar ~]$ sudo pacman -Syu

Install Grub

Now, if grub is not yet installed, we install it using the “grub” package within a Pacman command. The -S flag tells Pacman to sync (install) the package. In the output, you can see that the “grub” package is already up-to-date and the command reinstalls the package. It then proceeds with the installation of the “grub” package. It checks for file conflicts and available disk space.

[omar@omar ~]$ sudo pacman -S grub

Update Grub Using Grub Customizer

The “/etc/default/grub” file is a configuration file for the GRUB boot loader which is used to manage the boot procedure of the system. It contains various options and settings that determine how GRUB behaves and what options are presented to the user at boot time. It is important to be cautious when editing this file since making mistakes or using incorrect settings can lead to the system being unable to boot. After making changes to it, save it using Ctrl+S.

[omar@omar ~]$ sudo nano /etc/default/grub

Grub-customizer is a graphical interface tool to configure the grub2/burg settings and appearance. It allows the users to edit the menu entries, update the GRUB configuration file, change the background image, and more which provide an easy-to-use interface to manage the boot process. The following command is used to install the “grub-customizer” package on a system that runs on Arch Linux. In the output, you can see that Pacman installs the “grub-customizer” package. Pacman then checks the available disk space and processes the package changes.

[omar@omar ~]$ sudo pacman -S grub-customizer

Now, search for the Grub Customizer application in your system activity area as shown in the following image. Then, open it.

It might require authentication. Therefore, add your system password to continue.

You can see the configuration settings if you want to make any changes in the first place.

Within its “Appearance settings” tab, you can find the settings regarding the appearance of your Linux system. After making changes, save and close the Grub Customizer.

The GRUB2 “grub.cfg” bootloader file is generated by the grub-mkconfig command based on the settings in the /etc/default/grub file and the files in the /etc/grub.d directory. By generating the grub.cfg file, you can ensure that your system’s boot loader is configured correctly and that it includes the latest changes that you made to your system’s boot settings using Grub Customizer.

[omar@omar ~]$ sudo grub-mkconfig -o /boot/grub/grub.cfg

Using the Update-Grub Repository

If you find the previous method tricky and long, you can switch to the installation of the update-grub repository from Git. The following command is used to install the “git” and “base-devel” packages on Arch Linux. The “base-devel” is a group of packages that are commonly used to build and compile the software from the source on Arch Linux. The command asks the user to confirm the installation and shows the total size of packages to be installed and the net upgrade size. Once the user confirms with y, the command proceeds with the installation.

[omar@omar ~]$ sudo pacman -S git base-devel

The following command is used to download a copy of a package called “update-grub” from the Git version control system. The package is downloaded to a new directory called “update-grub” in the current working directory. The process of downloading the package is called cloning. It includes several steps like enumerating the objects, counting the objects, compressing the objects, reusing the objects, and receiving the objects. After downloading the package, you can apply it by going to the update-grub directory.

[omar@omar ~]$ git clone https://aur.archlinux.org/update-grub.git

The update-grub folder can be found in the current working directory of Arch Linux as per the ls command.

[omar@omar ~]$ ls
Desktop    Downloads  Pictures  Templates  docker-git  update-grub
Documents  Music      Public    Videos     index.jpg   yay

The next command, “cd update-grub”, changes the current working directory to the directory of the cloned repository.

[omar@omar ~]$ cd update-grub

The final command, “makepkg -sri”, is used to build and install the package from the cloned repository using the makepkg utility. The “-s” flag is to build the package with all dependencies. The “r” flag is to install the package after building it. And the “i” flag is to isntall the package without prompting for confirmation.

[omar@omar update-grub]$ makepkg -sri

The following command uses the AUR “yay” helper program to install the “update-grub” package from the Arch User Repository (AUR). The command first checks for any package conflicts and inner conflicts. Then, it lists the package it finds (update-grub 0.0.1-7) and prompts the user to confirm the installation.

[omar@omar update-grub]$ yay -S update-grub

Here are the instructions to update the Grub bootloader configuration file on the system. The command is typically used after making changes to the system’s boot configuration such as installing a new operating system or modifying the boot order of the existing operating systems. The command generates the Grub configuration file by searching for the installed Linux kernels and initial ram disk images and then adding them as boot options in the configuration file.

[omar@omar update-grub]$ sudo update-grub

Conclusion

The guide introduction lets you know about the uses of Grub in different Linux-like operating systems. It tells how important it is to use it for boot loading. After this, we installed Grub on Arch Linux and discussed two different ways to update it one by one using the grub customizer and the update-grub repository of Git. Using the grub configuration file shows how you can make changes and then save it for boot loading.

Share Button

Source: linuxhint.com

Leave a Reply