What GRUB is and why you might install it on Windows 11
GRUB (Grand Unified Bootloader) is the program that starts your computer and lets you choose which operating system to load — Windows, Linux, or another system. On a Windows 11 machine, you install GRUB when you want to dual-boot Linux alongside Windows, because GRUB can manage both systems at startup. Without it, your computer would boot directly into Windows every time.
Installing GRUB from the Windows 11 command line is the fastest route if you already have a Linux system on your machine or a bootable Linux USB drive ready. The process writes GRUB to your boot partition — the small, hidden section of your disk that your computer reads first when it powers on.
This is a technical task that changes how your computer starts. If something goes wrong, you may not be able to boot into Windows until you fix it. Back up your important files before you begin, and make sure you have a Windows recovery drive or installation media on hand in case you need to restore your system.
Key Takeaways
- GRUB is a bootloader that lets you choose between Windows and Linux when your computer starts up.
- You need either a Linux system already installed on your machine or a bootable Linux USB drive to install GRUB from Windows command line.
- The installation process writes GRUB to your boot partition, which is a critical part of your disk — mistakes here can prevent Windows from starting.
- You must run command line as administrator and identify your correct disk and partition before you begin, or you risk overwriting the wrong drive.
- After GRUB installs, your computer will show a menu at startup where you can choose Windows 11 or Linux.
Prepare your system and gather what you need
Before you open command line, you need three things: a Linux distribution (Ubuntu, Fedora, or another variant) either already installed on your machine or available on a bootable USB drive; a Windows 11 system that is currently working; and administrator access to your Windows account. If you do not have Linux installed yet, read an ISO file from your chosen distribution's website, then use a tool like Rufus or Balena Etcher to write it to a USB drive on another computer.
Identify your disk layout using Windows Disk Management. Press Windows key + X, select Disk Management, and look at the list of drives and partitions. Write down which disk holds Windows (usually Disk 0) and note the size and file system of each partition. You will need this information when you run GRUB installation commands, because installing GRUB to the wrong disk will make your computer unbootable.
Create a Windows recovery drive or have your Windows 11 installation media ready. If the GRUB installation fails or conflicts with your Windows boot files, you will need this to restore your system. Insert a blank USB drive into your computer, right-click it in File Explorer, and select Format. Then use the Windows Recovery Media Creator (search for "recovery" in Settings) to write recovery files to the drive.
Boot into Linux and access the command line environment
If you have Linux already installed on your machine, restart your computer and watch for a boot menu — usually GRUB itself if it is already partially set up, or a manufacturer menu (often accessed by pressing F12, F2, or Del during startup). Select your Linux installation and boot into it. If you only have a Linux USB drive, insert it, restart, access the boot menu the same way, and select the USB drive.
Once Linux is running, open a terminal window. In Ubuntu and most distributions, right-click the desktop and select "Open Terminal Here," or search for "Terminal" in the applications menu. You are now in the Linux command line environment, not the Windows command line — this is where GRUB installation commands run.
Identify your Windows boot partition from within Linux. Type lsblk and press Enter to see all disks and partitions. Look for the partition marked as your EFI System Partition (usually a small partition, around 100 to 500 MB, with type "EFI"). Write down its name — it will look like /dev/sda1 or /dev/nvme0n1p1. This is where GRUB will be installed.
Mount the boot partition and prepare the GRUB installation
Create a directory where you can access your Windows boot files. Type sudo mkdir -p /mnt/boot and press Enter. This creates a folder called "boot" inside the /mnt directory. The sudo command gives you administrator permissions, which you need to work with system partitions.
Mount your EFI boot partition to this directory. Type sudo mount /dev/sda1 /mnt/boot (replace sda1 with the correct partition name you found earlier) and press Enter. Linux will now let you see and edit the files on your Windows boot partition. If the command returns an error saying the partition is already mounted, type sudo umount /dev/sda1 first, then try the mount command again.
Install GRUB if it is not already on your Linux system. Type sudo apt-get install grub-efi-amd64 (on Ubuntu or Debian-based systems) or the equivalent command for your distribution. On Fedora, use sudo dnf install grub2-efi-x64. This downloads and installs the GRUB program itself so you can run the installation commands next.
Install GRUB to the boot partition
Run the GRUB installation command. Type sudo grub-install --target=x86_64-efi --efi-directory=/mnt/boot --bootloader-id=GRUB and press Enter. This command tells GRUB to install itself to the EFI boot partition you mounted. The process takes a few seconds and should return no errors if it succeeds.
Generate the GRUB configuration file, which tells GRUB where to find Windows and Linux at startup. Type sudo grub-mkconfig -o /mnt/boot/grub/grub.cfg and press Enter. GRUB will scan your disks, find both Windows and Linux, and write a menu configuration file. You should see output listing the systems it found.
Unmount the boot partition to safely disconnect it. Type sudo umount /mnt/boot and press Enter. This ensures all changes are written to disk before you restart. If you skip this step, some changes may not save.
Restart and test the GRUB menu
Shut down your Linux system. Type sudo shutdown -h now and press Enter, or use the graphical shutdown menu. Remove the Linux USB drive if you booted from one. Wait for the computer to power off completely.
Power the computer back on and watch the startup screen. You should see a GRUB menu with options to boot Windows 11 or Linux. Use the arrow keys to highlight your choice and press Enter. If you see this menu, GRUB installed correctly. Select Windows 11 to verify that Windows still starts normally.
If you do not see a GRUB menu and the computer boots directly into Windows, GRUB may not have installed to the active boot partition. Restart, boot back into Linux, and check that you mounted the correct EFI partition. If you see an error message or the computer will not boot at all, insert your Windows recovery drive and use it to restore your boot files, then try the installation again with the correct partition name.
Troubleshoot common installation problems
If the grub-install command returns "EFI variables are not supported," your system may be booted in BIOS mode instead of EFI mode. Restart and check your BIOS settings — look for an option called "Boot Mode" or "UEFI" and make sure it is enabled. Then boot back into Linux and try the installation again.
If GRUB installs but Windows does not appear in the boot menu, the configuration file may not have found it. Boot back into Linux, mount the boot partition again, and type sudo grub-mkconfig -o /mnt/boot/grub/grub.cfg a second time. Sometimes running this command twice helps GRUB detect Windows correctly.
If your computer will not boot into either system, do not panic. Insert your Windows recovery drive, boot from it, and select "Repair your computer." Choose "Troubleshoot," then "Advanced options," then "Startup Repair." Windows will attempt to restore your original boot files. Once Windows boots again, you can try the GRUB installation a second time, or consult your Linux distribution's documentation for distribution-specific GRUB setup steps.
Frequently Asked Questions
Can I install GRUB from Windows command line directly, without booting into Linux?
No. Windows command line cannot write to Linux boot sectors or EFI partitions in the way GRUB requires. You must boot into a Linux environment — either an existing Linux installation or a Linux USB drive — to run GRUB installation commands. The Windows command line does not have the tools or permissions to do this work.
What happens if I install GRUB to the wrong disk?
Your computer will likely not boot into Windows, and you may see error messages at startup. This is why identifying your correct disk in Disk Management before you begin is critical. If this happens, boot from your Windows recovery drive and use Startup Repair to restore your original boot files, then try again with the correct disk name.
Do I need to uninstall Windows to install GRUB?
No. GRUB and Windows can coexist on the same machine. GRUB becomes the first program that runs at startup and shows you a menu to choose which system to load. Your Windows files and installation remain unchanged.
Will GRUB slow down my computer?
No. GRUB only runs at startup to show the boot menu. Once you select Windows, GRUB steps out of the way and Windows runs at normal speed. The only change you will notice is the menu that appears when you power on.
Can I remove GRUB later if I change my mind?
Yes. Boot into Windows, insert your Windows recovery drive, and use Startup Repair to restore your original Windows bootloader. This removes GRUB from the boot process and returns your computer to booting Windows automatically. Your Linux files will remain on disk, but they will not be accessible until you reinstall GRUB or change your boot settings.