How to prevent Ubuntu from overwriting grub bootloader after update?

Grub remembers where to reinstall.

To see what drive grub2 uses see this line - grub-pc/install_devices, check what it is now:

sudo debconf-show grub-pc

to get grub2 to remember where to reinstall on updates, grub-pc is for BIOS and grub-efi is for UEFI, if you unselect everything then the command above should change to a blank or grub will not reinstall.

sudo dpkg-reconfigure grub-pc
sudo dpkg-reconfigure grub-efi-amd64

Enter thru first pages,spacebar to choose/unchoose drive, enter to accept, do not choose partitions

http://ubuntuforums.org/showthread.php?t=2189643

You can also just change to install grub to a partition. We suggest never to install to a partition as it does not work well, but if really booting with another copy of grub that is not really an issue.

How to: Create a Customized GRUB2 Screen that is Maintenance Free.- Cavsfan

https://help.ubuntu.com/community/MaintenanceFreeCustomGrub2Screen


@oldfred's answer led me to the correct one:

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>                       |
 |                                                ^^^^                       |
 +---------------------------------------------------------------------------+