Install Grub2 to PBR

It appears that this question has been asked many many times here, for e.g.:

  • Installing GRUB2
  • need to re-install grub2 to /boot pbr (not mbr). Use live cd and the grub-install?
  • How to install grub on the PBR instead of MBR?

But none of them is fully answered (or maybe to itself, to those questions not listed here, but not fully to the questions asked here). So let me ask it again, so that we can have a fully covered Q&A at a one-stop place.

The situation is simple:

  • There is a partition (partition-A) whose boot-loader is damaged, or is missing,
  • And we are booting into another Linux system, either from a different partition (partition-B) or Live-CD,
  • And the goal is to fully install the grub2 as the boot-loader to it. I.e., from OS in partition-B to OS on partition-A.

The task is simple too:

  • Install the grub2 as the boot-loader. This is done by grub-install.
  • Update the grub2 menu to boot whatever kernel found on partition-A. This is done by update-grub, right?

OK, now the devil is in the details,

  • for grub-install to install to PBR,
    • it complains it is unsafe/unreliable:

      GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..

    • And sometime it complains error: embedding is not possible, but this is required for cross-disk install too, as I read.
  • If only use grub-install but not update-grub, then
    • partition-A can be bootable, but only to a black GRUB2 screen with a commandline prompt.
    • However I see no option for update-grub to opearate on partition-A, instead of its own, partition-B.

So, all in all, please give details steps how to install grub2 to PBR of a different partition, with a menu booting whatever kernel found on partition-A. Thx.

UPDATE:

Alright, to make it fully a one-stop place, for those people who don’t even know what PBR is —

PBR is a term normally used in Multi-booting situation, which refers to the Partition Boot Record, apart from the Master Boot Record (MBR).