In Ubuntu, I use the update-grub
command to update grub. Recently, I made a switch to Arch Linux for new adventures and there I encountered the error saying “sudo: update-grub: command not found”:
I remember choosing GRUB while installing Arch and the GRUB screen appeared too while booting the system. This is why I got confused when I saw the above error.
If you are in the same situation, let me share my findings with you.
Why do you see ‘update-grub’ command not found error?
You see the error because update-grub
is not a standard command like ls, cd etc. It’s not even a standard command that is installed with grub.
In Ubuntu, the command is just an alias and when you run the update-grub command, it runs the following command instead:
sudo grub-mkconfig -o /boot/grub/grub.cfg
The grub-mkconfig
is the command for managing grub. But the above command is difficult to remember so the aliased shortcut update-grub
was created.
đ
You can either run the above grub-mkconfig command or create a custom update-grub command to run the same.
How to fix the update-grub command not found error
You can put some effort and create a custom update-grub
command the same way it is implemented on Ubuntu and Debian.
It is a four-step process and I will assist you with every step.
Step 1: Create a new file
To create the update-grub
command, the first step is to create a new file.
So open your terminal and use the following command:
sudo nano /usr/sbin/update-grub
What the above command will do is create a new file named update-grub
in the /usr/sbin/
directory.
If you notice, there’s a nano
command used which is a text editor which is responsible for creating an opening the file just after executing the command.
It will open an empty file looking like this:
Step 2: Write new lines to the file
(secret: you don’t have to write but paste those lines đ)
- How to build a website with WordPress and what are the best plugins to use Building a website with WordPress is an excellent choice due to its versatility, ease of use, and a vast array of plugins that enhance functionality. Hereâs a comprehensive guide to building a WordPress website, along with recommendations for the best plugins
- Top WordPress Plugins for Managing Ads and Monetizing Your Website Effectively: Why is Ads Management Important for Website Monetization? Strategic ad placement throughout the website enables publishers to maximize ad revenue while ensuring a positive user experience. The positioning of ads is critical in capturing usersâ attention without being intrusive or disruptive. By understanding user behavior and preferences, publishers can make informed decisions regarding ad placement to ensure that the ads are relevant and engaging.
- Top Directory Plugins for WordPress to Create Professional Listings and Directories: If you are interested in establishing professional listings and directories on your WordPress website, the following information will be of value to you. This article will present the top directory plugins available for WordPress, which include GeoDirectory, Business Directory Plugin, Sabai Directory, Connections Business Directory, and Advanced Classifieds & Directory Pro.
- The Most Important Stages and Plugins for WordPress Website Development:Â Developing a WordPress website requires careful planning, execution, and optimisation to ensure it is functional, user-friendly, and effective. The process can be broken into key stages, and each stage benefits from specific plugins to enhance functionality and performance. Hereâs a detailed guide to the most important stages of WordPress website development and the essential plugins for each stage.
- .org vs .com: A Top Guide to the Differences in Domain Extension
When you set up a website for a business or a non-profit organisation, you might think the most important part of the address is the actual name. But the domain extension (the bit that comes after the dot) is just as important for telling people what your site is all about. - The Best WordPress Plugins for Image Optimization to Improve Load Times and SEO. The pivotal element lies in image optimization. This discourse delves into the significance of image optimization for websites and its impact on load times. Furthermore, we will delve into the advantages of leveraging WordPress plugins for image optimization, such as streamlined optimization processes, enhanced SEO, expedited load times, and an enriched user experience.
- What is a data center or Internet data center? The term âdata centerâ has become very common due to the role it plays in many of our daily activities. Most of the data we receive and send through our mobile phones, tablets and computers ends up stored in these data centers â which many people refer to as âthe Cloudâ, in a more generic way.
Once you execute the previous command, it will open the file where you have to add lines.
Simply select the following lines and paste them into the terminal using Ctrl + Shift + V
:
#!/bin/sh
set -e
exec grub-mkconfig -o /boot/grub/grub.cfg "$@"
Now, save changes and exit from the nano editor using Ctrl + O
, press the Enter
key and then Ctrl + X
.
Step 3: Change ownership of the file
Once you are done creating the file, you have to assign the ownership to the root user of that file.
For that purpose, you’d have to use the chown command in the following manner:
sudo chown root:root /usr/sbin/update-grub
Step 4: Change file permissions
In the last step, you have to change the read-write permissions using the chmod command as shown here:
sudo chmod 755 /usr/sbin/update-grub
What the above command will do is only the file owner can read, write, and execute the file whereas others can only read and execute.
Once done, use the update-grub
command it should work like you expect:
sudo update-grub
What’s next? How about customizing GRUB?
Well, there’s a perception that everything related to GRUB is difficult but it is not and customize the GRUB bootloader as per your liking without any complex steps.
For that purpose, you’d have to install grub customizer, a GUI utility to customize grub easily.
Sounds interesting? Here’s a detailed guide on how to install and use grub customizer on Linux:
I hope you will find this guide helpful.