I have an install of Ubuntu 16.04 server set up on two disks with software raid across two large partitions. The start of each disk contains an EFI partition. I would like to be able to boot from either disk (in case one fails) - one guide I read instructed to simply clone the EFI partition after installation using "dd" - however, I have found that this doesn't work - after reading a little, I think it is because GRUB entries containing a partition UID for the location of the kernel it is supposed to boot. So I think that the cloned grub.cfg contains some kind of UID reference for only one of the disks

My question is: How can I generate or even manually edit grub.cfg on each EFI partition so that it refers to the ubuntu installation on the same physical disk?

$ lsblk
sda             8:0    0 953.9G  0 disk  
├─sda1          8:1    0   476M  0 part  /boot/efi
└─sda2          8:2    0 953.4G  0 part  
  └─md0         9:0    0 953.3G  0 raid1 
    ├─vg-root 252:0    0 923.5G  0 lvm   /
    └─vg-swap 252:1    0  29.8G  0 lvm   [SWAP]
sdb             8:16   0 953.9G  0 disk  
├─sdb1          8:17   0   476M  0 part  
└─sdb2          8:18   0 953.4G  0 part  
  └─md0         9:0    0 953.3G  0 raid1 
    ├─vg-root 252:0    0 923.5G  0 lvm   /
    └─vg-swap 252:1    0  29.8G  0 lvm   [SWAP]

Using your favourite text editor, open /etc/default/grub.cfg and uncomment the line that says GRUB_DISABLE_LINUX_UUID=true

Update grub with the new configuration:

sudo update-grub

Copy the updated grub config to the other EFI partition:

dd if=/dev/sda1 of=/dev/sdb1

Enter the UEFI menu and disable all options (eg. UEFI shell) that are not one of the ubuntu installs.

  • Please explain why you should disable an option to boot to a UEFI shell. – fpmurphy Jul 17 '19 at 3:19
  • The idea was that we wanted the system to always boot into ubuntu, even if one of the disks broke and the system rebooted. With the particular machines I did this on, if you removed one of the hard drives, the boot priorities would be forgotten so in my testing I would remove a hard drive to see if it would boot into the other correctly and it would in fact, boot into a UEFI shell instead. I found that if I disabled the UEFI shell then it would reliably boot with the other HD. If I really wanted a UEFI shell, I could get it by pressing Del on boot. – ezekiel Jul 17 '19 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.