📜 ⬆️ ⬇️

GRUB2. Start

0. What is this?


I'll tell you about the new version of the most popular bootloader. It appeared optionally in stable Debian 5.0 Lenny, which means it can be concluded about some stability. Unfortunately, according to the developers themselves, there is no time for documentation, so everything is still working by typing, logic and comments in the code :)
Speaking of versions. The first and so far the main branch is the 0.9x branch (which has already been dubbed GRUB Legacy), and versions 1.xx are officially called GRUB 2.
So, how does this version differ from the good old default bootloader of everything and everyone? The official website says something like this :


As you can see, a lot of changes. Here I want to dwell on some practical moments that I encountered in my life.
Traditionally, I warn you: I did all the actions on a stable Debian Lenny. Your commands or file locations may differ (although it should not).

1. How to edit the menu?


This is a natural question when working with the loader. The new version approached him from the other side. If you open an analogue of the old menu.lst, file / boot / grub / grub.cfg, a surprise is waiting for you. File header reads:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/update-grub using templates
# from /etc/grub.d and settings from /etc/default/grub
#

That is, you can rule it with your hands, but this is not according to the rules.
According to the rules, the menu is now generated automatically, based on the scripts in /etc/grub.d and settings from the / etc / default / grub config
Having searched the script descriptions, we find the file /etc/grub.d/README, which sheds a ray of light on the tricky device of the new loader. We find out why we need prefixes in script names:

You can see the scripts themselves, written in the usual shell-language. They should not cause much difficulty. These scripts are simply looking for compiled kernels and init.rd images, respectively, in the likely directories.
If you decide to compile the kernel yourself, everything will be extremely simple: using the appropriate guide, you will receive a deb-package. When installing, it will put everything in its place and start the bootloader update. When the scripts run, in /boot/grub/grub.cfg there will be an updated menu with a new kernel. Without a single edit configs.

2. Warnings.


Now look at the other side: what bad can happen with such a scheme of work?

')

3. Conclusion


As you can see, GRUB has changed a lot. Like it or not, after a while more and more developers will add it to their distributions. And that means, you need to test, test and just help the community in the transition to a new generation of loaders. Successes!

Source: https://habr.com/ru/post/56216/


All Articles