How To Dual Boot Linux And Windows 10
Many people think that easy dual-booting is reserved for operating systems like Linux Mint or Ubuntu, where everything is taken care of in the installer tool. The reality is that this setup is easily achievable on nearly any Linux distribution on the market, using a simple tool. You can dual boot Linux and Windows 10 regardless of which Linux distribution you’re running.
SPOILER ALERT: Scroll down and watch the video tutorial at the end of this article.
The tool that allows users to easily set up a dual-boot on Linux is known as OS Prober. It scans all hard drives and partitions on a PC and looks for operating systems. When it finds them, it will automatically generate a Grub boot entry that then is used to dual-boot.
To get started with this guide, you’ll need to correctly partition your hard drives, so there is room for both operating systems. Partitioning two different operating systems can be a real pain, and isn’t recommended. Instead, if you plan to dual boot Linux and Windows 10, consider using separate hard drives.
By installing Windows 10 and Linux on two different hard drives, you bypass the need for partitioning. Additionally, the operating systems never touch each other, and there’s no need to learn how to “uninstall Linux” if you end up hating it.
Note: when installing Windows on a dedicated drive, make sure that the Linux hard drive you plan to use is disconnected from the PC. Microsoft Windows has difficulties installing when multiple drives are present. Additionally, you may accidentally delete your Linux installation.
Set Up Dual Boot
After installing Windows and your Linux distribution on their own dedicated hard drives, reconnect and load up the Linux one. From here, open up a terminal window and gain root access. To give the OS Prober tool the best chance of success, use the fsck tool to fix any hard drive errors that may be present on the Windows drive.
Mount the Windows drive by opening the file manager, then click on the drive mount it. Go to the terminal and run the lsblk command to view the block device names for all connected drives. Find out what the Windows hard drive is, and then run:
sudo fsck -y /dev/sdX
When Fsck is finished, follow the command below to install OS Prober.
Note: UEFI users must also use EFI boot manager to detect UEFI enabled OSes
Ubuntu
sudo apt install os-prober efibootmgr
Debian
sudo apt-get install os-prober efibootmgr
Arch Linux
sudo pacman -S os-prober efibootmgr
Fedora
sudo dnf install os-prober efibootmgr
OpenSUSE
sudo zypper install os-prober efibootmgr
Other Linuxes
OS Prober and EFI boot manager are required for dual-booting. As most Linux distributions try to offer this feature to new Linux users, this software should be easy to find. To install it open up the package manager, search for “os-prober”, “efibootmgr” and install it the way packages are normally installed.
Detect Operating Systems
OS Prober does a lot of work, but there’s no actual reason to call it. Instead, it works with the Grub bootloader itself, when the user generates a new configuration file. To generate a new config, open up a terminal and run the following commands.
Note: your operating system may have an official “update-grub” command. Be sure to check the official Wiki for your operating system before continuing. Most Grub installations on Linux are located at /boot/grub/, so the following command should work correctly to update Grub.
sudo grub-mkconfig -o /boot/grub/grub.cfg
If the Grub boot-loader fails to update, your configuration may be in another location (this is usually only true for Fedora/SUSE users). Try this one instead.
grub2-mkconfig -o /boot/grub2/grub.cfg
Remove Dual Boot
Removing an operating system from the dual-boot is incredibly easy with this method because there are no partitions to delete. If you’ve decided that you no longer want to use Windows 10 with your Linux PC (for whatever reason), here’s how to remove it from the Grub bootloader.
Power down your PC and open up it up. Find the Windows 10 hard drive and unplug it from the power supply and motherboard. This will ensure that Grub and OS Prober can’t see it. When everything is unplugged, turn the PC back on and log into Linux.
Open up terminal and re-run the Grub update tool:
sudo grub-mkconfig -o /boot/grub/grub.cfg
or
grub2-mkconfig -o /boot/grub2/grub.cfg
Os Prober and Grub will re-scan your PC and look for operating systems like before. However, because the Windows 10 hard drive isn’t connected, OS Prober thinks that it no longer exists. As a result, Grub will remove the entry from the bootloader.
Linux dual-booting
In this tutorial, a heavy focus was put on Windows because the majority of Linux users, when talking about dual-booting, prefer Windows. That being said, OS-Prober can detect any operating system on any partition or hard drive. If you’re looking to set up other Linux distributions, or even stuff like BSD and Haiku, this method should work just fine.