Eric Way's Personal Site

I Write $\sin(x)$ Not Tragedies

Dual boot: Fix a broken GRUB

2021-03-12 Coding

I have dual boot Windows 10 and Arch Linux Manjaro on my PC. It happened recently that after updating grub, grub terminal does not show up on booting and shortly afterwards Manjaro would always be launched, which meant Windows became inaccessible for me. Apparently the grub update interfered with the configurations on my machine and made it unable to work properly. Here is how I solved the problem.

Grub configuration files are generated by commands sudo update-grub or sudo grub-mkconfig (actually the first command executes the second, hence they are no different in use). The generated configuration file is located at /boot/grub/grub.cfg, and this file should NOT be edited directly by humans. However you can take a look at its content and check if the Windows Boot Manager entry is missing from this file. Pay attention to the /etc/grub.d/30_os-prober section in the file, because usually Windows Boot Manager is detected by os-prober and then added. If you find text like

1
2
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.

or in that section you find nothing related to Windows Boot Manager whatsoever, then the problem is with os-prober. There are several things you should do:

  1. Ensure that os-prober has been installed on you machine and is able to detect Windows Boot Manager by executing the command sudo os-prober.
    1. If it is not installed, install it with a package manger.
    2. If Windows Boot Manager could not be detected, mount your Windows boot partition and try again.
  2. Ensure that grub has not disabled os-prober. This is achieved by appending a line GRUB_DISABLE_OS_PROBER=false to the file /etc/default/grub.

As long as your Windows Boot Manager itself has not been damaged, this could ensure grub can use os-prober to detect your Windows system and add them to the grub boot configuration. Then sudo update-grub again and check if the Windows Boot Manager entry has been added. However if grub still does not show up on booting, there may be issues with its graphical terminal and a practical fallback is to use its console interface. In the file /etc/default/grub, uncomment the line GRUB_TERMINAL_OUTPUT=console and try rebooting again. After doing all this, my grub terminal finally came back and I was again able to use my Windows system. Personally I actually prefer the console terminal in that it looks more geek apart from being less error-prone, so I decided not to debug my grub graphical interface and just forget about that.

This article was last updated on days ago, and the information described in the article may have changed.