2

today I installed Ubuntu 18.04 on my laptop, I installed it from liveUSB and it is dual booted along with Win 10. When I restart my computer and grub shows up, there is no Win 10 option. I tried many things online, boot repair, i tried

sudo update-grub

and

sudo os-prober

, but it doesn't show anything at all. I will provide further details when you ak about them, but please keep in mind I'm a beginner when it comes to Ubuntu. Thank you.

Edit: SecureBoot is disabled (which is the output of the command mokutil --sb-state), when I type

ls /sys/firmware/efi/

it shows

config_table  efivars  esrt  fw_platform_size  fw_vendor  runtime  runtime-map  systab  vars

I don't think I installed Ubuntu in legacy mode, I checked it before but I'm not sure how to check it once again, to be sure.

Edit 2: The result of a command cat /etc/default/grub is

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

the GRUB_TIMEOUT_STYLE= line was changed by me, original value is hidden, I changet so the GRUB would always appeared on restart, before that it didn't even show up.

1 Answers1

4

Step-1

It was confirmed that Questioner @kihit0mi's Ubuntu installation has EFI boot loader through the following command:

$ ls /sys/firmware/efi/

Whose output was:

config_table  efivars  esrt  fw_platform_size  fw_vendor  runtime  runtime-map  systab  vars

Step-2

The following command did not yield any output:

$ sudo os-prober

Step-3

The following command was issued to generate GRUB menu:

$ sudo update-grub

System was rebooted and an attempt was made to reach GRUB menu through shift command. But it was observed that instead of reaching GRUB menu, it ended up on login screen of Ubuntu!

Step-4

To reach windows login screen, only way was through BIOS setup screen. System was rebooted, and reached BIOS setup screen by pressing del key. It was observed that there were three boot loaders present which are listed as follows:

Ubuntu
Windows Boot Manager and 
EFI PXE.

After setting up Windows Boot Manager to top priority, Windows-10 was logged on successfully!

Step-5

Login to Windows 10. Press the Windows + R keys, type msinfo32.exe in Run dialog box, and then press Enter to open System Infomation window. In the right pane of System Summary, you should see the BIOS MODE line. If the value of BIOS MODE is Legacy, then Windows is booted in legacy mode. If the value of BIOS MODE is UEFI, then Windows is booted in UEFI mode. Questioner @kihit0mi confirmed that the BIOS mode line contained only UEFI. That was really good!

Step-6

Next, the Firmware BIOS was updated to the latest Version. Refer How to Check Your Current BIOS Version and upadate it.

The following command was given again to generate GRUB menu:

$ sudo update-grub

System was rebooted and an attempt was made to reach GRUB menu through shift command. It was good to observe that this time GRUB menu was reached successfully but the presence of Windows-10 was not found!

Step-7

It was decided to put a menuentry into /etc/grub.d/40_custom file which is capable of generating Windows entry into GRUB menu. In order to find out the disk and partition numbers corresponding to Windows Boot loader, it was rebooted and GRUB menu was reached by pressing 'shift' key. The grub > command line was entered, by pressing c, and the following command was given:

grub > ls

But no output yielded. So The disk and partition numbers for Windows loader were guessed to be 0 and 2 respectively which are needed for menuentry preparation.

menuentry "Windows" {
    set root=(hd0,2)
    chainloader +1
}

After creating the above menuentry in file /etc/grub.d/40_custom, issue the following command to make script 40_custom file executable:

$ sudo chmod +x /etc/grub.d/40_custom

Generate GRUB menu with the following command:

$ sudo update-grub

System was rebooted and GRUB menu was reached by pressing shift key. This time there was a Windows loader found. But while trying to boot, the following error was thrown out:

The EFI file path is incorrect error

#Step-8

It was attempted again and again with various disk and partition numbers entries in the menuentry, but all resulted in the same error message the EFI file path is incorrect error after selecting Windows bootloader from GRUB menu.

All these hurdles happened since Questioner @kihit0mi's laptop did not respond to ls command from GRUB menu's command line: grub > ls .

I tried the same from my desktop's GRUB menu with command grub > ls which resulted in the following output:

