0

I have two M.2 NVMe drives installed in my system, and booting from either one will load the grub from the eighth partition (an 18.04 install) of the second drive. I've confirmed this by looking at the /boot/grub/grub.cfg and it matches the contents of the grub menu.

As far as I understand how this works, this means that the EFI System Partition on both disks is "pointing at" nvme1n1p8.

I'm trying to set kernel parameters for the Ubuntu 20.04 install that I have on the seventh partition of the second drive, update-grub updates /boot/grub/grub.cfg there, but I can't access this menu (e.g. the menu that will show 18.04 as an alternative with the main top entry as "Ubuntu" (going to 20.04)).

I believe that all I need to do is run install-grub and pick which disk I want to overwrite grub with. It should cause it to point at nvme1n1p7 like I want.

However I am curious if there is some kind of a less intrusive way to perform this edit. Maybe I could go dig around in the efi partition itself and edit whatever specifies the 8th partition with the 7th partition... This would be handy if for whatever reason I wanted to check (without actually booting and testing) from a running OS which ESP points at which partition. I'm skeptical that this would be practical vs. just trying it. But I'm curious how it works. But I definitely won't bother if it involves hexediting.

Steven Lu
  • 182
  • Your motherboard firmware determines which volume your device boots first. I'm really not clear what is the problem and what you are trying to change. – Nmath Mar 30 '21 at 16:35
  • Ubuntu's Ubiquity installer only installs to ESP on first drive with UEFI regardless of what you specify. Posted work around to manually unmount & mount correct ESP during install #23 & #26 https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1396379 Originally I was just backing up ESP or manually reinstalling grub to ESP on sdb when installing a test install. But have edited /boot/efi/EFI/ubuntu/grub.cfg. https://askubuntu.com/questions/792413/how-to-set-grub-from-second-linux-distribution-as-default-in-uefi-boot – oldfred Mar 30 '21 at 16:49
  • In the EFI, the file /EFI/ubuntu/grub.cfg is a stub which reads in the maintained grub.cfg from the root you want to boot. You can edit the partition numbers and the UUID of the root you want with a text editor. – ubfan1 Mar 30 '21 at 21:22
  • Neither disk's ESP partition /EFI/ directory contained a grub.cfg anywhere. After I got grub installed and working now it has one. I see that this file does specify a disk uuid, that may come in handy! – Steven Lu Mar 30 '21 at 21:38

1 Answers1

0

I had to install grub-efi-amd64 in order for grub-install to work, and i had to mount /dev/nvme1n1p1 to /boot/efi (which I mkdir'd), and then grub-install --target=x86_64-efi /dev/nvme1n1 worked and the grub that was set up now gets loaded.

Now I can decide which OS's grub menu and config to load by choosing which drive to boot from the motherboard UEFI boot menu.

Steven Lu
  • 182