How to restore the GRUB menu for dual-boot Linux and Windows

No image preview
IT /
System&Network/

#linux

#system

#administration



Having more systems on your machine could have its own benefits over VMs but the setup can be prone to rare hiccups from now and there. One of them is failed GRUB(Grand Unified Bootloader).

 


 


One day you turn on your PC and it boots right away into one of the multi-boot systems you have on your machine. Where the heck is the boot menu? surprise

 


To fix this you can try to enter into your BIOS with FN+F2 or an appropriate keys combination for your machine, from here we will try to boot the Linux partition. If you are using UEFI you will be able to select a partition with Linux on it. Select the partition with Linux and set it to be the first to boot. If you have older BIOS  you will need to create boot media with Linux image.

 


If you are using UEFI things will be far easier, after booting into the system you will just need to find your configuration files for the grub in the etc/default/grub.

 

 

Optional! If there is no GRUB installed you will need to run the installation command as well.

sudo grub-install

 

 

To edit the grub config file enter in the terminal:

 

sudo nano /etc/default/grub

 


It will open this window.

 

 

terminal1.png

 

 

 

To boot Linux set the GRUB_DEFAULT to 0. If you want to default boot for instance in Windows set 1. Check that GRUB_TIMEOUT_STYLE is set to the argument menu and not hidden​​​​​​. Now save the file with CTRL+S and update GRUB with the following command. 

 

 

sudo update-grub



After the reboot, you should be offered a boot menu where you can choose what operating system you want to use.


If you do not have UEFI but BIOS, you will need to make a bootable USB or other media and run Linux Installation boot. After you have entered into play-live OS open the terminal and type the following command to list all disks.
 

 

sudo fdisk -l

 


After that select your Linux partition or disk and mount it by(enter the name of your path instead sda1):
 

 

sudo mount /dev/sda1 /mnt/linux

 


Now, we need to change the root to our Linux partition OS so we can make changes in that Linux partition.
 

 

sudo chroot  /mnt/linux

 

We can use this terminal just like if we would boot into the Linux on the partition, from here we will reinstall the GRUB and update its configuration.

 

To reinstall GRUB run the following commands. Before you reboot you can re-check etc/default/grub properties to be sure everything is just like intended.
 

 

sudo grub-install
sudo grub-update
reboot

 


If your BIOS boot options are set right you should have the boot menu restored now.  Have a good one. laugh

[root@techtoapes]$ whoami
[root@techtoapes]$ Author Luka

Login to comment.

Admin Luka #1
“ Well begun is half done. ” — Aristotle