7

I'm using Clover as my first and default bootloader. If Ubuntu is selected there, then Grub is activated (AFAIK there is no way to skip this step, I don't really use Grub at all, so I might as well remove it). My system uses UEFI, so I've set my preferred bootorder using

sudo efibootmgr -o XXXX,YYYY,ZZZZ

which works fine, until Grub is updated again. During the update my UEFI boot order settings are overwritten by the Grub defaults, with which Grub is always set as the first bootloader to be reached.

Is there anyway to persist the boot order that I have set up and prevent Grub from changing it back to its own defaults?

  • Are there any entries for Clover in /boot/grub/grub.cfg and /etc/default/grub? – Paul Benson Sep 07 '18 at 14:29
  • No but clover does not need to be, I reckon? It's kind of a 'meta'-bootloader which should be invisibleto grub. You can't get into clover from the grub menu for instance. The only thing that needs to happen, is that Grub leaves the EFI boot order untouched when updating. – Daniel Schreij Sep 08 '18 at 07:43

2 Answers2

7
sudo dpkg-reconfigure grub-efi-amd64

For the first couple of questions accept the existing values (just press Enter) but when it comes to this, select No:

 +----------------------| Configuring grub-efi-amd64 |-----------------------+
 |                                                                           |
 | GRUB can configure your platform's NVRAM variables so that it boots into  |
 | Debian automatically when powered on. However, you may prefer to disable  |
 | this behavior and avoid changes to your boot configuration. For example,  |
 | if your NVRAM variables have been set up such that your system contacts   |
 | a PXE server on every boot, this would preserve that behavior.            |
 |                                                                           |
 | Update NVRAM variables to automatically boot into Debian?                 |
 |                                                                           |
 |                    <Yes>                       <No>                       |
 |                                                ^^^^                       |
 +---------------------------------------------------------------------------+
Tobia
  • 575
  • 2
  • 5
  • 15
1

The answer from Tobia worked for me on one machine, but on a different machine I found that grub-pc was installed instead of grub-efi-amd64. When I tried dpkg-reconfigure grub-pc, I found that it doesn't always ask this question, despite it sometimes being used in EFI mode. So getting to the crux of where this setting lives, I found that they are both actually modifying the debconf database entry named grub2/update_nvram. Thanks to this article, I found that you can directly set this variable with the following command:

echo "set grub2/update_nvram false" | debconf-communicate

You can confirm the setting this way:

echo "get grub2/update_nvram" | debconf-communicate

...which will output the current value of the variable.

Ethan T
  • 204
  • 1
    Unfortunately this answer doesn't work on my Ubuntu 20.04 system. I have set grub2/update_nvram to false and I can verify it using sudo debconf-show grub-pc but the boot-order is still changed when grub-pc is updated via apt upgrade. – Robert Aug 31 '21 at 13:36