On Wed, 2017-11-08 at 11:25 -0700, Chris Murphy wrote:
On Sun, Oct 22, 2017 at 8:03 AM, Patrick O'Callaghan
> I have a new external drive with Windows 10, cloned from my working
> QEMU/KVM setup under F26. I want the option of continuing to use it as
> a VM, or occasionally dual-booting directly into Windows. The VM is set
> up to use UEFI but my host is running under BIOS, so I need to change
> one of them to match the other. I prefer to change the host to UEFI as
> that is the preferred method for running VMs.
> So how do I go about it? If I simply boot using UEFI I get the EFI menu
> with a bunch of block devices and no \EFI directory, which I think
> means that I need to do something specific in Fedora. Is this some
> magic incantation with Grub? The Grub man pages are not clear.
GRUB for BIOS vs GRUB for UEFI are completely different. The commands
are different, where the bootloader goes is different, the contents
and location of the grub.cfg is different. Etc.
It is possible to do, I've done it a few times, but each time I did it
differently based on the prior experience, and inevitably I fucked
something up in each of those. It was always a case of "oh fuck, that
thing, goddamnit" It's over a dozen steps. This is the outline
1. Convert MBR to GPT using gdisk
2. Add ESP (likely involves shrinking a file system)
3. update /etc/fstab to include /boot/efi (if you want, I hate this
but I also hate persistently mounting /boot)
4. Mixed boot -> load the UEFI GRUB bootloader from live media, get to
grub CLI to find the BIOS grub.cfg, hack the cfg so it'll boot UEFI.
5. dnf install grub-efi shim
6. wipe the first 440 bytes of LBA 0
7. grub2-mkconfig pointed to new location on ESP
8. dracut -f
1-3 are easier done while booting live media, and of course the fs
resize is several substeps on its own
4 you have to do so the system is booted in UEFI mode so that all the
efi sysfs stuff is available for grub2-mkconfig to create a proper
cfg; offhand I think the main thing that's needed here is to change
linux16 to linuxefi and initrd16 to initrdefi
5 is the actual installation of the bootloaders, both shim and grub;
grub2-install is obsolete in this world now, do not use it
6. (nuke the site from orbit, only way to be sure)
7. self explanatory
8. enough has changed you probably need to do it, in fact it's
plausible you get a fail at step 4 without a uefi specific initramfs
but hey maybe not; maybe hacking on the rescue grub entry is better as
that is a no-host-only initramfs
It's pretty much like the two firmwares result indifferent sub architectures.
Thanks for the detailed answer. In the meantime, I did manage to boot
the Windows partition directly by tweaking the BIOS, although doing it
via Grub would be preferable.
With the imminent release of F27, I might take the plunge and just
install it directly as UEFI, though I don't know if I can do that
without a laborious backup and restore. I normally just upgrade using
dnf but this would presumably not work here.