How can I prevent grub updates from resetting my EFI bootorder
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> |
| ^^^^ |
+---------------------------------------------------------------------------+
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.