The Bootloader Overwrites
The GRUB (GRand Unified Bootloader) is the critical piece of software that loads the Linux kernel when you turn on your computer. If you are running a complex multi-boot setup—perhaps dual-booting Ubuntu with Windows, Arch Linux, or a specialized hypervisor—you likely rely on a very specific, manually customized GRUB configuration to ensure all your operating systems boot correctly. The annoyance arises when Ubuntu runs a standard system update (via apt upgrade). If the update includes a new Linux kernel package, Ubuntu will automatically run the update-grub script at the end of the installation. This aggressively scans your hard drives and overwrites your carefully crafted GRUB configuration with its own auto-generated version, potentially breaking your ability to boot into your other operating systems.
How to Disable Auto-Updating by Redirecting the Script
The most foolproof way to stop Ubuntu from updating GRUB is to neutralize the update-grub command itself. Whenever the system tries to run it, we can tell Linux to run a blank, harmless script instead.
1. Open your terminal application.
2. The actual script that updates the bootloader is located at /usr/sbin/update-grub. We will rename this original file so it still exists but isn’t called by default:
sudo mv /usr/sbin/update-grub /usr/sbin/update-grub.original
3. Now, create a new, fake script in its place:
sudo nano /usr/sbin/update-grub
4. Inside this blank text file, type the following two lines:
#!/bin/bash
exit 0
5. Save the file (Ctrl+O, Enter) and exit the editor (Ctrl+X).
6. Finally, make the new fake script executable so the system can “run” it without throwing a permission error:
sudo chmod +x /usr/sbin/update-grub
Now, whenever an `apt upgrade` tries to update the bootloader, it will execute your fake script. The script will immediately exit with a success code (exit 0), making `apt` think the update was successful, while leaving your actual boot configuration completely untouched.
How to Manually Update When Needed
By neutralizing the script, you have taken full manual control of your bootloader. If you install a new kernel and you do want to update GRUB, you can simply run the original script that you renamed.
To manually generate a new configuration, use:
sudo /usr/sbin/update-grub.original
This allows you to control exactly when your bootloader is modified, preventing automated updates from destroying your multi-boot setup.