In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to update grub on Ubuntu and other Linux distributions, I believe most people do not know much about it, so share this article for your reference. I hope you will learn a lot after reading this article. Let's learn about it together.
How to update grub
Ubuntu and many other Linux distributions provide an easy-to-use command line utility called update-grub.
To update grub, all you need to do is run this command in the terminal using sudo.
Sudo update-grub
You should see an output like this:
[email protected]: ~ $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-genericFound initrd image: / boot/initrd.img-5.0.0-37-genericFound linux image: / boot/vmlinuz-5.0.0-36-genericFound initrd image: / boot/initrd.img-5.0.0-36-genericFound linux image: / boot/vmlinuz- 5.0.0-31-genericFound initrd image: / boot/initrd.img-5.0.0-31-genericFound Ubuntu 19.10 on / dev/sda4Found MX 19 patito feo (19) on / dev/sdb1Adding boot menu entry for EFI firmware configurationdone
You may see a similar command called update-grub2. There is no need to feel scared or overwhelmed between update-grub and update-grub2. The two commands perform the same action.
About 10 years ago, when grub2 was first introduced, the update-grub2 command was also introduced. For now, update-grub2 is just a symbol linked to update-grub, and they all update the grub2 configuration (because grub2 is the default).
Can't find the update-grub command? Here's what to do in this situation.
It may be that your Linux distribution may not have a update-grub command available.
What should you do in this situation? How do you update grub on such a Linux distribution?
There's no need to panic here. The update-grub command is just an entry to run grub-mkconfig-o / boot/grub/grub.cfg to generate the grub2 configuration file.
This means that you can update grub on any Linux distribution with the following command:
Sudo grub-mkconfig-o / boot/grub/grub.cfg
Of course, remembering the update-grub command is much easier than the above command, which is why it was created in the first place.
How does update-grub work?
When you install a Linux distribution, it (usually) requires you to install the grub boot loader.
Part of the grub is installed on the MBR/ESP partition. The rest of the grub remains in the / boot/grub directory of the Linux distribution.
Depending on its man page, update-grub works by looking in the / boot directory. All files that start with vmlinuz- will be treated as kernels, and they will get a grub menu item. It will also add initrd lines to the ramdisk image that is the same as the kernel version found.
It also uses os-prober to find all disk partitions for other operating systems. If other operating systems are found, it adds them to the grub menu.
Representational image of Grub Menu
Why do you need to update grub?
There are many scenarios where you need to update grub.
Suppose you modify the grub configuration file (/ etc/default/grub) to change the default boot sequence or reduce the default startup time. Unless you update grub, your changes will not take effect.
On the other hand, you install multiple Linux distributions on the same computer system.
For example, on my Intel NUC, I have two disks. The first disk has Ubuntu 19.10, and I installed Ubuntu 18.04 on it. The second operating system (Ubuntu 18.04) installs its own grub, and the grub startup screen is now controlled by Ubuntu 18.04 grub.
On the second disk, I installed MX Linux, but this time I didn't install grub. I want the existing grub (controlled by Ubuntu 18.04) to handle all operating system projects.
Now, in this case, the grub on Ubuntu 18.04 needs to be updated so that it can see the MX Linux.
As shown in the figure above, when I updated grub, it found many installed Linux kernels on 18.04, as well as Ubntu 19.10 and MX Linux on different partitions.
The above is all the contents of the article "how to update grub on Ubuntu and other Linux distributions". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.