(hd0) (hd0.gpt8) (hd0.gpt7) (hd0.gpt6) (hd0.gpt5) (hd0.gpt4) (hd0.gpt3) (hd0.gpt2) (hd0.gpt1) (hd1) (hd2) (hd2,gpt4) (hd2,gpt3) (hd2,gpt2) (hd2,gpt1) (hd3) (hd3,gpt4) (hd3,gpt3) (hd3,gpt2) (hd3,gpt1)

How to interpret the above output from GRUB ls command?

  1. Issue the following command for (hd0):

    grub > ls (hd0)

Whose output was:

    Device hd0: No known file system detected - Search size 512 B - Total size 117220824 KiB.

The output even though showed as No known file system but it really represents /dev/sda (look at the Total size). If you keep on probing such as ls (hd0,gpt8), ls (hd0,gpt7), and so on until ls (hd0,gpt1), it will display the partitions that corresponding to devices such as /dev/sda8, /dev/sda7 and so on until /dev/sda1

The above device /dev/sda (120 GB SSD) contains my Ubuntu installation which was shown as (hd0) in grub command line. The gpt1 through gpt8 represents partitions which are efi, swap, /, /usr, /opt, /tmp, /var, and /home respectively.

  1. Now, issue the following command for (hd1):

grub > ls (hd1)

Whose output was:

    Device hd1: No known file system detected - Search size 2048 B - Total size 514 KiB.
  1. Now, issue the following command for (hd2):

grub > ls (hd2)

Whose output was:

    Device hd2: No known file system detected - Search size 512 B - Total size 976762584 KiB.

Although the output was No known file system but it really represents /dev/sdb (look at the Total size). If you keep on probing such as ls (hd2,gpt4), and so on until ls (hd2,gpt1) it will display the partitions that corresponding to devices such as /dev/sdb4 and so on until /dev/sdb1

The above device /dev/sdb is my 1 TB HDD with NTFS filesystem which was shown as (hd2) in grub command line. The gpt1 through gpt4 represents NTFS partitions which are unknown, CodeWrite, ShareMe and Warehouse respectively.

  1. Now, issue the following command for (hd3):

grub > ls (hd3)

Whose output was:

    Device hd3: No known file system detected - Search size 512 B - Total size 244198584 KiB.

Though output showed as No known file system but it really represents /dev/sdc (look at the Total size). If you keep on probing such as ls (hd3,gpt4), and so on until ls (hd3,gpt1), it will display the partitions that corresponding to devices such as /dev/sdc4 and so on until /dev/sdc1

The above device /dev/sdc (250 GB SSD) contains my Windows-10 installation which was shown as (hd3) in grub command line. The gpt1 through gpt4 represents partitions which are EFI, unknown, WindowsOS and WinRE respectively.

#Step-9

Note: Questioner @kihit0mi's ubuntu: no output for the command sudo os-probed. Refer step-2.

Again, I tried sudo os-probed command from my Ubuntu terminal which resulted in the following output:

/dev/sdc1@/efi/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi

A clue was devised from the output of above os-probed command. In order to avoid using trial & error method to look for disk and partition numbers, the following search string was incorporated in /etc/grub.d/40_custom:

search --set=root --file /efi/Microsoft/Boot/bootmgfw.efi

Note: To know more about Grub menu search command, refer this link

Now the new menuentry is capable of searching automatically disk and partition numbers corresponding to windows-10 EFI bootloader, as shown below:

menuentry "Windows" {
    search --set=root --file /efi/Microsoft/Boot/bootmgfw.efi
    chainloader /efi/Microsoft/Boot/bootmgfw.efi
}

After creating the above menuentry in file /etc/grub.d./40_custom, the following command was given to generate GRUB menu:

$ sudo update-grub

System was rebooted and GRUB menu was reached by pressing shift key.

This time Windows-10 EFI bootloader was selected and booted into Windows-10 system successfully.

#Step-10:

not yet completed.

The Questioner @kihit0mi's presence is required at chat session in order to complete pending task which is the removal of extraneous bootloader present in the BIOS setup screen.

Kulfy
  • 17,696
Marmayogi
  • 2,488
  • TLDR; If you can't find the right WINDOWS 10 device and boot partition so you can include it in GRUB, follow STEP #9 of this answer. – Thodoxicate Nov 20 '20 at 19:11