Pascal, thank you for taking time to describe this, that's quite a procedure.
I am still confused though: how come the same firmware is booting Linux in legacy and windows in EFI mode (did I get this right from your explanations?). The windows installation is pretty fresh, I can easily reinstall it, but how do I control which mode it is installed in (EFI vs legacy) - I don't recall any options for this anywhere. > Then ideally you must find a way to boot in EFI mode and start a shell > in Ubuntu. this also seems to indicate that I can control which mode the firmware is using to boot (how do I do that?), or is this a function of the image which is being booted? thank you again, -dc I'll try it over the weekend and report back. -v On Fri, May 11, 2018 at 12:05 PM Pascal Hambourg <[email protected]> wrote: > Le 11/05/2018 à 18:05, David Collier a écrit : > > > > Disk /dev/sdc: 465.8 GiB, 500107862016 bytes, 976773168 sectors > > Units: sectors of 1 * 512 = 512 bytes > > Sector size (logical/physical): 512 bytes / 512 bytes > > I/O size (minimum/optimal): 512 bytes / 512 bytes > > Disklabel type: gpt > > Disk identifier: AF6118F0-6BF8-460C-9622-F5BDA7EE3204 > > > > Device Start End Sectors Size Type > > /dev/sdc1 2048 1023999 1021952 499M Windows recovery > environment > > /dev/sdc2 1024000 1226751 202752 99M Microsoft basic data > > /dev/sdc3 1226752 1259519 32768 16M Microsoft reserved > > /dev/sdc4 1259520 976773119 975513600 465.2G Microsoft basic data > (...) > > /dev/sdc2: SEC_TYPE="msdos" UUID="A879-04E5" TYPE="vfat" PARTLABEL="EFI > > system partition" PARTUUID="2987d536-85c4-4a68-ad8a-7c880054bda9" > > At first I was surprised not to see an EFI system partition on sdc, but > here it is, sdc2. It just has the wrong partition type identifier in the > partition table, which should be "EFI system partition" instead of > "Microsoft basic data". You should correct this with your favourite > GPT-capable partition editor (gparted, parted, fdisk, gdisk...) > > >> This means that the system did not boot in EFI mode. It explains why > >> os-prober cannot detect Windows EFI boot loader. > >> Check what's in /boot and /boot/grub : I guess there is no /boot/efi > >> directory nor /boot/grub/x86_64-efi, but there is a /boot/grub/i386-pc > >> directory. > > > > yes, these guesses are correct. So, is there a way to make grub include > > windows 10 option in this case? How come the BIOS/UEFI, (whatever my PC's > > firmware is that is :) can boot both, but grub can not? > > Windows was installed for EFI boot, and I do not know any way around > this except by reinstalling it for BIOS/legacy booting. So you have to > install the GRUB boot loader for EFI booting (GRUB EFI). The GRUB > distribution is split in multiple packages for all supported targets and > usually you need to install the package grub-efi-amd64, but since you > built GRUB from source, I'll assume the needed files are already present. > > First, you must mount the EFI partition sdc2 on /boot/efi (create the > directory if it does not exist, and make the mount persistent in fstab - > as usual, use the UUID, not the unreliable device name). > > Then ideally you must find a way to boot in EFI mode and start a shell > in Ubuntu. For example boot from an EFI-capable live system or whatever, > chroot into Ubuntu's root and mount everything required (/dev, /proc, > /sys, /boot/efi...). efibootmgr should not complain about EFI variables > not being supported. > > From there, install GRUB EFI : > > grub-install --target=x86_64-efi --bootloader-id=Ubuntu > > This will install GRUB EFI as /boot/efi/EFI/Ubuntu/grubx64.efi and will > try to register a boot entry for it in the UEFI firmware NVRAM. If it > succeeds, efibootmgr should show a new "Ubuntu" entry, and it should > also be present in the UEFI boot menu. While in EFI mode, os-prober > should detect Windows Boot Manager and you can run update-grub to > include Windows in GRUB's menu. > > If you cannot run Ubuntu in EFI mode, here are a few workarounds : > > a) Some UEFI firmware allow to create a custom boot using a given EFI > boot file. Select \EFI\Ubuntu\grubx64.efi on the drive corresponding to > sdc. > > b) Install GRUB EFI as the fallback boot loader with > > grub-install --target=x86_64-efi --removable > > and, in the UEFI boot menu, choose to boot from the drive corresponding > to sdc in EFI mode (may be referred to as "EFI shell") > > c) Rename the Windows boot loader /boot/efi/EFI/Microsoft/bootmgfw.efi > and replace it with a copy of grubx64.efi. Yes, that's ugly but is > sometimes the only way to boot in EFI mode the first time. After > reinstalling GRUB EFI without error, restore the original bootmgfw.efi > so that you can boot Windows again. > > _______________________________________________ > Help-grub mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/help-grub > _______________________________________________ Help-grub mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-grub
