The machine contains one SSD drive which is partitionned as following:
- EFI partition, vfat
- macos partition, apfs (recently converted from something else, pre high sierra)
- linux swap
- linux root, ext4
- grub is installed on the linux root and grub.efi was copied to the EFI fs
- the grub,efi was blessed by macosx so it could appear in the mac boot list (pressing Option at boot)
- grub then set its root to (hd0,gpt4) and run the linux kernel
Since the high sierra update, grub enters rescue mode and stops with a no such partition
error. The system cannot be booted.
Indeed, typing at the prompt :
ls
shows no(hd0,gpt4)
but a list of unexpected devices(hd0), (hd1), (hd2), (hd3), (hd4), (hd5), (hd5,gpt4), (hd5,gpt3),(hd5,gpt2), (hd5,gpt1)
set
showsroot
andprefix
set to the wrong devices :(hd0,gpt4)
and(hd0,gpt5)/boot/grub
From the rescue prompt:
set prefix=(hd5,gpt4)/grub
set root=(hd5,gpt4)
insmod normal
normal
Grub menu appears and linux can boot if /boot/grub/grub.cfg
is correctly set.
Obviousy, grub doesn't detect the same disk order at the EFI stage and when ran on linux.
grub-mkdevicemap
creates a /boot/grub/device.map
that can be altered to return (hd5)
in place of (hd0)
.
cat /boot/grub/device.map
(hd5) /dev/disk/by-id/ata-APPLE_SSD_SM0256F_S1K4NYBDB79405
(hd1) /dev/disk/by-id/usb-USB_Flash_Disk_FBF1101121103781-0:0
... hopefully setting prefix
and root
to the correct device
grub-install '(hd5,gpt4)'