[lfs-dev] Missing option for grub-install?
xry111 at mengyan1223.wang
Mon Jan 21 02:09:26 PST 2019
On 2019-01-21 10:44 +0100, Pierre Labastie via lfs-dev wrote:
> My machine has an UEFI BIOS, so that I rarely run grub-install. But yesterday,
> I built a new qemu VM, with a non-UEFI (virtual) BIOS. When running
> grub-install, it failed with a message (sorry, I haven't saved it) telling
> that it could not find /usr/lib/grub/x86_64-efi. Running "grub-install --help"
> --target TARGET install GRUB for TARGET platform [default=x86_64-efi]
> so I had to run "grub-install --target i386-pc /dev/sda". But now that I have
> done that, "grub-install --help" returns:
> --target TARGET install GRUB for TARGET platform [default=i386-pc]
> So the default seems to be what is already installed. Checking the source for
> grub-install confirms that. I must have taken a virtual disk used for a former
> VM with UEFI BIOS.
No. Grub 2.02 is detecting the target dynamically at runtime by checking if
/sys/firmware/efi is empty. At first time your system was booted via UEFI so
this is not empty. But at the second time your system was booted via Legacy
BIOS so this is empty.
> Should we add this switch (--target i386-pc) to the grub-install command in
> the book?
If the host is booted via UEFI we'll need that to install a non-UEFI Grub.
But I think it's dangerous (may break the booting process of the host). We
should explain this option more seriously (maybe in a "NOTE" or even
Xi Ruoyao <xry111 at mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University
More information about the lfs-dev