📜 ⬆️ ⬇️

Installing the grub4dos bootloader on a USB flash drive from a linux console

What I have described below is extremely simple and obvious, but I hope it will at least help someone save a couple of hours of time.

On the Internet you can find many articles on creating multi-boot flash drives. They all boil down mainly to using grub4dos and syslinux. What could be simpler: download, for example, grub4dos, unpack, run and click a couple of buttons? It works, it only works under Windows.

What if I have linux? This is where a situation arises when there are a few more questions on the forums about how to install the bootloader in the MBR from linux more than the answers. I confess, I myself suffered until tonight.

It turned out just

All you need is just:
')

Theory

Briefly about the master boot record (MBR). According to Wikipedia , its structure is as follows:

Our task: copy the first 446 bytes from the grldr.mbr file to the beginning of the flash drive.

Practice

But not everything is so simple. That was the whole problem. It is not enough just to copy 446 bytes. After that we just see the error:
Missing MBR-helper

What's the matter?
The answer suggested that the grldr.mbr file is 9 kilobytes in size. Everything was decided by copying the rest of it to the same place - at the beginning of the disk (flash drive). Only the partition table and signature must be left; just skip 512 bytes:

dd if=grldr.mbr of=/dev/sdb bs=446 count=1 dd if=grldr.mbr of=/dev/sdb seek=512 skip=512 bs=1 

That's all. Now we copy the necessary files, ISO-images to the USB flash drive, edit menu.lst. Fortunately, for this part of the Internet there is a huge amount of information.

Conclusion

This article prompted me to write that on some site I saw a method using dd, but it did not work because of the completely incomprehensible use of the parameters of this utility.

I hope someone will be useful.

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


All Articles