• About Us
  • Contact Us
  • Terms Of Services
  • Privacy Policy
  • DMCA Policy
  • Our Sitemap
OperateLab
  • Home
  • Computers & Electronics
  • Technology
  • Internet
  • Internet Marketing
No Result
View All Result
  • Home
  • Computers & Electronics
  • Technology
  • Internet
  • Internet Marketing
OperateLab
No Result
View All Result

Home » Technology » How to Update Grub on Ubuntu and Other Linux

How to Update Grub on Ubuntu and Other Linux

David Wilson by David Wilson
January 18, 2022
in Technology
0
485
SHARES
1.6k
VIEWS
Share on FacebookShare on Twitter

In this tutorial, you’ll learn to update grub on Ubuntu or any other Linux distribution. You’ll also learn a thing or two about how this grub update process works.

How to update grub

Ubuntu and many other Linux distributions provide a handy command line utility called update-grub.

To update grub, all you have to do is to run this command in the terminal with sudo.

sudo update-grub

You should see an output like this:

[emailprotected]:~$ sudo update-grub
[sudo] password for abhishek:
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.0.0-37-generic
Found initrd image: /boot/initrd.img-5.0.0-37-generic
Found linux image: /boot/vmlinuz-5.0.0-36-generic
Found initrd image: /boot/initrd.img-5.0.0-36-generic
Found linux image: /boot/vmlinuz-5.0.0-31-generic
Found initrd image: /boot/initrd.img-5.0.0-31-generic
Found Ubuntu 19.10 (19.10) on /dev/sda4
Found MX 19 patito feo (19) on /dev/sdb1
Adding boot menu entry for EFI firmware configuration
done

You may see a similar command called update-grub2. No need to be alarmed or confused between update-grub and update-grub2. Both of these commands do the same action.

Around ten years ago, when grub2 was just introduced, update-grub2 command was also introduced. Today, update-grub2 is just a symbolic link to update-grub and both update grub2 configuration (because grub2 is the default).

Can’t find update-grub command? Here’s what to do in that case

It’s possible that your Linux distribution might not have update-grub command available.

What do you do in that case? How do you update grub on such a Linux distribution?

There is no need to panic. The update-grub command is simply a stub for running ‘grub-mkconfig -o /boot/grub/grub.cfg’ to generate grub2 config file.

Which means that you can update grub with the following command on any Linux distribution:

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

Of course, remembering update-grub command is a lot easier than the above command and this is the reason why it was created in the first place.

How does update-grub work?

When you install a Linux distribution, it (usually) asks you to install the grub boot loader.

Part of grub is installed on the MBR/ESP partition. Rest of the grub lies in /boo/grub directory of the Linux distributions.

As per its man page, update-grub works by looking into the /boot directory. All the files starting with vmlinuz- will be treated as kernels and they will get a grub menu entry. It will also add initrd lines for ramdisk images found with the same version as kernels found.

It also looks into all disk partitions for other operating systems with os-prober. If it finds other operating systems, it adds them to the grub menu.

Why would you need to update grub?

There could be a number of scenarios when you need to update grub.

Suppose you changed the grub config file (/etc/default/grub) to change the default boot order or reduce the default boot time. Your changes won’t take into effect unless you update the grub.

Another scenario is when you have multiple Linux distributions installed on the same system.

For example, on my Intel NUC, I have two disks. The first disk had Ubuntu 19.10 and then I installed Ubuntu 18.04 on it. The second OS (Ubuntu 18.04) also installed its own grub and now the grub screen is controlled by Ubuntu 18.04 grub.

On the second disk, I installed MX Linux but I didn’t install grub this time. I want the existing grub (controlled by Ubuntu 18.04) to handle all the OS entries.

Now, in this scenario, the grub on Ubuntu 18.04 needs to be updated so that it can see MX Linux.

As you can see in the image above, when I update the grub, it finds various Linux kernels installed on 18.04 along with Ubuntu 19.10 and MX Linux on different partition.

If I want MX Linux to control the grub, I can install grub on MX Linux with grub-install command and then the grub on MX Linux will start controlling the grub screen. You get the gist, right?

Using a GUI tool like Grub Customizer is a simpler way to make changes in grub.

In the end…

Initially, I had intended to keep it a short article as a quick tip. But then I thought of explaining a few things associated with it so that (relatively) new Linux users could learn more than just a simple command.

Previous Post

WordPress 5.4.1 Addresses 7 Security Issues and Fixes Several Bugs

Next Post

How to change the screensaver on XFCE

Related Posts

How To Install Adobe Flash Player On Mac

February 16, 2023

5 Best Armband Phone Holder For LG G8 ThinQS

February 8, 2023

Best Free Ad Blockers for Web Browsers – 2022

February 5, 2023

Background Check Services: How to Choose the Right Company?

February 4, 2023

How to install a Color Profile in Windows 10 using an ICC Profile

February 4, 2023

IPVanish Review – Despite a Few Quirks, a Hugely Capable VPN!

February 3, 2023
Next Post

How to change the screensaver on XFCE

Leave a Reply Cancel reply

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

No Result
View All Result

RECOMMENDEDREADS

Technology

How To Install Adobe Flash Player On Mac

by David Wilson
February 16, 2023
Web Development

Install Ubuntu Linux by Removing Windows [Beginner’s Guide]

by David Wilson
February 9, 2023
Technology

5 Best Armband Phone Holder For LG G8 ThinQS

by David Wilson
February 8, 2023
Technology

Best Free Ad Blockers for Web Browsers – 2022

by David Wilson
February 5, 2023
Technology

Background Check Services: How to Choose the Right Company?

by David Wilson
February 4, 2023

Top Stories

ZenMate VPN Review 2020 – Why it has a 45+ million usersbase?

January 17, 2023

WP Engine vs WPX Hosting: A Comparison With Speed Tests

November 29, 2022

Will Netflix Ban Me For Using a VPN?

February 19, 2022

Why website security affects SEO rankings (and what you can do about it)

January 27, 2022

Why is the High-Speed Internet Necessary

January 25, 2023

Which Apps Won’t Work in iOS 13? Compatible iPhone Apps

August 10, 2022

Find on Categories

  • Business & Industries (1)
  • Computers & Electronics (2)
  • Education & Careers (2)
  • Gaming (1)
  • General (24)
  • Internet (25)
  • Internet Marketing (14)
  • Technology (121)
  • Web Development (4)

OperateLab

We are a community of technology enthusiasts who believe that technology should be available to all and an effort should be made to help everyone understand it.

Contact Us at mail@operatelab.com

Connect on Social

Business & Industries

How to Use TickTick for Productivity: Notes, Read-Later, and Tasks

by David Wilson
January 1, 2022
Internet

ZenMate VPN Review 2020 – Why it has a 45+ million usersbase?

by David Wilson
January 17, 2023

© 2022 Copyright | OperateLab | All Rights Reserved By Us | Reproduction Of Contents Is Not Allowed.

No Result
View All Result
  • Home
  • Computers & Electronics
  • Technology
  • Internet
  • Internet Marketing

© 2022 Copyright | OperateLab | All Rights Reserved By Us | Reproduction Of Contents Is Not Allowed.