Linux

Updating GRUB in Ubuntu: Complete Guide to Rebuilding

This guide thoroughly explains how to correctly update and rebuild the GRUB bootloader configuration in Ubuntu. You'll learn to solve common problems when the system doesn't detect other OSes or fails to boot after disk partitioning changes.

Updated at February 16, 2026
5-10 min
Easy
FixPedia Team
Применимо к:Ubuntu 20.04 LTSUbuntu 22.04 LTSUbuntu 24.04 LTSDebian 11/12Linux Mint 21+

Introduction / Why This Is Needed

GRUB (Grand Unified Bootloader) is a bootloader that appears when you turn on your computer and allows you to select an operating system or kernel version. The GRUB configuration is automatically generated based on files in /boot and detected partitions. You need to update it when:

  • You installed a new OS (like Windows or another Linux distribution) alongside Ubuntu.
  • You removed an old kernel or updated your system.
  • You changed disk partitioning (created/deleted partitions).
  • The GRUB menu does not display the needed systems or shows errors.

This guide will help you correctly rebuild the GRUB configuration in just a few minutes so everything works stably.

Requirements / Preparation

Before starting, ensure that:

  1. You have terminal access to Ubuntu with administrator privileges (sudo).
  2. The system is booted and running in normal mode (not from a Live-USB, unless you are trying to repair an installed system).
  3. All disks that may contain other operating systems are connected (especially important for external HDD/SSD or if you changed SATA ports).
  4. The os-prober package is installed for automatic detection of Windows/Linux (in some distributions it is included by default).

Step-by-Step Instructions

Step 1: Check and Install os-prober

The os-prober package is a script that scans disks for other OSes. In most cases, it is already installed.

sudo apt update
sudo apt install os-prober

If the package is already installed, the command will report it. Important: In Ubuntu 22.04 and newer, os-prober is disabled by default in the GRUB config for security reasons (to avoid accidentally adding an untrusted OS). If you want GRUB to search for other systems, proceed to the next step.

Step 2: Enable OS Search (If Needed)

Edit the main GRUB configuration file:

sudo nano /etc/default/grub

Find the line GRUB_DISABLE_OS_PROBER. If it doesn't exist, add it to the end of the file:

GRUB_DISABLE_OS_PROBER=false

If the line exists and is set to true, change it to false. Save the file (Ctrl+O, Enter) and close the editor (Ctrl+X).

💡 Tip: If you don't want GRUB to automatically add found OSes (e.g., for security), leave this setting as true and add menu entries manually via /etc/grub.d/40_custom.

Step 3: Run the GRUB Configuration Update

Now execute the main command. It will gather information about all Linux kernels in /boot and other OSes (if os-prober is active).

sudo update-grub

You will see output similar to this:

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.15.0-78-generic
Found initrd image: /boot/initrd.img-5.15.0-78-generic
Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi
done

Here, Found Windows Boot Manager means Windows was successfully detected.

Step 4: Verify the Result (Optional)

After running the command, you can check what exactly made it into the configuration file:

grep -E "menuentry|submenu" /boot/grub/grub.cfg | head -n 10

This command will output the first 10 menu entries. Look for the names of your operating systems and kernel versions. If the needed OS (e.g., Windows) is missing, go back to Step 2 and verify that os-prober is correctly enabled.

Step 5: Reboot

Changes only take effect after a reboot, as GRUB reads the configuration when the computer starts.

sudo reboot

After rebooting, all detected systems should appear in the bootloader menu.

Verifying the Result

  1. When you turn on the computer, the GRUB menu will appear.
  2. The list should contain all installed operating systems (Ubuntu with different kernel versions, Windows, other Linux distributions).
  3. You can successfully boot into any of them.
  4. If you updated GRUB due to boot problems (e.g., "grub rescue>"), the system should now boot into normal mode without errors.

If the problem persists (e.g., Windows does not appear), proceed to the "Possible Issues" section.

Possible Issues

Issue: os-prober not found, or update-grub does not see Windows

Solution:

  1. Ensure the Windows partition is not disabled in UEFI/BIOS (e.g., via Fast Boot or Secure Boot).
  2. Check if the EFI partition is mounted (for UEFI systems). It is usually mounted at /boot/efi. If not, mount it manually and run update-grub again.
  3. Manually add Windows to GRUB via the /etc/grub.d/40_custom file. Example entry for UEFI:
    sudo nano /etc/grub.d/40_custom
    
    Add at the end:
    menuentry "Windows 11" {
        insmod part_gpt
        insmod fat
        insmod chain
        set root='(hd0,gpt1)'  # Replace with your EFI partition, find it using `sudo fdisk -l`
        chainloader /EFI/Microsoft/Boot/bootmgfw.efi
    }
    
    Then run sudo update-grub again.

Issue: After updating GRUB, the system does not boot, grub rescue> appears

Solution: This means GRUB cannot find its modules or configuration. Boot from an Ubuntu Live-USB and mount the root partition of your system. Then chroot into the system and reinstall GRUB:

# Assuming the root partition is on /dev/sda2
sudo mount /dev/sda2 /mnt
sudo mount /dev/sda1 /mnt/boot/efi  # If using UEFI
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
grub-install /dev/sda  # Install to MBR (for BIOS) or
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu  # For UEFI
update-grub
exit
sudo reboot

Issue: Too many old kernels in the GRUB menu

Solution: Remove old kernels via apt:

sudo apt autoremove --purge

Or manually, by viewing the list: dpkg --list | grep linux-image. Then run sudo update-grub again.

Issue: GRUB does not show the menu, boots Ubuntu immediately

Solution: The menu entry might be hidden. Check the GRUB_TIMEOUT setting in /etc/default/grub. It should be greater than 0 (e.g., GRUB_TIMEOUT=10). After modifying the file, you must run sudo update-grub.

F.A.Q.

Do I need to restart the computer after update-grub?
What's the difference between the update-grub and grub-install commands?
What to do if update-grub doesn't find Windows?
Can I update GRUB without internet?

Hints

Check for os-prober
Enable os-prober (if needed)
Run GRUB configuration update
Check generated config
Reboot the system
FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community