D
D
DVoropaev2021-01-05 17:18:43
linux
DVoropaev, 2021-01-05 17:18:43

How to install grub from scratch?

There is the following task:
1) Take an empty media (HDD / USB)
2) Create a partition for linux on it
3) Write linux files to this partition
4) Install GRUB
5) Boot from this partition.

I installed GRUB following this guide (section INSTALLING GRUB UEFI GPT). But when I try to boot, I get the grub rescue command line on the screen.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AVKor, 2021-01-05
@AVKor

I installed GRUB following this guide (section INSTALLING GRUB UEFI GPT). But when I try to boot, I get the grub rescue command line on the screen.

That's the way it should be. What should it load if no OS is installed?

D
DollyPapper, 2021-01-06
@DollyPapper

GRUB is the bootloader. The purpose of the bootloader, excluding any settings, checks, etc., is to load the OS.
Read about the process of booting operating systems. In short:
1) The power supply supplies power to the system
itself 2) The ROM chip with the firmware written to it, this can be BIOS or UEFI starts hardware checks (see POST)
3) Next, the BIOS looks for a disk with a boot label
4) Reads from it the first 446 bytes (in the case of MBR), this is the initial loader, which has very little functionality, since you can’t put a lot of code into 446 bytes.
5) Already this loader transfers control to a more "fat loader", in your case GRUB.
6) GRUB makes its settings and starts the OS kernel, passing it different parameters (because in fact it is a regular C program). In your case, what does GRUB run? That's right - nothing, because it has nothing to run. There is no program that he could run. And when there is nothing to run, you find yourself in recovery mode, also known as grub rescue, where you can manually specify what needs to be run. It's not entirely clear from your description what you're trying to achieve at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question